void prplcb_conv_new(PurpleConversation *conv) { if (conv->type == PURPLE_CONV_TYPE_CHAT) { struct im_connection *ic = purple_ic_by_pa(conv->account); struct groupchat *gc; gc = bee_chat_by_title(ic->bee, ic, conv->name); if (!gc) { gc = imcb_chat_new(ic, conv->name); if (conv->title != NULL) { imcb_chat_name_hint(gc, conv->title); } } /* don't set the topic if it's just the name */ if (conv->title != NULL && strcmp(conv->name, conv->title) != 0) { imcb_chat_topic(gc, NULL, conv->title, 0); } conv->ui_data = gc; gc->data = conv; /* libpurple brokenness: Whatever. Show that we join right away, there's no clear "This is you!" signaling in _add_users so don't even try. */ imcb_chat_add_buddy(gc, gc->ic->acc->user); } }
struct groupchat *twitter_groupchat_init(struct im_connection *ic) { char *name_hint; struct groupchat *gc; struct twitter_data *td = ic->proto_data; GSList *l; if (td->timeline_gc) return td->timeline_gc; td->timeline_gc = gc = imcb_chat_new(ic, "twitter/timeline"); name_hint = g_strdup_printf("%s_%s", td->prefix, ic->acc->user); imcb_chat_name_hint(gc, name_hint); g_free(name_hint); for (l = ic->bee->users; l; l = l->next) { bee_user_t *bu = l->data; if (bu->ic == ic) imcb_chat_add_buddy(gc, bu->handle); } imcb_chat_add_buddy(gc, ic->acc->user); return gc; }