comparison 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
comparison
equal deleted inserted replaced
4166:481c51159627 4167:7002b6f16bdf
471 return val; 471 return val;
472 } 472 }
473 473
474 int find_queue_row_by_name(char *name) 474 int find_queue_row_by_name(char *name)
475 { 475 {
476 gchar *temp; 476 GSList *templist;
477 gint i = 0; 477 char *temp;
478 gboolean valid; 478 int i;
479 GtkTreeIter iter; 479
480 480 templist = message_queue;
481 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), &iter); 481
482 while(valid) { 482 for (i = 0; i < GTK_CLIST(clistqueue)->rows; i++) {
483 gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), &iter, 0, &temp, -1); 483 gtk_clist_get_text(GTK_CLIST(clistqueue), i, 0, &temp);
484 if(!strcmp(name, temp)) 484
485 if (!strcmp(name, temp))
485 return i; 486 return i;
486 g_free(temp);
487
488 i++;
489 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(awayqueuestore), &iter);
490 } 487 }
491 488
492 return -1; 489 return -1;
493 } 490 }
494 491
624 /* either we're going to queue it or not. Because of the way awayness currently 621 /* either we're going to queue it or not. Because of the way awayness currently
625 * works, this is fucked up. it's possible for an account to be away without the 622 * works, this is fucked up. it's possible for an account to be away without the
626 * imaway dialog being shown. in fact, it's possible for *all* the accounts to be 623 * imaway dialog being shown. in fact, it's possible for *all* the accounts to be
627 * away without the imaway dialog being shown. so in order for this to be queued 624 * away without the imaway dialog being shown. so in order for this to be queued
628 * properly, we have to make sure that the imaway dialog actually exists, first. */ 625 * properly, we have to make sure that the imaway dialog actually exists, first. */
629 if (!cnv && awayqueue && (away_options & OPT_AWAY_QUEUE)) { 626 if (!cnv && clistqueue && (away_options & OPT_AWAY_QUEUE)) {
630 /* alright, so we're going to queue it. neat, eh? :) so first we create 627 /* alright, so we're going to queue it. neat, eh? :) so first we create
631 * something to store the message, and add it to our queue. Then we update 628 * something to store the message, and add it to our queue. Then we update
632 * the away dialog to indicate that we've queued something. */ 629 * the away dialog to indicate that we've queued something. */
633 struct queued_message *qm; 630 struct queued_message *qm;
634 GtkTreeIter iter; 631 struct buddy *b;
635 gchar path[10]; 632
636
637 qm = g_new0(struct queued_message, 1); 633 qm = g_new0(struct queued_message, 1);
638 g_snprintf(qm->name, sizeof(qm->name), "%s", name); 634 g_snprintf(qm->name, sizeof(qm->name), "%s", name);
639 qm->message = g_memdup(message, len == -1 ? strlen(message) + 1 : len); 635 qm->message = g_memdup(message, len == -1 ? strlen(message) + 1 : len);
640 qm->gc = gc; 636 qm->gc = gc;
641 qm->tm = mtime; 637 qm->tm = mtime;
642 qm->flags = WFLAG_RECV | away; 638 qm->flags = WFLAG_RECV | away;
643 qm->len = len; 639 qm->len = len;
644 message_queue = g_slist_append(message_queue, qm); 640 message_queue = g_slist_append(message_queue, qm);
645 641
646 row = find_queue_row_by_name(qm->name); 642 row = find_queue_row_by_name(qm->name);
643
647 if (row >= 0) { 644 if (row >= 0) {
648 char number[32]; 645 char number[32];
649 int qtotal; 646 int qtotal;
650 647
651 qtotal = find_queue_total_by_name(qm->name); 648 qtotal = find_queue_total_by_name(qm->name);
652 g_snprintf(number, 32, _("(%d messages)"), qtotal); 649 g_snprintf(number, 32, _("(%d messages)"), qtotal);
653 g_snprintf(path, 10, "%d", row); 650 gtk_clist_set_text(GTK_CLIST(clistqueue), row, 1, number);
654 gtk_tree_model_get_iter_from_string(
655 GTK_TREE_MODEL(awayqueuestore), &iter, path);
656 gtk_list_store_set(awayqueuestore, &iter,
657 1, number, -1);
658 } else { 651 } else {
659 gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), 652 gchar *heh[2];
660 &iter); 653
661 gtk_list_store_append(awayqueuestore, &iter); 654 heh[0] = qm->name;
662 gtk_list_store_set(awayqueuestore, &iter, 655 heh[1] = _("(1 message)");
663 0, qm->name, 656 gtk_clist_append(GTK_CLIST(clistqueue), heh);
664 1, _("(1 message)"),
665 -1);
666 } 657 }
667 } else { 658 } else {
668 /* ok, so we're not queuing it. well then, we'll try to handle it normally. 659 /* ok, so we're not queuing it. well then, we'll try to handle it normally.
669 * Some people think that ignoring it is a perfectly acceptible way to handle 660 * Some people think that ignoring it is a perfectly acceptible way to handle
670 * it. i think they're on crack, but hey, that's why it's optional. */ 661 * it. i think they're on crack, but hey, that's why it's optional. */
724 qar->sent_away = t; 715 qar->sent_away = t;
725 716
726 /* apply default fonts and colors */ 717 /* apply default fonts and colors */
727 tmpmsg = stylize(gc->away, MSG_LEN); 718 tmpmsg = stylize(gc->away, MSG_LEN);
728 serv_send_im(gc, name, away_subs(tmpmsg, alias), -1, IM_FLAG_AWAY); 719 serv_send_im(gc, name, away_subs(tmpmsg, alias), -1, IM_FLAG_AWAY);
729 if (!cnv && awayqueue && (away_options & OPT_AWAY_QUEUE)) { 720 if (!cnv && clistqueue && (away_options & OPT_AWAY_QUEUE)) {
730 struct queued_message *qm; 721 struct queued_message *qm;
731 qm = g_new0(struct queued_message, 1); 722 qm = g_new0(struct queued_message, 1);
732 g_snprintf(qm->name, sizeof(qm->name), "%s", name); 723 g_snprintf(qm->name, sizeof(qm->name), "%s", name);
733 qm->message = g_strdup(away_subs(tmpmsg, alias)); 724 qm->message = g_strdup(away_subs(tmpmsg, alias));
734 qm->gc = gc; 725 qm->gc = gc;