comparison src/server.c @ 4412:8067614e49e4

[gaim-migrate @ 4685] Gtk2ification. Thanks, Ari. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 25 Jan 2003 23:00:32 +0000
parents a8249a5250b6
children d9e4eacf6b46
comparison
equal deleted inserted replaced
4411:2ad81729c049 4412:8067614e49e4
490 return val; 490 return val;
491 } 491 }
492 492
493 int find_queue_row_by_name(char *name) 493 int find_queue_row_by_name(char *name)
494 { 494 {
495 GSList *templist; 495 gchar *temp;
496 char *temp; 496 gint i = 0;
497 int i; 497 gboolean valid;
498 498 GtkTreeIter iter;
499 templist = message_queue; 499
500 500 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), &iter);
501 for (i = 0; i < GTK_CLIST(clistqueue)->rows; i++) { 501 while(valid) {
502 gtk_clist_get_text(GTK_CLIST(clistqueue), i, 0, &temp); 502 gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), &iter, 0, &temp, -1);
503 503 if(!strcmp(name, temp))
504 if (!strcmp(name, temp))
505 return i; 504 return i;
505 g_free(temp);
506
507 i++;
508 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(awayqueuestore), &iter);
506 } 509 }
507 510
508 return -1; 511 return -1;
509 } 512 }
510 513
665 * shown. In fact, it's possible for *all* the accounts to be 668 * shown. In fact, it's possible for *all* the accounts to be
666 * away without the imaway dialog being shown. So in order for 669 * away without the imaway dialog being shown. So in order for
667 * this to be queued properly, we have to make sure that the 670 * this to be queued properly, we have to make sure that the
668 * imaway dialog actually exists, first. 671 * imaway dialog actually exists, first.
669 */ 672 */
670 if (!cnv && clistqueue && (away_options & OPT_AWAY_QUEUE)) { 673 if (!cnv && awayqueue && (away_options & OPT_AWAY_QUEUE)) {
671 /* 674 /*
672 * Alright, so we're going to queue it. Neat, eh? :) 675 * Alright, so we're going to queue it. Neat, eh? :)
673 * So first we create something to store the message, and add 676 * So first we create something to store the message, and add
674 * it to our queue. Then we update the away dialog to indicate 677 * it to our queue. Then we update the away dialog to indicate
675 * that we've queued something. 678 * that we've queued something.
676 */ 679 */
677 struct queued_message *qm; 680 struct queued_message *qm;
681 GtkTreeIter iter;
682 gchar path[10];
678 683
679 qm = g_new0(struct queued_message, 1); 684 qm = g_new0(struct queued_message, 1);
680 g_snprintf(qm->name, sizeof(qm->name), "%s", name); 685 g_snprintf(qm->name, sizeof(qm->name), "%s", name);
681 qm->message = g_memdup(message, len == -1 ? strlen(message) + 1 : len); 686 qm->message = g_memdup(message, len == -1 ? strlen(message) + 1 : len);
682 qm->gc = gc; 687 qm->gc = gc;
684 qm->flags = WFLAG_RECV | away; 689 qm->flags = WFLAG_RECV | away;
685 qm->len = len; 690 qm->len = len;
686 message_queue = g_slist_append(message_queue, qm); 691 message_queue = g_slist_append(message_queue, qm);
687 692
688 row = find_queue_row_by_name(qm->name); 693 row = find_queue_row_by_name(qm->name);
689
690 if (row >= 0) { 694 if (row >= 0) {
691 char number[32]; 695 char number[32];
692 int qtotal; 696 int qtotal;
693 697
694 qtotal = find_queue_total_by_name(qm->name); 698 qtotal = find_queue_total_by_name(qm->name);
695 g_snprintf(number, 32, _("(%d messages)"), qtotal); 699 g_snprintf(number, 32, _("(%d messages)"), qtotal);
696 gtk_clist_set_text(GTK_CLIST(clistqueue), row, 1, number); 700 g_snprintf(path, 10, "%d", row);
701 gtk_tree_model_get_iter_from_string(
702 GTK_TREE_MODEL(awayqueuestore), &iter, path);
703 gtk_list_store_set(awayqueuestore, &iter,
704 1, number, -1);
697 } else { 705 } else {
698 gchar *heh[2]; 706 gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore),
699 707 &iter);
700 heh[0] = qm->name; 708 gtk_list_store_append(awayqueuestore, &iter);
701 heh[1] = _("(1 message)"); 709 gtk_list_store_set(awayqueuestore, &iter,
702 gtk_clist_append(GTK_CLIST(clistqueue), heh); 710 0, qm->name,
711 1, _("(1 message)"),
712 -1);
703 } 713 }
704 } else { 714 } else {
705 /* 715 /*
706 * Ok, so we're not queuing it. Well then, we'll try to handle 716 * Ok, so we're not queuing it. Well then, we'll try to handle
707 * it normally. Some people think that ignoring it is a perfectly 717 * it normally. Some people think that ignoring it is a perfectly
773 qar->sent_away = t; 783 qar->sent_away = t;
774 784
775 /* apply default fonts and colors */ 785 /* apply default fonts and colors */
776 tmpmsg = stylize(gc->away, MSG_LEN); 786 tmpmsg = stylize(gc->away, MSG_LEN);
777 serv_send_im(gc, name, away_subs(tmpmsg, alias), -1, IM_FLAG_AWAY); 787 serv_send_im(gc, name, away_subs(tmpmsg, alias), -1, IM_FLAG_AWAY);
778 if (!cnv && clistqueue && (away_options & OPT_AWAY_QUEUE)) { 788 if (!cnv && awayqueue && (away_options & OPT_AWAY_QUEUE)) {
779 struct queued_message *qm; 789 struct queued_message *qm;
780 qm = g_new0(struct queued_message, 1); 790 qm = g_new0(struct queued_message, 1);
781 g_snprintf(qm->name, sizeof(qm->name), "%s", name); 791 g_snprintf(qm->name, sizeof(qm->name), "%s", name);
782 qm->message = g_strdup(away_subs(tmpmsg, alias)); 792 qm->message = g_strdup(away_subs(tmpmsg, alias));
783 qm->gc = gc; 793 qm->gc = gc;