static void dequeue_message(GtkTreeIter *iter) { gchar *name; GSList *templist; GaimConversation *cnv; gboolean orig_while_away; orig_while_away = gaim_prefs_get_bool("/core/sound/while_away"); if (orig_while_away) gaim_prefs_set_bool("/core/sound/while_away", FALSE); gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), iter, 0, &name, -1); gaim_debug(GAIM_DEBUG_INFO, "away", "Dequeueing messages from %s.\n", name); templist = message_queue; while (templist) { struct queued_message *qm = templist->data; if (templist->data) { if (!gaim_utf8_strcasecmp(qm->name, name)) { GaimAccount *account = NULL; if (g_list_index(gaim_accounts_get_all(), qm->account) >= 0) account = qm->account; cnv = gaim_find_conversation_with_account(name, account); if (!cnv) cnv = gaim_conversation_new(GAIM_CONV_IM, account, qm->name); else gaim_conversation_set_account(cnv, account); gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, qm->message, qm->flags, qm->tm); g_free(qm->message); g_free(qm); templist = message_queue = g_slist_remove(message_queue, qm); } else { templist = templist->next; } } } g_free(name); /* In GTK 2.2, _store_remove actually returns whether iter is valid or not * after the remove, but in GTK 2.0 it is a void function. */ gtk_list_store_remove(awayqueuestore, iter); if (orig_while_away) gaim_prefs_set_bool("/core/sound/while_away", orig_while_away); }
void received_im_msg_cb(GaimAccount *account, char *sender, char *message, GaimConversation *conv, int flags) { GaimConversationUiOps *ops = &chat_wg_ops; if (conv != NULL) return; ops->create_conversation = C_CreateIncomingConversationCbk; gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender); ops->create_conversation = C_CreateConversationCbk; }
static GaimConversation * msn_switchboard_get_conv(MsnSwitchBoard *swboard) { GaimAccount *account; g_return_val_if_fail(swboard != NULL, NULL); if (swboard->conv != NULL) return swboard->conv; gaim_debug_error("msn", "Switchboard with unassigned conversation\n"); account = swboard->session->account; return (swboard->conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, swboard->im_user)); }
void purge_away_queue(GSList **queue) { GSList *q = *queue; struct queued_message *qm; GaimConversation *cnv; GaimAccount *account; gboolean orig_while_away; orig_while_away = gaim_prefs_get_bool("/core/sound/while_away"); if (orig_while_away) gaim_prefs_set_bool("/core/sound/while_away", FALSE); while (q) { qm = q->data; account = NULL; if (g_list_index(gaim_accounts_get_all(), qm->account) >= 0) account = qm->account; cnv = gaim_find_conversation_with_account(qm->name, account); if (!cnv) cnv = gaim_conversation_new(GAIM_CONV_IM, account, qm->name); else gaim_conversation_set_account(cnv, account); gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, qm->message, qm->flags, qm->tm); g_free(qm->message); g_free(qm); q->data = NULL; q = q->next; } g_slist_free(*queue); *queue = NULL; if (orig_while_away) gaim_prefs_set_bool("/core/sound/while_away", orig_while_away); }
/** * Free any ODC related data and print a message to the conversation * window based on conn->disconnect_reason. */ void peer_odc_close(PeerConnection *conn) { gchar *tmp; if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) tmp = g_strdup(_("The remote user has closed the connection.")); else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED) tmp = g_strdup(_("The remote user has declined your request.")); else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) tmp = g_strdup_printf(_("Lost connection with the remote user:<br>%s"), conn->error_message); else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) tmp = g_strdup(_("Received invalid data on connection with remote user.")); else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) tmp = g_strdup(_("Could not establish a connection with the remote user.")); else /* * We shouldn't print a message for some disconnect_reasons. * Like OSCAR_DISCONNECT_LOCAL_CLOSED. */ tmp = NULL; if (tmp != NULL) { GaimAccount *account; GaimConversation *conv; account = gaim_connection_get_account(conn->od->gc); conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, conn->sn); gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); g_free(tmp); } if (conn->frame != NULL) { OdcFrame *frame; frame = conn->frame; g_free(frame->payload.data); g_free(frame); } }