Changeset a3019499 for protocols


Ignore:
Timestamp:
2015-11-26T02:14:34Z (4 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
1ec454c
Parents:
42a418e
Message:

purple: fix /join #channel, which joined a different channel

When joining named channels, purple_chat_join() returned NULL instead of
a struct groupchat, which was actually created in the conversation
created callback (prplcb_conv_new()).

If the name of this channel turned out to be different to the joined
one, this meant having one empty window in the irc client, and another
one for the other channel.

The fix is to return a mostly-empty struct groupchat immediately, and
pick it up later when the PurpleConversation is created using
bee_chat_by_title(). If that fails, fall back to creating a new one.

This bug also meant there was no proper way to report a join failure.
Future commits will address that, this one just makes that easier.

Thanks to Etan Reisner (deryni) for enlightening me while i was trying
to figure out how to fix this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    r42a418e ra3019499  
    718718        serv_join_chat(purple_account_get_connection(pd->account), chat_hash);
    719719
    720         return NULL;
     720        return imcb_chat_new(ic, room);
    721721}
    722722
     
    902902                struct groupchat *gc;
    903903
    904                 gc = imcb_chat_new(ic, conv->name);
    905                 if (conv->title != NULL) {
    906                         imcb_chat_name_hint(gc, conv->title);
     904                gc = bee_chat_by_title(ic->bee, ic, conv->name);
     905
     906                if (!gc) {
     907                        gc = imcb_chat_new(ic, conv->name);
     908                        if (conv->title != NULL) {
     909                                imcb_chat_name_hint(gc, conv->title);
     910                        }
     911                }
     912
     913                /* don't set the topic if it's just the name */
     914                if (conv->title != NULL && strcmp(conv->name, conv->title) != 0) {
    907915                        imcb_chat_topic(gc, NULL, conv->title, 0);
    908916                }
Note: See TracChangeset for help on using the changeset viewer.