Mercurial > pidgin
comparison src/server.c @ 9944:e4a27c9aec4c
[gaim-migrate @ 10838]
with much rejoicing, and massive thanks to the efforts of Christian, and
all who have helped him, I present to you the incomplete status
rewrite!
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 03 Sep 2004 21:35:52 +0000 |
parents | cee849d17167 |
children | ced29c7b396c |
comparison
equal
deleted
inserted
replaced
9943:f8e395a054e2 | 9944:e4a27c9aec4c |
---|---|
19 * along with this program; if not, write to the Free Software | 19 * along with this program; if not, write to the Free Software |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 * | 21 * |
22 */ | 22 */ |
23 #include "internal.h" | 23 #include "internal.h" |
24 #include "blist.h" | |
24 #include "conversation.h" | 25 #include "conversation.h" |
25 #include "debug.h" | 26 #include "debug.h" |
26 #include "log.h" | 27 #include "log.h" |
27 #include "notify.h" | 28 #include "notify.h" |
28 #include "prefs.h" | 29 #include "prefs.h" |
29 #include "prpl.h" | 30 #include "prpl.h" |
30 #include "request.h" | 31 #include "request.h" |
31 #include "signals.h" | 32 #include "signals.h" |
32 #include "server.h" | 33 #include "server.h" |
33 #include "sound.h" | 34 #include "sound.h" |
35 #include "status.h" | |
34 #include "util.h" | 36 #include "util.h" |
35 | 37 |
36 /* XXX UI Stuff */ | 38 /* XXX UI Stuff */ |
37 #include "away.h" | 39 #include "away.h" |
38 #include "gtkdialogs.h" | 40 #include "gtkdialogs.h" |
789 if (prpl_info && prpl_info->set_buddy_icon) | 791 if (prpl_info && prpl_info->set_buddy_icon) |
790 prpl_info->set_buddy_icon(gc, filename); | 792 prpl_info->set_buddy_icon(gc, filename); |
791 | 793 |
792 } | 794 } |
793 | 795 |
796 #if 0 | |
794 int find_queue_row_by_name(char *name) | 797 int find_queue_row_by_name(char *name) |
795 { | 798 { |
796 gchar *temp; | 799 gchar *temp; |
797 gint i = 0; | 800 gint i = 0; |
798 gboolean valid; | 801 gboolean valid; |
827 templist = templist->next; | 830 templist = templist->next; |
828 } | 831 } |
829 | 832 |
830 return i; | 833 return i; |
831 } | 834 } |
835 #endif | |
832 | 836 |
833 /* | 837 /* |
834 * woo. i'm actually going to comment this function. isn't that fun. make | 838 * woo. i'm actually going to comment this function. isn't that fun. make |
835 * sure to follow along, kids | 839 * sure to follow along, kids |
836 */ | 840 */ |
837 void serv_got_im(GaimConnection *gc, const char *who, const char *msg, | 841 void serv_got_im(GaimConnection *gc, const char *who, const char *msg, |
838 GaimConvImFlags imflags, time_t mtime) | 842 GaimConvImFlags imflags, time_t mtime) |
839 { | 843 { |
844 GaimAccount *account; | |
840 GaimConversation *cnv; | 845 GaimConversation *cnv; |
846 GaimPresence *presence; | |
847 GaimStatus *status; | |
841 GaimMessageFlags msgflags; | 848 GaimMessageFlags msgflags; |
842 char *message, *name; | 849 char *message, *name; |
843 char *angel, *buffy; | 850 char *angel, *buffy; |
844 int plugin_return; | 851 int plugin_return; |
852 | |
853 account = gaim_connection_get_account(gc); | |
854 presence = gaim_account_get_presence(account); | |
845 | 855 |
846 /* | 856 /* |
847 * We should update the conversation window buttons and menu, | 857 * We should update the conversation window buttons and menu, |
848 * if it exists. | 858 * if it exists. |
849 */ | 859 */ |
914 * shown. In fact, it's possible for *all* the accounts to be | 924 * shown. In fact, it's possible for *all* the accounts to be |
915 * away without the imaway dialog being shown. So in order for | 925 * away without the imaway dialog being shown. So in order for |
916 * this to be queued properly, we have to make sure that the | 926 * this to be queued properly, we have to make sure that the |
917 * imaway dialog actually exists, first. | 927 * imaway dialog actually exists, first. |
918 */ | 928 */ |
929 #if 0 | |
919 if (!cnv && awayqueue && | 930 if (!cnv && awayqueue && |
920 gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { | 931 gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { |
921 /* | 932 /* |
922 * Alright, so we're going to queue it. Neat, eh? :) | 933 * Alright, so we're going to queue it. Neat, eh? :) |
923 * So first we create something to store the message, and add | 934 * So first we create something to store the message, and add |
959 0, qm->name, | 970 0, qm->name, |
960 1, qm->alias, | 971 1, qm->alias, |
961 2, _("(1 message)"), | 972 2, _("(1 message)"), |
962 -1); | 973 -1); |
963 } | 974 } |
964 } else { | 975 } |
976 else | |
977 #endif | |
978 { | |
965 /* | 979 /* |
966 * Make sure the conversation | 980 * Make sure the conversation |
967 * exists and is updated (partly handled above already), play | 981 * exists and is updated (partly handled above already), play |
968 * the receive sound (sound.c will take care of not playing | 982 * the receive sound (sound.c will take care of not playing |
969 * while away), and then write it to the convo window. | 983 * while away), and then write it to the convo window. |
970 */ | 984 */ |
971 if (cnv == NULL) | 985 if (cnv == NULL) |
972 cnv = gaim_conversation_new(GAIM_CONV_IM, gc->account, name); | 986 cnv = gaim_conversation_new(GAIM_CONV_IM, account, name); |
973 | 987 |
974 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, msgflags, mtime); | 988 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, msgflags, mtime); |
975 gaim_conv_window_flash(gaim_conversation_get_window(cnv)); | 989 gaim_conv_window_flash(gaim_conversation_get_window(cnv)); |
976 } | 990 } |
977 | 991 |
1014 return; | 1028 return; |
1015 } | 1029 } |
1016 lar->sent = t; | 1030 lar->sent = t; |
1017 | 1031 |
1018 /* apply default fonts and colors */ | 1032 /* apply default fonts and colors */ |
1019 tmpmsg = stylize(gc->away, MSG_LEN); | 1033 tmpmsg = stylize(away_msg, MSG_LEN); |
1020 | 1034 |
1021 /* Move this to oscar.c! */ | 1035 /* Move this to oscar.c! */ |
1022 buffy = gaim_str_sub_away_formatters(tmpmsg, alias); | 1036 buffy = gaim_str_sub_away_formatters(tmpmsg, alias); |
1023 serv_send_im(gc, name, buffy, GAIM_CONV_IM_AUTO_RESP); | 1037 serv_send_im(gc, name, buffy, GAIM_CONV_IM_AUTO_RESP); |
1024 g_free(buffy); | 1038 g_free(buffy); |
1025 | 1039 |
1040 #if 0 | |
1026 if (!cnv && awayqueue && | 1041 if (!cnv && awayqueue && |
1027 gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { | 1042 gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { |
1028 | 1043 |
1029 struct queued_message *qm; | 1044 struct queued_message *qm; |
1030 | 1045 |
1033 qm->message = g_strdup(gaim_str_sub_away_formatters(tmpmsg, alias)); | 1048 qm->message = g_strdup(gaim_str_sub_away_formatters(tmpmsg, alias)); |
1034 qm->account = gc->account; | 1049 qm->account = gc->account; |
1035 qm->tm = mtime; | 1050 qm->tm = mtime; |
1036 qm->flags = GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP; | 1051 qm->flags = GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP; |
1037 message_queue = g_slist_append(message_queue, qm); | 1052 message_queue = g_slist_append(message_queue, qm); |
1038 } else if (cnv != NULL) | 1053 } |
1039 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, gaim_str_sub_away_formatters(tmpmsg, alias), | 1054 else if (cnv != NULL) |
1040 GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP, mtime); | 1055 #endif |
1056 { | |
1057 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, | |
1058 gaim_str_sub_away_formatters(tmpmsg, alias), | |
1059 GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP, | |
1060 mtime); | |
1061 } | |
1041 | 1062 |
1042 g_free(tmpmsg); | 1063 g_free(tmpmsg); |
1043 } else { | 1064 } |
1065 else | |
1066 { | |
1044 /* | 1067 /* |
1045 * We're not away. This is easy. If the convo window doesn't | 1068 * We're not away. This is easy. If the convo window doesn't |
1046 * exist, create and update it (if it does exist it was updated | 1069 * exist, create and update it (if it does exist it was updated |
1047 * earlier), then play a sound indicating we've received it and | 1070 * earlier), then play a sound indicating we've received it and |
1048 * then display it. Easy. | 1071 * then display it. Easy. |
1050 | 1073 |
1051 /* XXX UGLY HACK OF THE YEAR | 1074 /* XXX UGLY HACK OF THE YEAR |
1052 * Robot101 will fix this after his exams. honest. | 1075 * Robot101 will fix this after his exams. honest. |
1053 * I guess he didn't specify WHICH exams, exactly... | 1076 * I guess he didn't specify WHICH exams, exactly... |
1054 */ | 1077 */ |
1078 /* XXX CORE/UI */ | |
1079 #if 0 | |
1055 if (docklet_count && | 1080 if (docklet_count && |
1056 gaim_prefs_get_bool("/plugins/gtk/docklet/queue_messages") && | 1081 gaim_prefs_get_bool("/plugins/gtk/docklet/queue_messages") && |
1057 !gaim_find_conversation_with_account(name, gc->account)) { | 1082 !gaim_find_conversation_with_account(name, gc->account)) { |
1058 /* | 1083 /* |
1059 * We're gonna queue it up and wait for the user to ask for | 1084 * We're gonna queue it up and wait for the user to ask for |
1067 qm->tm = mtime; | 1092 qm->tm = mtime; |
1068 qm->flags = msgflags; | 1093 qm->flags = msgflags; |
1069 unread_message_queue = g_slist_append(unread_message_queue, qm); | 1094 unread_message_queue = g_slist_append(unread_message_queue, qm); |
1070 } | 1095 } |
1071 else { | 1096 else { |
1097 #endif | |
1072 if (cnv == NULL) | 1098 if (cnv == NULL) |
1073 cnv = gaim_conversation_new(GAIM_CONV_IM, gc->account, name); | 1099 cnv = gaim_conversation_new(GAIM_CONV_IM, gc->account, name); |
1074 | 1100 |
1075 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, msgflags, mtime); | 1101 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, msgflags, mtime); |
1076 gaim_conv_window_flash(gaim_conversation_get_window(cnv)); | 1102 gaim_conv_window_flash(gaim_conversation_get_window(cnv)); |
1077 } | 1103 #if 0 |
1104 } | |
1105 #endif | |
1078 } | 1106 } |
1079 | 1107 |
1080 g_free(name); | 1108 g_free(name); |
1081 g_free(message); | 1109 g_free(message); |
1082 } | 1110 } |
1172 gaim_blist_rename_buddy(b, name); | 1200 gaim_blist_rename_buddy(b, name); |
1173 } | 1201 } |
1174 | 1202 |
1175 alias = gaim_escape_html(gaim_buddy_get_alias(b)); | 1203 alias = gaim_escape_html(gaim_buddy_get_alias(b)); |
1176 | 1204 |
1177 old_idle = b->idle; | 1205 presence = gaim_buddy_get_presence(b); |
1178 | 1206 |
1179 if (loggedin) { | 1207 if (loggedin) { |
1180 if (!GAIM_BUDDY_IS_ONLINE(b)) { | 1208 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
1181 signing_on = TRUE; | 1209 signing_on = TRUE; |
1182 } | 1210 } |