GithubHelp home page GithubHelp logo

tdryer / hangups Goto Github PK

View Code? Open in Web Editor NEW
1.7K 70.0 192.0 2.32 MB

the first third-party instant messaging client for Google Hangouts

Home Page: https://hangups.readthedocs.io/

License: MIT License

Python 99.09% Makefile 0.75% Dockerfile 0.16%
python asyncio python-3 chat google-hangouts

hangups's Introduction

hangups

CI Status Documentation Status Snap Status

hangups is the first third-party instant messaging client for Google Hangouts. It includes both a Python library and a reference client with a text-based user interface.

Unlike its predecessor Google Talk, Hangouts uses a proprietary, non-interoperable protocol. hangups is implemented by reverse-engineering this protocol, which allows it to support features like group messaging that aren't available in clients that connect via XMPP.

hangups is still in an early stage of development. The reference client is usable for basic chatting, but the API is undocumented and subject to change. Bug reports and pull requests are welcome!

hangups screenshot

Documentation

See the documentation for installation and usage instructions.

Projects using hangups

Related projects

  • Hangish: A Google Hangouts native client for Sailfish
  • Hangups-UWP: Hangups client for Universal Windows Platform
  • Parrot: The next generation messenger
  • WTalk: Client library and desktop client for Google Hangouts written in C#
  • YakYak: Desktop client for Google Hangouts
  • go-hangups: Port of hangups to Go
  • hangover: The first native Mac OS X client for Google Hangouts
  • hangups-rs: Port of hangups to Rust
  • hangupsjs: Port of hangups to Node.js
  • purple-hangouts: Hangouts plugin for libpurple
  • slangouts: A Hangouts/Slack bridge

hangups's People

Contributors

achilleas-k avatar andrewjdr avatar baskervald avatar calin-iorgulescu avatar cdce8p avatar das7pad avatar dlenski avatar endofline avatar equidamoid avatar j16sdiz avatar jamesofarrell avatar lorenzos avatar loumray avatar mchearty avatar mirryi avatar mtomwing avatar nylonee avatar ovkulkarni avatar polyzen avatar rudloff avatar shaunofthelive avatar stuntspt avatar tdryer avatar terencehonles avatar terrance avatar trollkarlen avatar tych0 avatar xmikos avatar yossi avatar yuan-jiang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hangups's Issues

Hangups fails to find all contact names

I get KeyError in on_connect() method in __main__.py when hangups tries to get user names for user_ids in conversations:

first_names = [contacts[user_ids]['first_name']
                        for user_ids in
                        conversations[conv_id]['participants']]

It works if I change it to:

first_names = [contacts[user_ids]['first_name'] if user_ids in contacts else "UNKNOWN"
                        for user_ids in
                        conversations[conv_id]['participants']]

But then I have a lot of UNKNOWN user names in list of conversations.

Installing with the latest version of pip is broken

# pip install --upgrade hangups
....
Downloading robobrowser==0.5.1 (from hangups)
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-b8uil4ge/robobrowser/setup.py", line 38, in <module>
        for requirement in parse_requirements('requirements.txt')
      File "/tmp/pip-build-b8uil4ge/robobrowser/setup.py", line 37, in <listcomp>
        str(requirement.req)
      File "/usr/lib/python3.4/site-packages/pip/req/req_file.py", line 19, in parse_requirements
        "parse_requirements() missing 1 required keyword argument: "
    TypeError: parse_requirements() missing 1 required keyword argument: 'session'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

      File "<string>", line 20, in <module>

      File "/tmp/pip-build-b8uil4ge/robobrowser/setup.py", line 38, in <module>

        for requirement in parse_requirements('requirements.txt')

      File "/tmp/pip-build-b8uil4ge/robobrowser/setup.py", line 37, in <listcomp>

        str(requirement.req)

      File "/usr/lib/python3.4/site-packages/pip/req/req_file.py", line 19, in parse_requirements

        "parse_requirements() missing 1 required keyword argument: "

    TypeError: parse_requirements() missing 1 required keyword argument: 'session'

    ```

Google Voice contacts show phone number instead of name

Many people (including myself) link their Google Voice numbers to their Google Hangouts, so they can text from Hangouts. The way the official clients work is, they check the numbers in your Contacts and let you know whose number it is in the list, so the hangouts API doesn't deliver that data.

 Conversations   Lexina Ero   +1704574XXXX                                                                                                                     
  < Lexina Ero (2)                                                                                                                                          >
  < +1704574XXXX                                                                                                                                            >
  < +1940395XXXX                                                                                                                                            >
  < +1 704-777-XXXX                                                                                                                                         >
  < +1 704-780-XXXX                                                                                                                                         >
  < +1704989XXXX                                                                                                                                            >
  < (704) 456-XXXX                                                                                                                                          >
  < +1 704-315-XXXX                                                                                                                                         >
  < (704) 995-XXXX                                                                                                                                          >
  < +1980216XXXX                                                                                                                                            >
  < +1 980-229-XXXX                                                                                                                                         >
  < +1704287XXXX                                                                                                                                            >
  < +1 704-242-XXXX                                                                                                                                         >
  < +1704576XXXX                                                                                                                                            >
  < +1 704-526-XXXX                                                                                                                                         >
  < (980) 322-XXXX                                                                                                                                          >
  < +1 347-683-XXXX                                                                                                                                         >
  < +1 704-774-XXXX                                                                                                                                         >
  < +1 980-228-XXXX                                                                                                                                         >
  < +1 704-222-XXXX                                                                                                                                         >
  < +1704858XXXX                                                                                                                                            >

For reference, that's how the list looks for me now. As you can see, the numbers can have multiple different formats depending on how they're entered, so, depending on how Google Contacts handles it, some conversion may be necessary.

I would recommend implementing it as a check on startup, and perhaps adding a keybind to refresh them, if you had added someone to your contacts while the app was open (maybe allow you to add them from within the app as well?)

SyntaxError on startup

~ # hangups
Traceback (most recent call last):
  File "/usr/bin/hangups", line 9, in <module>
    load_entry_point('hangups==0.2.6', 'console_scripts', 'hangups')()
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 519, in load_entry_point

  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2630, in load_entry_point

  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2310, in load

  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2316, in resolve

  File "/usr/lib/python2.7/site-packages/hangups/__init__.py", line 2, in <module>
    from .schemas import (TypingStatus, FocusStatus, FocusDevice, SegmentType,
  File "/usr/lib/python2.7/site-packages/hangups/schemas.py", line 8, in <module>
    from hangups.pblite import Message, Field, RepeatedField, EnumField
  File "/usr/lib/python2.7/site-packages/hangups/pblite.py", line 129
    def __init__(self, *args, is_optional=False):
                                        ^
SyntaxError: invalid syntax

opensuse 13.2, x64.

Dump messages

Hi,

will be a great improve if I can dump all messages of a conversation without interact.
For example:

./hangups --dump --conversation="The testing chat" --output=mySpeak.log

Dump all messages from chat with title "The testing chat" into the file mySpeak.log

v.

Hangup freezes when opening a group conversation

Hi!

The client works fine for everything except that when I open a group conversation, the application freezes completely and I only can exit and open it again.

Other group conversations works fine, but the one I'm trying to open have a custom name (instead of all contact names), could it be the problem?

Thanks!

EDIT: Just noticed that even receiving a message for that group, I see the notification and the app freezes without trying to open the conversation.

OS: Mac OS X 10.10 Mavericks

honor disabled hangout history

Using hangups 1.2.2, running on Ubuntu 14.04, downloaded from pip3

In a hangout which shows "Hangout history" disabled, or unchedked, in the Hangouts app and Gmail, messages sent from the hangups built-in client are still logged to the history.

This is shown in the Gmail client as text bubbles with a fully white background. Messages without history appear with a gray background. This is confirmed when joining the hangout on a new device, and other, newer messages are lost, but the messages sent from hangups remain.

configuration file

Hi ! Would be great to have a configuration file for every bindings and colorscheme :). Why not have a direct integration with vim!

Anyway! Great job and thanks to you!

Chat messages to Google Voice conversations don't send, but are saved in chat history

EDIT: See below for the real issue.

With normal hangouts conversations, it works fine, but after sending a message to a number using Google Voice integration, it doesn't show up in the chat. I've confirmed that it's actually sent using both the web interface on plus.google.com and by quitting the application, then starting it back up.

I seem to receive the messages just fine, although I haven't yet been able to test whether my own messages show up when I receive one. I'll update as soon as I do.

Receiving two copies of messages (sometimes)

In ongoing conversations, sometimes Hangups displays a received message twice. It will, however, only show up once in the Chrome-extension Hangouts.

I haven't identified any pattern. It can happen in one-on-one conversations or group conversations.

Example:
(11:59:36 AM) Ryan: Hello
(11:59:36 AM) Ryan: Hello

What information can I provide to help troubleshoot this?

Option to disable popup notifications

It would be nice to be able to disable pop-up notifications. I use hangouts for on-going group chats, and I don't want to be notified for every message someone sends.

"Unknown" user name in converstaion

I have got some "Unknown" user in hangups reference client.

client_conversation.participant_data contains namespace(fallback_name=None, id_=namespace(chat_id='(ID)', gaia_id='(ID)')), note the fallback_name is None

``WARNING - Adding fallback User` Message were found.

I have tried gmail under fiddler, the contact name can be loaded using /chat/v1/contacts/getentitybyid.

If you need more information, please tell me how to gather them.
Thanks

Frequent disconnections from "Unknown SID" error

Every 3-4 minutes, the current long-polling request will end and hangups will try to open a new one. The new connection can unpredictably fail with HTTP 400 "Unknown SID", which logs the following warning:

hangups.channel - WARNING - Long-polling request failed because SID became invalid. Will attempt to recover.

This is probably the result of a bug in hangups, but I haven't been able to find it.

Links sent via hangups don't show up as links in gmail client.

The title says it all.
If I type http://www.google.com in the gmail client, it shows up on the other end as a link. The other person only has to click on it to follow it.
However, if I type it from hangups, it does not show up on the other end as a link, but rather as plaintext. The person on the other end has to copy & paste it to the address bar of the browser to follow it.
It's not a critical issues, but it is annoying.

Default configuration in config file

It would be nice to have the default values for all configuration options in a file that is installed/distributed with the program. This way, users can see the default options and also the config file formatting at the same time, making it easier to change settings. I would also recommend that this file be used by hangups by default, instead of relying on values in the source.

I can write it myself and send a PR within the next few days, if you think it's a good idea.

Unicode characters in Hangups

I can type french characters in my terminal, but not in hangups, nor can I receive them from other participants.
Am I doing something wrong, or is it just hangups not handling characters encoding well as of now?

Fail after second factor PIN entered

I know the request is going through - I used one of my "backup codes" on it, and saw it disappear. However, I'm getting "Login failed (Second factor failed)" consistently.

The setup is workable; I have a throwaway google account (without second factor auth) that can log in just fine.

Fair warning: I know just enough to be dangerous to myself. Would posting the debug logs expose any private info?

Failed to parse initial client entities

Failed to parse initial client entities: Message field 'entities': RepeatedField is not optional
WARNING:root:Adding fallback User: <hangups.user.User object at 0x7f7aab1e3fd0>
WARNING:root:Adding fallback User: <hangups.user.User object at 0x7f7aab1e4828>
WARNING:root:Adding fallback User: <hangups.user.User object at 0x7f7aab1e4b38>
WARNING:root:Adding fallback User: <hangups.user.User object at 0x7f7aab1e4438>
WARNING:root:Adding fallback User: <hangups.user.User object at 0x7f7aab1e4e10>
WARNING:root:Adding fallback User: <hangups.user.User object at 0x7f7aab1e4be0>
WARNING:root:Adding fallback User: <hangups.user.User object at 0x7f7aab1e4358>
WARNING:root:Adding fallback User: <hangups.user.User object at 0x7f7aab1e4eb8>

debug print

    initial_entities = []
    try:
        print("ds:21", data_dict['ds:21'])
        entities = schemas.INITIAL_CLIENT_ENTITIES.parse(
            data_dict['ds:21'][0]
        )
    except ValueError as e:
        logger.warning('Failed to parse initial client entities: {}'
                       .format(e))

then I get this

ds:21 [['cic:ouc', 'https://plus.google.com']]

URLs sent through hangups aren't clickable

The mobile Hangouts app makes them clickable, but they're not clickable in the web app (e.g. Chrome plugin or the hangouts side bar in gmail.com or plus.google.com).

Login fails when Google prompts for login verification

Getting login failed with latest version / git d0ac4d5

Nothing of use or interest in the logs:

$ hangups -d --log /var/tmp/hu.log
Email: [email protected]
Password:xxxxxxxxxxxx

Login failed (Login failed)
$ cat /var/tmp/hu.log
2015-03-07 10:33:49,499 - hangups.auth - INFO - Attempting to load auth cookies from /home/gerry/.cache/hangups/cookies.json
2015-03-07 10:33:49,499 - hangups.auth - INFO - Failed to load saved auth cookies
2015-03-07 10:33:49,499 - hangups.auth - INFO - Starting Google login...
2015-03-07 10:33:49,507 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): accounts.google.com
2015-03-07 10:33:49,591 - requests.packages.urllib3.connectionpool - DEBUG - "GET /ServiceLogin HTTP/1.1" 200 None
2015-03-07 10:33:57,628 - hangups.auth - INFO - Submitting login form...
2015-03-07 10:33:57,682 - requests.packages.urllib3.connectionpool - DEBUG - "POST /ServiceLoginAuth HTTP/1.1" 302 227
2015-03-07 10:33:58,118 - requests.packages.urllib3.connectionpool - DEBUG - "GET /LoginVerification HTTP/1.1" 200 None
2015-03-07 10:33:58,126 - hangups.auth - INFO - Login does not require second factor
$

CTRL-J not working as keybinding

I tried to use more vim-like keybindings and started hangups(0.2.4) with the following commandline:

hangups --key-next-tab 'ctrl k' --key-prev-tab 'ctrl j'

The next-tab key works flawlessly, but the prev-tab key only ever works when on the first tab(conversations). I can't reproduce this problem with the default settings.

Document how to change keybindings

I couldn't figure out the format for changing the keybindings. I tried a few different things ("ctrl p", ctrl-p, and ctrl_p) and nothing worked and tried looking in the documentation and there is no example of changing it. Could an example be added?

Initialize chat request failed

Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/hangups/client.py", line 178, in _initialize_chat
params=CHAT_INIT_PARAMS, connector=self._connector
File "/usr/lib/python3.4/site-packages/hangups/http_utils.py", line 54, in fetch
.format(res.status, res.reason))
hangups.exceptions.NetworkError: Request return unexpected status: 400: Bad Request

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/bin/hangups", line 9, in
load_entry_point('hangups==0.2.2', 'console_scripts', 'hangups')()
File "/usr/lib/python3.4/site-packages/hangups/ui/main.py", line 599, in main
}, COL_SCHEMES[args.col_scheme])
File "/usr/lib/python3.4/site-packages/hangups/ui/main.py", line 73, in init
loop.run_until_complete(self._client.connect())
File "/usr/lib/python3.4/asyncio/base_events.py", line 208, in run_until_complete
return future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 243, in result
raise self._exception
File "/usr/lib/python3.4/asyncio/tasks.py", line 319, in _step
result = coro.send(value)
File "/usr/lib/python3.4/site-packages/hangups/client.py", line 104, in connect
initial_data = yield from self._initialize_chat()
File "/usr/lib/python3.4/site-packages/hangups/client.py", line 182, in _initialize_chat
.format(e))
hangups.exceptions.HangupsError: Initialize chat request failed: Request return unexpected status: 400: Bad Request

"channel not ready" error prevents messages from being received

Sometimes hangups will appear to connect successfully, but will never receive messages or any other channel events. This appears to be a race condition in the channel setup that affects some users more than others.

When this happens, the channel receives a "channel not ready" error on startup:

2015-01-06 11:56:15,612 - hangups.channel - DEBUG - Received push data:
b'206\n[[3,[{"p":"{\\"1\\":{\\"1\\":{\\"1\\":{\\"1\\":1,\\"2\\":1}},\\"4\\":\\"XXXXXXXXXXXXXX\",\\"5\\":\\"S1\\"},\\"4\\":{\\"1\\":{\\"1\\":\\"babel\\",\\"2\\":\\"XXXXXXXXXXXXXX\\"},\\"4\\":{\\"1\\":3,\\"2\\":\\"channel not ready: babel\\"}}}"}]]\n]\n224\n[[4,[{"p":"{\\"1\\":{\\"1\\":{\\"1\\":{\\"1\\":1,\\"2\\":1}},\\"4\\":\\"XXXXXXXXXXXXXX\\",\\"5\\":\\"S2\\"},\\"4\\":{\\"1\\":{\\"1\\":\\"hangout_invite\\",\\"2\\":\\"XXXXXXXXXXXXXX\\"},\\"4\\":{\\"1\\":3,\\"2\\":\\"channel not ready: hangout_invite\\"}}}"}]]\n]\n152\n[[5,[{"p":"{\\"1\\":{\\"1\\":{\\"1\\":{\\"1\\":1,\\"2\\":1}},\\"4\\":\\"XXXXXXXXXXXXXX\\",\\"5\\":\\"S3\\"},\\"3\\":{\\"1\\":{\\"1\\":1},\\"2\\":\\"lcsw_hangoutsXXXXXXXXXXXXXX\\"}}"}]]\n]\n'

Workaround: add a time.sleep(1) to the beginning of the Channel._subscribe method.

If you're experiencing this issue, please try the latest version of hangups from git, as it contains a possible mitigation.

Display name exception on login

I get this stacktrace on version 0.1.1 and latest from master immediately after login:

Traceback (most recent call last):
  File "/Users/sherzberg/.virtualenvs/hangups/bin/hangups", line 9, in <module>
    load_entry_point('hangups==0.1.1', 'console_scripts', 'hangups')()
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/hangups/__main__.py", line 404, in main
    ioloop.IOLoop.instance().run_sync(main_coroutine)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/ioloop.py", line 389, in run_sync
    return future_cell[0].result()
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/concurrent.py", line 129, in result
    raise_exc_info(self.__exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/stack_context.py", line 302, in wrapped
    ret = fn(*args, **kwargs)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 574, in inner
    self.set_result(key, result)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 500, in set_result
    self.run()
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 529, in run
    yielded = self.gen.throw(*exc_info)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/hangups/__main__.py", line 389, in main_coroutine
    yield client.connect(cookies)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 520, in run
    next = self.yield_point.get_result()
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 409, in get_result
    return self.runner.pop_result(self.key).result()
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/concurrent.py", line 129, in result
    raise_exc_info(self.__exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/stack_context.py", line 302, in wrapped
    ret = fn(*args, **kwargs)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 574, in inner
    self.set_result(key, result)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 500, in set_result
    self.run()
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 529, in run
    yielded = self.gen.throw(*exc_info)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/hangups/client.py", line 201, in connect
    yield self._init_talkgadget_1()
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 520, in run
    next = self.yield_point.get_result()
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 409, in get_result
    return self.runner.pop_result(self.key).result()
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/concurrent.py", line 129, in result
    raise_exc_info(self.__exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/stack_context.py", line 302, in wrapped
    ret = fn(*args, **kwargs)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 574, in inner
    self.set_result(key, result)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 500, in set_result
    self.run()
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/tornado/gen.py", line 531, in run
    yielded = self.gen.send(next)
  File "/Users/sherzberg/.virtualenvs/hangups/lib/python3.4/site-packages/hangups/client.py", line 347, in _init_talkgadget_1
    'first_name': display_name.split()[0],
AttributeError: 'NoneType' object has no attribute 'split'

Request for more documentation

I am using the hangups client but am unsure how to perform some actions:

  • How do I exit the application? Ctrl+C works but is probably not ideal.
  • How do I close an open tab? Workaround by closing application entirely and reopening other tabs.
  • How do I start a new conversation? The conversations tab only seems to list existing conversations.

Maybe these features are not yet implemented, I have to admit I haven't looked at the code much yet.

Hangups crashes because of broken utf-8 decoding (UnicodeDecodeError)

Hello,

Hangups frequently crashes with UnicodeDecodeError. I think it is because sometimes incoming push data is broken (or cut) after first byte of two-bytes UTF-8 character, because it is always one of these messages:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 1370: unexpected end of data
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 1370: unexpected end of data
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc5 in position 1370: unexpected end of data

Here is full example:

2014-08-19 11:09:59,487 - tornado.application - ERROR - Uncaught exception
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/tornado/http1connection.py", line 527, in _read_chunked_body
    yield gen.maybe_future(delegate.data_received(chunk))
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 617, in run
    value = future.result()
  File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 109, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 175, in wrapper
    yielded = next(result)
  File "/usr/lib/python3.4/site-packages/tornado/http1connection.py", line 571, in data_received
    yield gen.maybe_future(self._delegate.data_received(chunk))
  File "/usr/lib/python3.4/site-packages/tornado/simple_httpclient.py", line 520, in data_received
    self.request.streaming_callback(chunk)
  File "/usr/lib/python3.4/site-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/home/storage/temp/hangups/hangups/http_utils.py", line 91, in _streaming_callback
    streaming_callback(data)
  File "/home/storage/temp/hangups/hangups/channel.py", line 244, in _on_push_data
    messages = self._push_parser.get_messages(data_bytes.decode())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 1020: unexpected end of data
2014-08-19 11:09:59,492 - tornado.application - ERROR - Exception in callback functools.partial(<function wrap.<locals>.null_wrapper at 0x7fdbae830c80>, <tornado.concurrent.Future object at 0x
7fdbaf1ecb70>)
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/tornado/http1connection.py", line 527, in _read_chunked_body
    yield gen.maybe_future(delegate.data_received(chunk))
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 617, in run
    value = future.result()
  File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 109, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 175, in wrapper
    yielded = next(result)
  File "/usr/lib/python3.4/site-packages/tornado/http1connection.py", line 571, in data_received
    yield gen.maybe_future(self._delegate.data_received(chunk))
  File "/usr/lib/python3.4/site-packages/tornado/simple_httpclient.py", line 520, in data_received
    self.request.streaming_callback(chunk)
  File "/usr/lib/python3.4/site-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/home/storage/temp/hangups/hangups/http_utils.py", line 91, in _streaming_callback
    streaming_callback(data)
  File "/home/storage/temp/hangups/hangups/channel.py", line 244, in _on_push_data
    messages = self._push_parser.get_messages(data_bytes.decode())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 1020: unexpected end of data

During handling of the above exception, another exception occurred:During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 620, in run
    yielded = self.gen.throw(*sys.exc_info())
  File "/home/storage/temp/hangups/hangups/http_utils.py", line 59, in fetch
    connect_timeout=connect_timeout, request_timeout=request_timeout
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 617, in run
    value = future.result()
  File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 111, in result
    raise self._exception
  File "/usr/lib/python3.4/site-packages/tornado/stack_context.py", line 314, in wrapped
    ret = fn(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/tornado/simple_httpclient.py", line 384, in <lambda>
    lambda f: f.result())
  File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 109, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 620, in run
    yielded = self.gen.throw(*sys.exc_info())
  File "/usr/lib/python3.4/site-packages/tornado/http1connection.py", line 207, in _read_message
    yield body_future
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 617, in run
    value = future.result()
  File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 109, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 620, in run
    yielded = self.gen.throw(*sys.exc_info())
  File "/usr/lib/python3.4/site-packages/tornado/http1connection.py", line 527, in _read_chunked_body
    yield gen.maybe_future(delegate.data_received(chunk))
  File "/usr/lib/python3.4/site-packages/tornado/http1connection.py", line 52, in __exit__
    raise _QuietException
tornado.http1connection._QuietException

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/tornado/ioloop.py", line 565, in _run_callback
    ret = callback()
  File "/usr/lib/python3.4/site-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 697, in <lambda>
    self.future, lambda f: self.run())
  File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 646, in run
    self.result_future.set_exc_info(sys.exc_info())
  File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 167, in set_exc_info
    self.set_exception(exc_info[1])
  File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 150, in set_exception
    self._set_done()
  File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 177, in _set_done
    cb(self)
  File "/home/storage/temp/hangups/hangups/http_utils.py", line 31, in done_callback
    self.set_result(future)
  File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 145, in set_result
    self._set_done()
  File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 175, in _set_done
    for cb in self._callbacks:
TypeError: 'NoneType' object is not iterable

Crash on startup: VersionConflict, DistributionNotFound

When starting hangups it exits with this:

Traceback (most recent call last):
  File "D:\Python34\lib\site-packages\pkg_resources.py", line 2697, in <module>
    working_set.require(__requires__)
  File "D:\Python34\lib\site-packages\pkg_resources.py", line 669, in require
    needed = self.resolve(parse_requirements(requirements))
  File "D:\Python34\lib\site-packages\pkg_resources.py", line 576, in resolve
    raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (six 1.9.0 (d:\python34\lib\site-packages), Requirement.parse('six==1.7.3'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Python34\Scripts\hangups-script.py", line 5, in <module>
    from pkg_resources import load_entry_point
  File "D:\Python34\lib\site-packages\pkg_resources.py", line 2701, in <module>
    parse_requirements(__requires__), Environment()
  File "D:\Python34\lib\site-packages\pkg_resources.py", line 572, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: six==1.7.3

Mouse Support

This is an enhancement.

It would be nice to have mouse support, such as clicking on conversation tabs. Urwid seems to have some support for this.

Some ideas could be:

  • Clicking (switching) conversation tabs (as said earlier)
  • Scrolling through the conversation
  • Clicking on people's names to fill in "@{username}" in the text field

More user-friendly shortcuts

While I do see the logic of ctrl+u (Up) and ctrl+d (Down), those shortcuts requires moving the right hand from the arrows to the home row.

Maybe add an alias to those shortcuts? Something like ctrl+ left arrow for ctrl+u and ctrl+ right arrow for ctrl+d.

warning "Failed to parse ClientStateUpdate:..." raised when leaving a group chat

This warning is logged when leaving a group chat:

Failed to parse ClientStateUpdate: Message field 'client_conversation': Message field 'self_conversation_state': Message field 'self_read_state': Message is not optional

It does not seem to visibly affect anything else - after dumping the payloads being processed by parser.py - I note that the stated fields in the payload are all empty.

I tried tweaking schemas.py to make the fields is_optional and succeeded in suppressing the warning. Unfortunately, this introduced a worse error when leaving a conversation: the hangups library first crashes with an exception on latest_read_timestamp, then on each subsequent reconnection, crashes with an exception in conversation.py:add_conversation

I leave my experimental changes for reference purposes in this commit: endofline@68eb8c3

It is not recommended to merge this due to the above error. I suspect by suppressing the original warning, I allowed an incomplete payload to be parsed and used by the library.

Requesting datestamp when day flips over in conversation

This is more of a feature request, but right now, when a conversation tab is opened, some of the conversation history is loaded. There is, however, no indication when that history is from.

For example, hangups displays:

(09:41:43 AM) Brian: [SNIP]

(11:21:04 AM) Jason: [SNIP]

In reality, the 9:41:43 AM message could have been from 3 months ago.

A few optional solutions:

  1. Allow for a command line flag to enable full datetime stamps on all messages. Maybe easier to implement?

(2014\08\01 09:41:43 AM) Brian: [SNIP]

(2014\10\08 11:21:04 AM) Jason: [SNIP]

  1. Separators stating the datetime of messages (irssi style). Takes up less screen real estate in an active conversation. Probably my preference.

2014\08\01
(09:41:43 AM) Brian: [SNIP]
2014\10\08
(11:21:04 AM) Jason: [SNIP]

  1. Datestamps for anything older than today. This is how the Chrome Hangouts client works. Not a huge fan and seems like you'd have to redraw if you have a conversation open for multiple days, but some people might like it.

(2014\08\01 09:41:43 AM) Brian: [SNIP]

(11:21:04 AM) Jason: [SNIP]

Json decode error in _init_talkgadget_1

When I started to play with Hangups client I've got the exception at line 398 (client.py).
The data variable contained something like {key: 'ds:27', isError: false , hash: '35', data:function(){...}.
I've made a workaround tom make it work:
data = re.sub('function\(\)\{[^}]*\}', "0", data) and all worked fine.
Actually I can't reproduce the issue now and don't know if it was related to my code or it just happens sometimes.

hangups crashes on start with problems on timestamp

Here is the error message:

Traceback (most recent call last):
  File "/usr/bin/hangups", line 9, in <module>
    load_entry_point('hangups==0.2.4', 'console_scripts', 'hangups')()
  File "/usr/lib/python3.4/site-packages/hangups/ui/__main__.py", line 699, in main
    }, COL_SCHEMES[args.col_scheme])
  File "/usr/lib/python3.4/site-packages/hangups/ui/__main__.py", line 76, in __init__
    loop.run_until_complete(self._client.connect())
  File "/usr/lib/python3.4/asyncio/base_events.py", line 268, in run_until_complete
    return future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 236, in _step
    result = next(coro)
  File "/usr/lib/python3.4/site-packages/hangups/client.py", line 103, in connect
    initial_data = yield from self._initialize_chat()
  File "/usr/lib/python3.4/site-packages/hangups/client.py", line 214, in _initialize_chat
    data_dict['ds:21'][0][1][4]
  File "/usr/lib/python3.4/site-packages/hangups/parsers.py", line 73, in from_timestamp
    ).replace(microsecond=(microsecond_timestamp % 1000000))
TypeError: unsupported operand type(s) for //: 'str' and 'int'

I have tried stuff such as doing "int(timestamp)", but the timestampo variable seems to be "", which means that "int(timestamp)" will fail also.

It was working fine last night. Rebuilding from the latest git did not solve the problem either.

_init_talkgadget_1() fails when building a dict of conversation

When I try to start hangups, I get this error after login:

File "/home/mikos/python/hangups/hangups/client.py", line 248, in _init_talkgadget_1
conversations = data_dict['ds:19'][0][3]
KeyError: 'ds:19'

ds:19 key is not in data_dict (but other keys are there)

Login rejected

There seems to be a problem with the login:

uname@machine:~$ hangups
Email: [email protected]
Password:

Login failed (Login failed for unknown reason)

Can anyone verify this?

Error 503

Is anyone else getting these?

francisco@VoidCaster [15:54:16] [~] 
-> $ hangups
Traceback (most recent call last):
  File "/usr/bin/hangups", line 9, in <module>
    load_entry_point('hangups==0.2.6', 'console_scripts', 'hangups')()
  File "/usr/lib/python3.4/site-packages/hangups/ui/__main__.py", line 699, in main
    }, COL_SCHEMES[args.col_scheme])
  File "/usr/lib/python3.4/site-packages/hangups/ui/__main__.py", line 76, in __init__
    loop.run_until_complete(self._client.connect())
  File "/usr/lib/python3.4/asyncio/base_events.py", line 316, in run_until_complete
    return future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 275, in result
    raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 234, in _step
    result = coro.throw(exc)
  File "/usr/lib/python3.4/site-packages/hangups/client.py", line 121, in connect
    yield from self._listen_future
  File "/usr/lib/python3.4/asyncio/futures.py", line 386, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 287, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 275, in result
    raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 238, in _step
    result = next(coro)
  File "/usr/lib/python3.4/site-packages/hangups/channel.py", line 198, in listen
    yield from self._fetch_channel_sid()
  File "/usr/lib/python3.4/site-packages/hangups/channel.py", line 244, in _fetch_channel_sid
    'ctype': 'hangouts',  # client type
  File "/usr/lib/python3.4/site-packages/hangups/http_utils.py", line 54, in fetch
    .format(res.status, res.reason))
hangups.exceptions.NetworkError: Request return unexpected status: 503: Service Unavailable
Exception ignored in: Exception ignored in: Exception ignored in: %

I've started getting these this afternoon. Anyone else?

Messages can be sent out of order

When sending several messages in quick succession (eg. copying and pasting lines into the message box), the messages may end up in the wrong order.

This is probably happening because hangups tries to send all the messages at the same time, which means each message races the others. hangups should queue the messages before sending them, and/or the UI should send pasted lines as a single message.

Load previous conversations

This is more of a feature request. In hangouts, when a conversation with a given contact is resumed, it is possible to scroll up and progressively load previous conversations with that contact. A similar feature in hangups would be quite useful, as I often need to go back in a conversation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.