diff src/server.c @ 4167:7002b6f16bdf

[gaim-migrate @ 4396] (00:14:20) Robot101: if anyone with CVS would like to choose between the docklet eating messages if you ask it to queue them, or an occasional crash when returning from away with queued messages, I have a patch to revert ari's 'fix' at http://people.debian.org/~robot101/silly-ari.diff (00:15:05) Robot101: Sean and I agreed that keeping the queued messages in a GSList is better, so if ari could seperate the gtk2ification and the fixing of the crash, without breaking the generic queueing stuff, that'd be peachy (00:15:22) Robot101: in the meantime, the docklet saying it has queued messages, and not letting you read them, is pretty damn obnoxious. (00:16:30) LSchiere: i'll do it committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 02 Jan 2003 05:18:16 +0000
parents d3c8d2b40494
children ebfb80bbe1ed
line wrap: on
line diff
--- a/src/server.c	Thu Jan 02 01:18:21 2003 +0000
+++ b/src/server.c	Thu Jan 02 05:18:16 2003 +0000
@@ -473,20 +473,17 @@
 
 int find_queue_row_by_name(char *name)
 {
-	gchar *temp;
-	gint i = 0;
-	gboolean valid;
-	GtkTreeIter iter;
+	GSList *templist;
+	char *temp;
+	int i;
+
+	templist = message_queue;
 
-	valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), &iter);
-	while(valid) {
-		gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), &iter, 0, &temp, -1);
-		if(!strcmp(name, temp))
+	for (i = 0; i < GTK_CLIST(clistqueue)->rows; i++) {
+		gtk_clist_get_text(GTK_CLIST(clistqueue), i, 0, &temp);
+
+		if (!strcmp(name, temp))
 			return i;
-		g_free(temp);
-		
-		i++;
-		valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(awayqueuestore), &iter);
 	}
 
 	return -1;
@@ -626,14 +623,13 @@
 		 * imaway dialog being shown. in fact, it's possible for *all* the accounts to be
 		 * away without the imaway dialog being shown. so in order for this to be queued
 		 * properly, we have to make sure that the imaway dialog actually exists, first. */
-		if (!cnv && awayqueue && (away_options & OPT_AWAY_QUEUE)) {
+		if (!cnv && clistqueue && (away_options & OPT_AWAY_QUEUE)) {
 			/* alright, so we're going to queue it. neat, eh? :) so first we create
 			 * something to store the message, and add it to our queue. Then we update
 			 * the away dialog to indicate that we've queued something. */
 			struct queued_message *qm;
-			GtkTreeIter iter;
-			gchar path[10];
-			
+			struct buddy *b;
+
 			qm = g_new0(struct queued_message, 1);
 				g_snprintf(qm->name, sizeof(qm->name), "%s", name);
 			qm->message = g_memdup(message, len == -1 ? strlen(message) + 1 : len);
@@ -644,25 +640,20 @@
 			message_queue = g_slist_append(message_queue, qm);
 
 			row = find_queue_row_by_name(qm->name);
+
 			if (row >= 0) {
 				char number[32];
 				int qtotal;
 
 				qtotal = find_queue_total_by_name(qm->name);
 				g_snprintf(number, 32, _("(%d messages)"), qtotal);
-				g_snprintf(path, 10, "%d", row);
-				gtk_tree_model_get_iter_from_string(
-								GTK_TREE_MODEL(awayqueuestore), &iter, path);
-				gtk_list_store_set(awayqueuestore, &iter,
-								1, number, -1);
+				gtk_clist_set_text(GTK_CLIST(clistqueue), row, 1, number);
 			} else {
-				gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), 
-								&iter);
-				gtk_list_store_append(awayqueuestore, &iter);
-				gtk_list_store_set(awayqueuestore, &iter,
-								0, qm->name,
-								1, _("(1 message)"),
-								-1);
+				gchar *heh[2];
+
+				heh[0] = qm->name;
+				heh[1] = _("(1 message)");
+				gtk_clist_append(GTK_CLIST(clistqueue), heh);
 			}
 		} else {
 			/* ok, so we're not queuing it. well then, we'll try to handle it normally.
@@ -726,7 +717,7 @@
 		/* apply default fonts and colors */
 		tmpmsg = stylize(gc->away, MSG_LEN);
 		serv_send_im(gc, name, away_subs(tmpmsg, alias), -1, IM_FLAG_AWAY);
-		if (!cnv && awayqueue && (away_options & OPT_AWAY_QUEUE)) {
+		if (!cnv && clistqueue && (away_options & OPT_AWAY_QUEUE)) {
 			struct queued_message *qm;
 			qm = g_new0(struct queued_message, 1);
 			g_snprintf(qm->name, sizeof(qm->name), "%s", name);