int yahoo_c_send(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags) { GaimConversation *c; int ret; struct yahoo_data *yd; yd = (struct yahoo_data *) gc->proto_data; if (!yd) return -1; c = gaim_find_chat(gc, id); if (!c) return -1; if (id != YAHOO_CHAT_ID) { ret = yahoo_conf_send(gc, gaim_connection_get_display_name(gc), gaim_conversation_get_name(c), gaim_conv_chat_get_users(GAIM_CONV_CHAT(c)), what); } else { ret = yahoo_chat_send(gc, gaim_connection_get_display_name(gc), gaim_conversation_get_name(c), what, flags); if (!ret) serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(c)), gaim_connection_get_display_name(gc), 0, what, time(NULL)); } return ret; }
static void conversation_switched_cb(GaimConversation *old_conv, GaimConversation *new_conv, void *data) { gaim_debug_misc("signals test", "conversation-switched (%s, %s)\n", gaim_conversation_get_name(old_conv), gaim_conversation_get_name(new_conv)); }
static void gaym_chat_leave(GaimConnection * gc, int id) { struct gaym_conn *gaym = gc->proto_data; GaimConversation *convo = gaim_find_chat(gc, id); const char *args[2]; if (!convo) return; args[0] = gaim_conversation_get_name(convo); args[1] = NULL; gaym_cmd_part(gaym, "part", gaim_conversation_get_name(convo), args); serv_got_chat_left(gc, id); }
static void irc_chat_invite(GaimConnection *gc, int id, const char *message, const char *name) { struct irc_conn *irc = gc->proto_data; GaimConversation *convo = gaim_find_chat(gc, id); const char *args[2]; if (!convo) { gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got chat invite request for bogus chat\n"); return; } args[0] = name; args[1] = gaim_conversation_get_name(convo); irc_cmd_invite(irc, "invite", gaim_conversation_get_name(convo), args); }
static void chat_buddy_joined_cb(GaimConversation *conv, const char *user, GaimConvChatBuddyFlags flags, void *data) { gaim_debug_misc("signals test", "chat-buddy-joined (%s, %s, %d)\n", gaim_conversation_get_name(conv), user, flags); }
void yahoo_process_chat_exit(GaimConnection *gc, struct yahoo_packet *pkt) { char *who = NULL; char *room = NULL; GSList *l; struct yahoo_data *yd; yd = gc->proto_data; for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; if (pair->key == 104) room = yahoo_string_decode(gc, pair->value, TRUE); if (pair->key == 109) who = pair->value; } if (who && room) { GaimConversation *c = gaim_find_chat(gc, YAHOO_CHAT_ID); if (c && !gaim_utf8_strcasecmp(gaim_conversation_get_name(c), room)) gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c), who, NULL); } if (room) g_free(room); }
void yahoo_c_invite(GaimConnection *gc, int id, const char *msg, const char *name) { GaimConversation *c; c = gaim_find_chat(gc, id); if (!c || !c->name) return; if (id != YAHOO_CHAT_ID) { yahoo_conf_invite(gc, c, gaim_connection_get_display_name(gc), name, gaim_conversation_get_name(c), msg); } else { yahoo_chat_invite(gc, gaim_connection_get_display_name(gc), name, gaim_conversation_get_name(c), msg); } }
static void chat_buddy_flags_cb(GaimConversation *conv, const char *user, GaimConvChatBuddyFlags oldflags, GaimConvChatBuddyFlags newflags, void *data) { gaim_debug_misc("signals test", "chat-buddy-flags (%s, %s, %d, %d)\n", gaim_conversation_get_name(conv), user, oldflags, newflags); }
static void chat_buddy_left_cb(GaimConversation *conv, const char *user, const char *reason, void *data) { gaim_debug_misc("signals test", "chat-buddy-left (%s, %s, %s)\n", gaim_conversation_get_name(conv), user, reason); }
static void chat_invited_user_cb(GaimConversation *conv, const char *name, const char *reason, void *data) { gaim_debug_misc("signals test", "chat-invited-user (%s, %s, %s)\n", gaim_conversation_get_name(conv), name, reason); }
void GaimChatMngr::CreateConversationCbk(GaimConversation *conv, bool userCreated) { GaimAccount *gAccount = gaim_conversation_get_account(conv); GaimConversationType chatType = gaim_conversation_get_type(conv); const char *gPrclId = gaim_account_get_protocol_id(gAccount); IMAccount *account = _accountMngr->FindIMAccount(gaim_account_get_username(gAccount), GaimIMPrcl::GetEnumIMProtocol(gPrclId)); GaimIMChat *mChat = FindIMChat(*account); mConvInfo_t *mConv; if (chatType == GAIM_CONV_TYPE_IM) { IMChatSession *chatSession = NULL; // Check if it's a jabber contact, and remove his ressource std::string contactId = cleanContactId(std::string(gaim_conversation_get_name(conv)), GaimIMPrcl::GetEnumIMProtocol(gPrclId)); IMContact imContact(*account, contactId); mConv = mChat->CreateChatSession(userCreated, *mChat); mConv->gaim_conv_session = conv; conv->ui_data = mConv; chatSession = (IMChatSession *) mConv->conv_session; ((IMContactSet &) chatSession->getIMContactSet()).insert(imContact); mChat->newIMChatSessionCreatedEvent(*mChat, *chatSession); mChat->contactAddedEvent(*mChat, *chatSession, imContact); } else if (chatType == GAIM_CONV_TYPE_CHAT) { int id = GetGaimConversationId(gaim_conversation_get_name(conv)); if ((mConv = mChat->FindChatStructById(id)) == NULL) { mConv = mChat->CreateChatSession(userCreated, *mChat); } if (mConv->gaim_conv_session) gaim_conversation_destroy((GaimConversation *)mConv->gaim_conv_session); mConv->gaim_conv_session = conv; conv->ui_data = mConv; } }
static void chat_topic_changed_cb(GaimConversation *conv, const char *who, const char *topic, void *data) { gaim_debug_misc("signals test", "chat-topic-changed (%s topic changed to: \"%s\" by %s)\n", gaim_conversation_get_name(conv), topic, (who) ? who : "unknown"); }
static gboolean chat_buddy_joining_cb(GaimConversation *conv, const char *user, GaimConvChatBuddyFlags flags, void *data) { gaim_debug_misc("signals test", "chat-buddy-joining (%s, %s, %d)\n", gaim_conversation_get_name(conv), user, flags); return FALSE; }
static gboolean chat_buddy_leaving_cb(GaimConversation *conv, const char *user, const char *reason, void *data) { gaim_debug_misc("signals test", "chat-buddy-leaving (%s, %s, %s)\n", gaim_conversation_get_name(conv), user, reason); return FALSE; }
static void received_chat_msg_cb(GaimAccount *account, char *sender, char *buffer, GaimConversation *chat, void *data) { gaim_debug_misc("signals test", "received-chat-msg (%s, %s, %s, %s)\n", gaim_account_get_username(account), sender, buffer, gaim_conversation_get_name(chat)); }
static gboolean writing_chat_msg_cb(GaimAccount *account, GaimConversation *conv, char **buffer, void *data) { gaim_debug_misc("signals test", "writing-chat-msg (%s, %s)\n", gaim_conversation_get_name(conv), *buffer); return FALSE; }
static gboolean receiving_chat_msg_cb(GaimAccount *account, char **sender, char **buffer, GaimConversation *chat, void *data) { gaim_debug_misc("signals test", "receiving-chat-msg (%s, %s, %s, %s)\n", gaim_account_get_username(account), *sender, *buffer, gaim_conversation_get_name(chat)); return FALSE; }
void yahoo_c_leave(GaimConnection *gc, int id) { struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; GaimConversation *c; if (!yd) return; c = gaim_find_chat(gc, id); if (!c) return; if (id != YAHOO_CHAT_ID) { yahoo_conf_leave(yd, gaim_conversation_get_name(c), gaim_connection_get_display_name(gc), gaim_conv_chat_get_users(GAIM_CONV_CHAT(c))); yd->confs = g_slist_remove(yd->confs, c); } else { yahoo_chat_leave(gc, gaim_conversation_get_name(c), gaim_connection_get_display_name(gc), TRUE); } serv_got_chat_left(gc, id); }
static GaimConversation *yahoo_find_conference(GaimConnection *gc, const char *name) { struct yahoo_data *yd; GSList *l; yd = gc->proto_data; for (l = yd->confs; l; l = l->next) { GaimConversation *c = l->data; if (!gaim_utf8_strcasecmp(gaim_conversation_get_name(c), name)) return c; } return NULL; }
static void buddy_typing_cb(GaimConversation *conv, void *data) { GaimAccount *account = gaim_conversation_get_account(conv); const char *name = gaim_conversation_get_name(conv); if (gaim_find_buddy(account, name) != NULL) { GaimPounceEvent event; event = (gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv)) == GAIM_TYPING ? GAIM_POUNCE_TYPING : GAIM_POUNCE_TYPING_STOPPED); gaim_pounce_execute(account, name, event); } }
static void irc_chat_set_topic(GaimConnection *gc, int id, const char *topic) { char *buf; const char *name = NULL; struct irc_conn *irc; irc = gc->proto_data; name = gaim_conversation_get_name(gaim_find_chat(gc, id)); if (name == NULL) return; buf = irc_format(irc, "vt:", "TOPIC", name, topic); irc_send(irc, buf); g_free(buf); }
GaimConversation * jabber_find_unnormalized_conv(const char *name, GaimAccount *account) { GaimConversation *c = NULL; GList *cnv; g_return_val_if_fail(name != NULL, NULL); for(cnv = gaim_get_conversations(); cnv; cnv = cnv->next) { c = (GaimConversation*)cnv->data; if(gaim_conversation_get_type(c) == GAIM_CONV_TYPE_IM && !gaim_utf8_strcasecmp(name, gaim_conversation_get_name(c)) && account == gaim_conversation_get_account(c)) return c; } return NULL; }
void GaimChatMngr::UpdateBuddyTyping(GaimConversation *conv, GaimTypingState state) { IMChat::TypingState mState; mConvInfo_t *mConv = (mConvInfo_t *)conv->ui_data; GaimIMChat *mIMChat = FindIMChatByGaimConv(conv); if (!mIMChat) return; switch (state) { case GAIM_TYPING: mState = IMChat::TypingStateTyping; break; case GAIM_TYPED: mState = IMChat::TypingStateStopTyping; break; default: mState = IMChat::TypingStateNotTyping; break; } // Get contact id. If it's a jabber contact, remove its ressource. const char *name = gaim_conversation_get_name(conv); GaimAccount *gAccount = gaim_conversation_get_account(conv); const char *gPrclId = gaim_account_get_protocol_id(gAccount); std::string contactId = cleanContactId(name, GaimIMPrcl::GetEnumIMProtocol(gPrclId)); mIMChat->typingStateChangedEvent(*mIMChat, *((IMChatSession *)(mConv->conv_session)), contactId, mState); }
static void deleting_conversation_cb(GaimConversation *conv, void *data) { gaim_debug_misc("signals test", "deleting-conversation (%s)\n", gaim_conversation_get_name(conv)); }
static void conversation_created_cb(GaimConversation *conv, void *data) { gaim_debug_misc("signals test", "conversation-created (%s)\n", gaim_conversation_get_name(conv)); }
static void chat_left_cb(GaimConversation *conv, void *data) { gaim_debug_misc("signals test", "chat-left (%s)\n", gaim_conversation_get_name(conv)); }
static void buddy_typing_cb(GaimConversation *conv, void *data) { gaim_debug_misc("signals test", "buddy-typing (%s)\n", gaim_conversation_get_name(conv)); }
static void wrote_chat_msg_cb(GaimAccount *account, GaimConversation *conv, const char *buffer, void *data) { gaim_debug_misc("signals test", "wrote-chat-msg (%s, %s)\n", gaim_conversation_get_name(conv), buffer); }
static void displayed_im_msg_cb(GaimAccount *account, GaimConversation *conv, const char *buffer, void *data) { gaim_debug_misc("signals test", "displayed-im-msg (%s, %s)\n", gaim_conversation_get_name(conv), buffer); }