[Adium-devl] Severy Structural AIChat-Issue in Adium
soc at monitzer.com
Thu Jul 19 16:12:31 UTC 2007
I've been researching a big problem in Adium for a while now. Since
this is a rather complicated issue, I'm writing up an email instead
of discussing this on IRC.
Specifically, the problem is described in the following tickets:
Those are actually all caused by the same issue. It starts with
This method creates a new AIChat object using
with a nil identifier. Then, it adds the contacts that should be
invited to the object, and adds an observer for the notification
Chat_DidOpen with this AIChat as the object.
checks if there's an existing chat and creates it using -[AIChat
chatForAccount:], setting up name, identifier (nil in this case),
etc. It is added to the openChats set. Then -[AIAccount openChat:] is
-[CBPurpleAccount openChat:] (note that we move to libpurple-specific
stuff now) calls -[SLPurpleAdapter openChat:onAccount:], which in
turn calls convLookupFromChat().
convLookupFromChat() sets up the necessary information for
lilbpurple, and calls serv_join_chat (this one doesn't return
anything). This is all that has to be done from Adium.
Now, libpurple joins the chat, and calls adiumPurpleConvCreate() on
success. Note that libpurple doesn't call anything in Adium when it
doesn't succeed. Since Adium already created the AIChat object, this
is the cause for bug #1874 (Adium thinks that there's already a
groupchat with that MUC, so it disallows the join).
adiumPurpleConvCreate() calls groupChatLookupFromConv(), which in
turn calls -[CBPurpleAccount chatWithName:identifier:], passing the
PurpleConversation as the identifier (wrapped in an NSValue).
-[CBPurpleAccount chatWithName:identifier:] calls
Since the identifier for our existing AIChat is nil, this method
doesn't find it, and instead creates a new AIChat object, which is
then opened by using -[CBPurpleAccount addChat:] in
After opening the chat, the Chat_DidOpen notification is sent with
the new AIChat object, which doesn't trigger the notification we sent
earlier, since that used the original AIChat object. That's the cause
of bug #2549 and #7048.
This is a problem inherit in the way Adium creates groupchats. In
order to fix this, multiple things will have to be rearranged all
over the place. The underlying issue is that AIChats must not be
created right after trying to join a groupchat, but have to be
This isn't something I'd like to tackle on without your help.
More information about the Adium-devl