Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WhatsApp protocol support in Xabber #248

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

davidgfnet
Copy link

Hello Александр!

Here it goes. Let me explain what I did to add the protocol:

  • I modified UI to add the option at create account. There's a bug which adds an empty row in the protocol list (dunno why!)
  • I modified the basic connection files to remove XMPPConnection class to Connection. This allows us to abstract the connection type (so we have WA and XMPP). I had to modify some files but the change is pretty straightforward
  • I added the WA protocol class (which are a port of libpurple implementation)
  • I created WAConnection which is the WA counterpart for XMPPConnection. It manages the socket by itself (the proxied connection is not properly handled, modifications needed here) using two threads instead the PacketWriter/Reader classes.
  • Added the WAContacts class, which creates a SQLite table to store WA contacts (cause they don't get stored in the server!). Here I'd need you to review the DB stuff to add migration functions and all that stuff. Maybe we could just do phone contact integration and allow the user to import all the contacts present in the phone contact list.

As final notes. Everything is done by emulating XMPP protocol. When I want Xabber to update the UI I just create some XMPP Packet and send it to the packet listeners. It works great for chats, conferences, vcards...

If you need any extra clarification feel free to ask (you already have my email)

David

davidgfnet and others added 30 commits September 14, 2013 13:37
…tsApp protocol appears as a valid protocol with valid options.
Modified XMPP connection wrapping so we can implement a WhatsappConnection class under the Connection object.
Need to work with Roster class to properly handle all the functionality.
It seems that the packet parsing is not working properly :( Need to fix those errors
…send the auth packets.

Need to add disconnect/auth failed callbacks to notify UI in case of wrong auth.
Also need to signal the UI when the auth has finished and we are connected.
When auth fails it tries to reconnect (maybe I should fix this behavior).
When auth is OK the UI does not get notified, which I don't know why.
Adding presence sending at startup.
Adding ping/pong keepalive, seems that it is NOT working :(
Now the work must focus on adding contacts and sending/receiving messages properly.
Contacts are not retained across sessions and connection drops frequently.
Receiving messages does not work yet :(
Now it's possible to send and receive messages using whatsapp.
The stream keeps disconnecting though (probably due to not answering to some packets).
Contact status (available / away) shown in the contact list.

Next steps should be: Typing status + Permanently saving contacts.
Typing has issues. Fixed a bug with presence subscription.
Fixed a bug with the ACKing of received messages (same fix as in libpurple's whatsapp).
Added Roster simulated reception, need to add something to add the contacts to the account.
Fixed some other bugs (still some bugs in the queue...)

I'd consider this a beta version of the App.
Also fixed a small bug with user status.
Now it's possible to know the sending time of a message when you receive it after being offline.
Available and Chat statuses map to "online" whatsapp status, the rest map to "unavailable".
Temporary disabled status message pushing due to some bug causing stream-not-well-formed messages.

Need to add "nickname" option in WhatsApp account settings so we can send our name to show in messages.
That is the name that will appear in the group chat.
Not working due to encryption issues (probably). Seems that the RC4 decoder or the key derivation is not working as it should.
So, this is WIP!
@n8fr8
Copy link

n8fr8 commented Feb 23, 2014

Just discovered this amazing work... is there an existing WhatsApp java library or specification you based this on? Could we extract this out for other apps to use?

@davidgfnet
Copy link
Author

Notice that the current status is not working. WA changed the protocol version and the updated version is not ready yet (I guess it's a small silly bug). I'm planning to port it to other apps :)
Check: https://github.com/davidgfnet/xabber-android
It is based on the libpurple implementation: https://github.com/davidgfnet/whatsapp-purple

@n8fr8
Copy link

n8fr8 commented Feb 24, 2014

On 02/23/2014 06:00 AM, David G. F. wrote:

It is based on the libpurple implementation: https://github.com/davidgfnet/whatsapp-purple

Which was just taken down due to a DMCA request from WhatsApp. Grrr.

@ransika
Copy link

ransika commented Aug 6, 2014

Hi, we got the project to run through eclipse and so far we were able to get connected and receive the messages. But when a message is sent, it's not coming up on devices for example, on an iPhone with whatsapp installed. But the iPhone app sends the delivery acknowledgment and the app you developed is receiving that as well.

Is this a known issue?

Thanks and looking forward to hear from you soon.

Regards,

@andrewnenakhov andrewnenakhov modified the milestone: 0.9.31 Jan 30, 2015
@obama
Copy link

obama commented May 9, 2015

+1

@TurkeyMan
Copy link

WhatsApp uses Axolotl these days (for security), but I can't see any reference to that here... users of this client would silently force their conversations partners back into plaintext mode (via automatic fallback for backward compatibility with old client versions).
I don't think it's right to merge software where the user silently undermines other unconsenting users privacy. This would be a deliberate violation of users privacy and security rights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants