diff options
author | jgeboski <jgeboski@gmail.com> | 2015-01-31 02:59:43 -0500 |
---|---|---|
committer | jgeboski <jgeboski@gmail.com> | 2015-01-31 03:00:28 -0500 |
commit | 97f5a33c90cd22c4a03d3dda61e09be9b67091d9 (patch) | |
tree | 9231c19553768d97c05510333f170b9de8b0b08a | |
parent | 4dd365409a760cc76ce189075ee0dac5d0fb549a (diff) | |
download | bitlbee-facebook-97f5a33c90cd22c4a03d3dda61e09be9b67091d9.tar.gz bitlbee-facebook-97f5a33c90cd22c4a03d3dda61e09be9b67091d9.tar.bz2 bitlbee-facebook-97f5a33c90cd22c4a03d3dda61e09be9b67091d9.tar.xz |
facebook: default to chat_type of room for persistence
As of now, group chat channels do not persist after they are left. This
is due in part to the channel not being of chat_type room. Furthermore,
the account and room identifiers are not set on the channel.
This issue becomes apparent when the plugin disconnects from the remote
services for whatever reason, and the channel is not setup again.
This issue was introduced in 06956d1.
-rw-r--r-- | facebook/facebook.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/facebook/facebook.c b/facebook/facebook.c index 3563653..d607c8f 100644 --- a/facebook/facebook.c +++ b/facebook/facebook.c @@ -415,6 +415,7 @@ struct groupchat *fb_data_groupchat_new(struct im_connection *ic, { fb_data_t *fata = ic->proto_data; struct groupchat *gc; + irc_channel_t *ch; gchar stid[FB_ID_STRMAX]; FB_ID_TO_STR(tid, stid); @@ -422,15 +423,32 @@ struct groupchat *fb_data_groupchat_new(struct im_connection *ic, if (bee_chat_by_title(ic->bee, ic, stid) != NULL) return NULL; - gc = imcb_chat_new(ic, stid); - fata->gcs = g_slist_prepend(fata->gcs, gc); - if (name != NULL) { if (strchr(CTYPES, name[0]) != NULL) name++; + + /* Let the hackery being... */ + gc = imcb_chat_new(ic, stid); imcb_chat_name_hint(gc, name); + + ch = gc->ui_data; + ch->flags |= IRC_CHANNEL_CHAT_PICKME; + + /* Setup the channel as a room */ + set_setstr(&ch->set, "type", "chat"); + set_setstr(&ch->set, "chat_type", "room"); + set_setstr(&ch->set, "account", ic->acc->tag); + set_setstr(&ch->set, "room", stid); + + /* Free and recreate with new channel settings */ + imcb_chat_free(gc); } + gc = imcb_chat_new(ic, stid); + ch = gc->ui_data; + fata->gcs = g_slist_prepend(fata->gcs, gc); + + ch->flags &= ~IRC_CHANNEL_CHAT_PICKME; imcb_chat_add_buddy(gc, ic->acc->user); fb_api_thread_info(fata->api, tid); @@ -712,7 +730,6 @@ struct groupchat *fb_chat_join(struct im_connection *ic, const char *room, return NULL; } - fb_api_thread_info(fata->api, tid); return gc; } |