comparison src/server.c @ 12114:2cbb5993c819

[gaim-migrate @ 14414] Killed stylize(). No more gtk in server.c. Next stop: No more server.c. It looks like also the auto-response code was leaking, so that's fixed now. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 16 Nov 2005 16:59:22 +0000
parents 3b536c791a64
children e75ef7aa913e
comparison
equal deleted inserted replaced
12113:46fcc0765187 12114:2cbb5993c819
32 #include "signals.h" 32 #include "signals.h"
33 #include "server.h" 33 #include "server.h"
34 #include "status.h" 34 #include "status.h"
35 #include "util.h" 35 #include "util.h"
36 36
37 /* XXX UI Stuff */
38 #include "gaim.h"
39 #include "gtkutils.h"
40
41 #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 37 #define SECS_BEFORE_RESENDING_AUTORESPONSE 600
42 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" 38 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married"
43 39
44 /* This should return the elapsed time in seconds in which Gaim will not send 40 /* This should return the elapsed time in seconds in which Gaim will not send
45 * typing notifications. 41 * typing notifications.
550 * things we have to do for each. 546 * things we have to do for each.
551 */ 547 */
552 if (!gaim_presence_is_available(presence)) 548 if (!gaim_presence_is_available(presence))
553 { 549 {
554 time_t t = time(NULL); 550 time_t t = time(NULL);
555 char *tmpmsg;
556 GaimBuddy *b = gaim_find_buddy(gc->account, name); 551 GaimBuddy *b = gaim_find_buddy(gc->account, name);
557 const char *alias = b ? gaim_buddy_get_alias(b) : name; 552 const char *alias = b ? gaim_buddy_get_alias(b) : name;
558 struct last_auto_response *lar; 553 struct last_auto_response *lar;
559 const gchar *auto_reply_pref; 554 const gchar *auto_reply_pref;
560 const char *away_msg; 555 const char *away_msg;
682 gaim_status_get_attr_value(status, "message")); 677 gaim_status_get_attr_value(status, "message"));
683 678
684 if ((away_msg == NULL) || (*away_msg == '\0')) 679 if ((away_msg == NULL) || (*away_msg == '\0'))
685 return; 680 return;
686 681
687 /* apply default fonts and colors */
688 /* TODO: Do we even need this? */
689 tmpmsg = stylize(away_msg, MSG_LEN);
690
691 /* Move this to oscar.c! */ 682 /* Move this to oscar.c! */
692 buffy = gaim_str_sub_away_formatters(tmpmsg, alias); 683 buffy = gaim_str_sub_away_formatters(away_msg, alias);
693 serv_send_im(gc, name, buffy, GAIM_CONV_IM_AUTO_RESP); 684 serv_send_im(gc, name, buffy, GAIM_CONV_IM_AUTO_RESP);
694 g_free(buffy);
695 685
696 #if 0 686 #if 0
697 if (!cnv && awayqueue && 687 if (!cnv && awayqueue &&
698 gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { 688 gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) {
699 689
700 struct queued_message *qm; 690 struct queued_message *qm;
701 691
702 qm = g_new0(struct queued_message, 1); 692 qm = g_new0(struct queued_message, 1);
703 g_snprintf(qm->name, sizeof(qm->name), "%s", name); 693 g_snprintf(qm->name, sizeof(qm->name), "%s", name);
704 qm->message = g_strdup(gaim_str_sub_away_formatters(tmpmsg, alias)); 694 qm->message = g_strdup(buffy);
705 qm->account = gc->account; 695 qm->account = gc->account;
706 qm->tm = mtime; 696 qm->tm = mtime;
707 qm->flags = GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP; 697 qm->flags = GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP;
708 message_queue = g_slist_append(message_queue, qm); 698 message_queue = g_slist_append(message_queue, qm);
709 } 699 }
710 else if (cnv != NULL) 700 else if (cnv != NULL)
711 #endif 701 #endif
712 { 702 {
713 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, 703 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, buffy,
714 gaim_str_sub_away_formatters(tmpmsg, alias),
715 GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP, 704 GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP,
716 mtime); 705 mtime);
717 } 706 }
718 707
719 g_free(tmpmsg); 708 g_free(buffy);
720 } 709 }
721 else 710 else
722 { 711 {
723 /* 712 /*
724 * We're not away. This is easy. If the convo window doesn't 713 * We're not away. This is easy. If the convo window doesn't