static void ggp_chat_left(ggp_chat_local_info *chat, uin_t uin) { uin_t me; int idx = ggp_chat_participant_find(chat, uin); if (idx < 0) { purple_debug_warning("gg", "ggp_chat_joined: " "user %u isn't present in chat %" G_GUINT64_FORMAT "\n", uin, chat->id); return; } chat->participants[idx] = chat->participants[chat->participants_count - 1]; chat->participants_count--; chat->participants = g_realloc(chat->participants, sizeof(uin) * chat->participants_count); if (chat->conv == NULL) return; me = ggp_str_to_uin(purple_account_get_username( purple_connection_get_account(chat->gc))); if (me == uin) { purple_conversation_write_system_message( PURPLE_CONVERSATION(chat->conv), _("You have left the chat"), 0); purple_serv_got_chat_left(chat->gc, chat->local_id); chat->conv = NULL; chat->left = TRUE; } purple_chat_conversation_remove_user(chat->conv, ggp_uin_to_str(uin), NULL); }
void yahoo_process_conference_logoff(PurpleConnection *gc, struct yahoo_packet *pkt) { GSList *l; char *room = NULL; char *who = NULL; PurpleChatConversation *c; for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; switch (pair->key) { case 57: g_free(room); room = yahoo_string_decode(gc, pair->value, FALSE); break; case 56: if (g_utf8_validate(pair->value, -1, NULL)) { who = pair->value; } else { purple_debug_warning("yahoo", "yahoo_process_conference_logoff " "got non-UTF-8 string for key %d\n", pair->key); } break; } } if (who && room) { c = yahoo_find_conference(gc, room); if (c) purple_chat_conversation_remove_user(c, who, NULL); g_free(room); } }
void yahoo_process_chat_exit(PurpleConnection *gc, struct yahoo_packet *pkt) { char *who = NULL; char *room = NULL; GSList *l; for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; if (pair->key == 104) { g_free(room); room = yahoo_string_decode(gc, pair->value, TRUE); } else if (pair->key == 109) { if (g_utf8_validate(pair->value, -1, NULL)) { who = pair->value; } else { purple_debug_warning("yahoo", "yahoo_process_chat_exit " "got non-UTF-8 string for key %d\n", pair->key); } } } if (who && room) { PurpleChatConversation *c = purple_conversations_find_chat(gc, YAHOO_CHAT_ID); if (c && !purple_utf8_strcasecmp(purple_conversation_get_name( PURPLE_CONVERSATION(c)), room)) purple_chat_conversation_remove_user(c, who, NULL); } g_free(room); }
static void left_chat_room(PurpleChatConversation *from, PurpleChatConversation *to, int id, const char *room, gpointer userdata) { if (from != to) { /* tell their chat window that we left */ purple_debug_info("nullprpl", "%s sees that %s left chat room %s\n", purple_chat_conversation_get_nick(to), purple_chat_conversation_get_nick(from), room); purple_chat_conversation_remove_user(to, purple_chat_conversation_get_nick(from), NULL); /* user-provided message, IRC style */ } }
static void ycht_process_chatpart(YchtConn *ycht, YchtPkt *pkt) { char *room, *who; room = g_list_nth_data(pkt->data, 0); who = g_list_nth_data(pkt->data, 1); if (who && room) { PurpleChatConversation *c = purple_conversations_find_chat(ycht->gc, YAHOO_CHAT_ID); if (c && !purple_utf8_strcasecmp(purple_conversation_get_name(PURPLE_CONVERSATION(c)), room)) purple_chat_conversation_remove_user(c, who, NULL); } }