| 426 if (prpl_info && prpl_info->set_buddy_icon) |
426 if (prpl_info && prpl_info->set_buddy_icon) |
| 427 prpl_info->set_buddy_icon(gc, filename); |
427 prpl_info->set_buddy_icon(gc, filename); |
| 428 |
428 |
| 429 } |
429 } |
| 430 |
430 |
| 431 #if 0 |
|
| 432 int find_queue_row_by_name(char *name) |
|
| 433 { |
|
| 434 gchar *temp; |
|
| 435 gint i = 0; |
|
| 436 gboolean valid; |
|
| 437 GtkTreeIter iter; |
|
| 438 |
|
| 439 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), &iter); |
|
| 440 while(valid) { |
|
| 441 gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), &iter, 0, &temp, -1); |
|
| 442 if(!strcmp(name, temp)) |
|
| 443 return i; |
|
| 444 g_free(temp); |
|
| 445 |
|
| 446 i++; |
|
| 447 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(awayqueuestore), &iter); |
|
| 448 } |
|
| 449 |
|
| 450 return -1; |
|
| 451 } |
|
| 452 |
|
| 453 int find_queue_total_by_name(char *name) |
|
| 454 { |
|
| 455 GSList *templist; |
|
| 456 int i = 0; |
|
| 457 |
|
| 458 templist = message_queue; |
|
| 459 |
|
| 460 while (templist) { |
|
| 461 struct queued_message *qm = (struct queued_message *)templist->data; |
|
| 462 if ((qm->flags & GAIM_MESSAGE_RECV) && !strcmp(name, qm->name)) |
|
| 463 i++; |
|
| 464 |
|
| 465 templist = templist->next; |
|
| 466 } |
|
| 467 |
|
| 468 return i; |
|
| 469 } |
|
| 470 #endif |
|
| 471 |
|
| 472 /* |
431 /* |
| 473 * woo. i'm actually going to comment this function. isn't that fun. make |
432 * woo. i'm actually going to comment this function. isn't that fun. make |
| 474 * sure to follow along, kids |
433 * sure to follow along, kids |
| 475 */ |
434 */ |
| 476 void serv_got_im(GaimConnection *gc, const char *who, const char *msg, |
435 void serv_got_im(GaimConnection *gc, const char *who, const char *msg, |
| 551 GaimBuddy *b = gaim_find_buddy(gc->account, name); |
510 GaimBuddy *b = gaim_find_buddy(gc->account, name); |
| 552 const char *alias = b ? gaim_buddy_get_alias(b) : name; |
511 const char *alias = b ? gaim_buddy_get_alias(b) : name; |
| 553 struct last_auto_response *lar; |
512 struct last_auto_response *lar; |
| 554 const gchar *auto_reply_pref; |
513 const gchar *auto_reply_pref; |
| 555 const char *away_msg; |
514 const char *away_msg; |
| 556 #if 0 |
515 |
| 557 int row; |
516 if (cnv == NULL) |
| 558 #endif |
517 cnv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name); |
| |
518 |
| |
519 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, msgflags, mtime); |
| 559 |
520 |
| 560 /* |
521 /* |
| 561 * Either we're going to queue it or not. Because of the way |
|
| 562 * awayness currently works, this is fucked up. It's possible |
|
| 563 * for an account to be away without the imaway dialog being |
|
| 564 * shown. In fact, it's possible for *all* the accounts to be |
|
| 565 * away without the imaway dialog being shown. So in order for |
|
| 566 * this to be queued properly, we have to make sure that the |
|
| 567 * imaway dialog actually exists, first. |
|
| 568 */ |
|
| 569 #if 0 |
|
| 570 if (!cnv && awayqueue && |
|
| 571 gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { |
|
| 572 /* |
|
| 573 * Alright, so we're going to queue it. Neat, eh? :) |
|
| 574 * So first we create something to store the message, and add |
|
| 575 * it to our queue. Then we update the away dialog to indicate |
|
| 576 * that we've queued something. |
|
| 577 */ |
|
| 578 struct queued_message *qm; |
|
| 579 GtkTreeIter iter; |
|
| 580 gchar path[10]; |
|
| 581 |
|
| 582 qm = g_new0(struct queued_message, 1); |
|
| 583 g_snprintf(qm->name, sizeof(qm->name), "%s", name); |
|
| 584 if(strcmp(alias, name) != 0) |
|
| 585 g_snprintf(qm->alias, sizeof(qm->alias), "(%s)", alias); |
|
| 586 qm->message = g_strdup(message); |
|
| 587 qm->account = gc->account; |
|
| 588 qm->tm = mtime; |
|
| 589 qm->flags = msgflags; |
|
| 590 message_queue = g_slist_append(message_queue, qm); |
|
| 591 |
|
| 592 row = find_queue_row_by_name(qm->name); |
|
| 593 if (row >= 0) { |
|
| 594 char number[32]; |
|
| 595 int qtotal; |
|
| 596 |
|
| 597 qtotal = find_queue_total_by_name(qm->name); |
|
| 598 g_snprintf(number, 32, ngettext("(%d message)", |
|
| 599 "(%d messages)", qtotal), qtotal); |
|
| 600 g_snprintf(path, 10, "%d", row); |
|
| 601 gtk_tree_model_get_iter_from_string( |
|
| 602 GTK_TREE_MODEL(awayqueuestore), &iter, path); |
|
| 603 gtk_list_store_set(awayqueuestore, &iter, |
|
| 604 2, number, -1); |
|
| 605 } else { |
|
| 606 gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), |
|
| 607 &iter); |
|
| 608 gtk_list_store_append(awayqueuestore, &iter); |
|
| 609 gtk_list_store_set(awayqueuestore, &iter, |
|
| 610 0, qm->name, |
|
| 611 1, qm->alias, |
|
| 612 2, _("(1 message)"), |
|
| 613 -1); |
|
| 614 } |
|
| 615 } |
|
| 616 else |
|
| 617 #endif |
|
| 618 { |
|
| 619 /* |
|
| 620 * Make sure the conversation |
|
| 621 * exists and is updated (partly handled above already), play |
|
| 622 * the receive sound (sound.c will take care of not playing |
|
| 623 * while away), and then write it to the convo window. |
|
| 624 */ |
|
| 625 if (cnv == NULL) |
|
| 626 cnv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name); |
|
| 627 |
|
| 628 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, msgflags, mtime); |
|
| 629 } |
|
| 630 |
|
| 631 /* |
|
| 632 * Regardless of whether we queue it or not, we should send an |
|
| 633 * auto-response. That is, of course, unless the horse.... no wait. |
|
| 634 * Don't autorespond if: |
522 * Don't autorespond if: |
| 635 * |
523 * |
| 636 * - it's not supported on this connection |
524 * - it's not supported on this connection |
| 637 * - or the away message is empty |
525 * - or the away message is empty |
| 638 * - or it's disabled |
526 * - or it's disabled |