Open iNPUTmice opened 10 years ago
This also happened to me. It's kind of tricky to debug spectrum2 with libpurple. I may have some time to take a look into it, but I would really need more hands on this project to keep it alive :D
Hi,
ok is there any specific way I can help you?
I'm really interested in in finding a working solution with whatsapp and spectrum. However I can's asses how complicated this is. It kind of looks like there is some lookup going wrong... Or maybe the original groups are not saved in that lookup table?!
Unfortunately I'm at the moment rather busy in preparing the next release for my own Open Source project so actually digging through code I have never seen before might not be an option for me. Or at least not a good option.
However I might be able to make a small donation if this issue could be resolved. I have 0.125 Bitcoin (~35 Euro) ready to go now. I'm also ready to do any kind of testing / debugging thats necessary.
Hi Daniel, I'll have a look at this pretty soon. I'd like to get rid of all my messaging apps using spectrum and one XMPP client. BTW neat work with your Conversations app. Just tried it. I might submit some patches of my interest. Does it support offline messages, this is, assuming that spectrum2+whatsapp works, should we able to receive messages received while the phone was out of network? I'm really really interested in this.
Thanks man!
Does it support offline messages, this is, assuming that spectrum2+whatsapp works, should we able to receive messages received while the phone was out of network? I'm really really interested in this.
This depends. If no other client is connected (no desktop client) the messages will be put into 'offline storage' on the server and will delivered as soon as the client reconnects.
If there is another client (desktop) connected while you are offline the messages will be delivered to the other client. A reconnecting phone won't receive the message and you won't be able to see the messages until you come home. This can and will be solved though very soon with so called message archive management (MAM) where the server saves your entire chat history and can deliver it to Conversations even if Conversations has been offline for a couple of days.
However Conversations can already 'survive' small network outages in a tunnel for example (up to five minutes) or switches between wifi and mobile. Conversations won't go 'offline' during these five minutes and messages received during that time wont be lost.
How can you survive IP changes and still get the messages back? So I'm cool, I always close desktop clients so I force messages to be received to my cellular. This MAM you talk about, is it somenthing comming to the XMPP protocol? That would be really awesome! Actually I'm not sure whether libpurple handles "true offline" messages. As for now I just simulate that offline messages are received as soon as you reconnect, which is kindof incorrect. There should be a way to flag them as offline. Tnks!
How can you survive IP changes and still get the messages back?
there is an extension to XMPP called stream management that Conversations and a few servers (prosody and ejabberd) support.
This MAM you talk about, is it somenthing comming to the XMPP protocol?
it is already in the xmpp protocol and there is experimental support in prsodoy. And support for Conversations is coming in the next weeks
So what about spectrum MAM support?
if you run spectrum2 in gateway mode (which I would recommend if you want to use multiple clients and one of them being conversations) the actual xmpp server takes care of all that
I'm pretty ignorant on how xmpp works. So with spectrum2 in GW mode when a message is received but no client is connected who.stores the offline message? The xmpp server (facebook, gtalk) or spectrum?
Thanks!
you would have to run your own xmpp server on the same machine as your spectrum2 and use an account on your own xmpp server. you can't use spectrum2 and Facebook / gtalk. but then your xmpp server would store the messages
What's the problem with "emulating" a group conversation for spectrum2? Group chats are working in Pidgin, so I don't really understand what's missing and where. If you could give me a hint I would try to look at it.
I have the same problem with spectrum2
INFO libpurple: whatsapp:Got chat message from 27********5-1********4: This is a message
INFO libpurple: whatsapp:Opening conversation window for 27********5-1********4
INFO libpurple: whatsapp:joining group GroupName
INFO libpurple: whatsapp:group info ID(2********5-1*********4) SUBJECT(TESTGROUP) OWNER(27*********)
INFO backend: Received message body='message' name='GroupName' 2772
INFO libpurple: whatsapp:Received message 1434432177-73 type: 0
INFO libpurple: whatsapp:Received message 1434550738-61 type: 0
INFO libpurple: connection:Connection error on 0x16c27a0 (reason: 0 description: Server closed the connection)
INFO libpurple: account:Disconnecting account 27798135144 (0x16cd9d0)
INFO libpurple: connection:Disconnecting connection 0x16c27a0
INFO libpurple: connection:Destroying connection 0x16c27a0
ERROR backend: g_log purple_connection_get_prpl: assertion 'gc != NULL' failed
ERROR backend: g_log purple_connection_get_prpl: assertion 'gc != NULL' failed
ERROR backend: g_log purple_connection_get_prpl: assertion 'gc != NULL' failed
ERROR backend: g_log purple_connection_get_prpl: assertion 'gc != NULL' failed
ERROR backend: g_log purple_connection_get_prpl: assertion 'gc != NULL' failed
ERROR backend: g_log purple_connection_get_prpl: assertion 'gc != NULL' failed
ERROR backend: g_log purple_connection_get_prpl: assertion 'gc != NULL' failed
It looks like the whatsapp-purple is receiving the message and spectrum2 is having a problem and crashing.
I think I narrowed the problem down. Consider these few lines in spectrum (backends/libpurple/main.cpp:1057)
if (purple_conversation_get_type_wrapped(conv) == PURPLE_CONV_TYPE_IM) {
std::string w = purple_normalize_wrapped(account, who);
size_t pos = w.find("/");
if (pos != std::string::npos)
w.erase((int) pos, w.length() - (int) pos);
np->handleMessage(np->m_accounts[account], w, message_, "", xhtml_, timestamp);
}
else {
LOG4CXX_INFO(logger, "Received message body='" << message_ << "' name='" << purple_conversation_get_name_wrapped(conv) << "' " << who);
np->handleMessage(np->m_accounts[account], purple_conversation_get_name_wrapped(conv), message_, who, xhtml_, timestamp);
}
Note: the second argument to np->handleMessage
is the username from which the
message was received.
When the conversation is of type IM then spectrum figures out the username (w
)
and the message will go through. However, in the case of a groupchat, the type
of the conversation will be CHAT. Thus
purple_conversation_get_name_wrapped(conv)
is sent as the username. I think
that this is the part that is wrong.
purple_conversation_get_name_wrapped(conv)
evaluates to the topic of the
whatsapp group. I highly doubt that this is the name that whatsapp uses to
uniquely identify chat groups (groupid).
I noticed that whatsapp-purple uses an identifier of the form
[creators-cellphone-number]-[random-number]
to identify groups. Is this what
whatsapp network uses or is it just an internal representation?
If indeed that is whatsapp's version of the groupid, I cannot find a way to retrieve it from the conversation.
The solution to this problem whould be to set the conversations name in whatsapp-purple to the groupid.
I have made some progress.
By setting the PurpleConversation name to the gid instead of the subject (see dc85aa9216bead65938337a8545a448fa2334dd3), I am able to send messages into a group, but I cannot receive them properly. The problems are
Messages from the group will not be received unless you first add the gid to your roster and send a message to it. I think this needs to be done every session.
I am not sure where the problem lies. The XML console in Gajim shows that no messages are received until you first send a message. Spectrum appears to receiving the messages and passing it off just fine. Since I'm running spectrum in transport mode, the message could be lost at ejabberd or even at jabber.zone
When you do receive a message, the message appears as if it was sent directly by the person and not through the chat group.
I'm not sure why this is happening. I checked the char *who
in spectrum is
definitely the gid. I cannot see why the from jid of the message is the
user's jid and not the group's jid. It might be that spectrum is
constructing the jid from the char *nickname
field.
I'm not sure what to do further. I'm not familiar with libpurple, spectrum, the whatsapp protocol or the xmpp protocol. I need some help to fix this completely.
Hey thanks for the work you did. I think that spectrum is very xmpp centric, therefore you need to "join" to a group before being able to send/receive. Wapurple is a bit hacky and works by creating groups itself and thus faking the group join. Ill take a look if I have time next week.
:+1: looking forward for working groupchats + spectrum
I moved @moyamo s groupchat attemp for spectrum to current state (https://github.com/NeoBelerophon/whatsapp-purple/commit/76ce8ca95c6d93e4464c3a3c4764e863a781aa70) What do I need to do to "join" the group and be able to write messages?
@NeoBelerophon I was only fiddling around with those commits. This issue has not been resolved yet. I have been trying to get transwhat to work. Although, groupchats is only partially implemented.
The problem is XMPP Multi-User Chat (MUC) is very different from whatsapp groupchats. MUCs are similar to IRC: A server has a list of MUCs which users can join and leave at will, and users can create their own private MUCs if they like.
The problem is the joining and leaving. With whatsapp you can't join a group. You have to be invited. This means that you also don't want to leave a group because you have to be re-invited to join.
XMPP clients treat MUCs as if you can leave and join them at will, often leaving a MUC when you close the chat window and optionally reopening them at startup. Also XMPP servers require that you first join a MUC before messages will be received.
Currently with transwhat, I have a branch (which I haven't pushed yet), which notifies you which groupchats you belong to and politely asks you to join them or risk dropping messages. I don't think this is an adequate solution and I need some more time to fix things up.
@moyamo where you able to run transwhat with spectrum in gateway mode or just the standalone mode? I also played a bit around with it.
I had the idea to have a bots that joins a muc to keep it open on the server and send messages to it and user can join the room as desired
I have transwhat running in gateway mode. Checkout https://github.com/moyamo/transwhat/tree/groupchat-fix. You should only have to join every groupchat at startup. Most XMPP clients have a feature for this.
:+1: transwhat works like a charm
Hi,
first off all sorry for this off topic question but I don't know where else to ask and I know a lof of you guys are using this libpurple plugin with spectrum2.
I've been using whatsapp-purple with spectrum2 for a while now and it's working great for single chats. (Thank you for your work) However I can't get group chats to work
I have log entries that confirm that the groups are found
Do I have to join the some conference before with my client? Do I need to set up a domain name for that? If someone could point me in the right direction that would be vastly appreciated.
BTW I see incoming group messages as well
However they don't seem to get redirected to to my jabber client.