Mercurial > pidgin
comparison src/server.c @ 10011:32467b63f55a
[gaim-migrate @ 10928]
More deprecation of serv_got_update or whatever it's called.
Is all the sound and logging stuff done in the new code? I didn't
actually check.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 11 Sep 2004 03:37:16 +0000 |
parents | bdec08a8fc5b |
children | eaec201b2688 |
comparison
equal
deleted
inserted
replaced
10010:56e34a659db2 | 10011:32467b63f55a |
---|---|
1051 | 1051 |
1052 g_free(name); | 1052 g_free(name); |
1053 g_free(message); | 1053 g_free(message); |
1054 } | 1054 } |
1055 | 1055 |
1056 /* | |
1057 * @param idle The time at which the buddy became idle, in seconds | |
1058 * since the epoch. | |
1059 */ | |
1060 void serv_got_update(GaimConnection *gc, const char *name, gboolean loggedin, | |
1061 time_t signon) | |
1062 { | |
1063 GaimPresence *presence; | |
1064 GaimAccount *account; | |
1065 GaimConversation *c; | |
1066 GaimBuddy *b; | |
1067 char *alias; | |
1068 GSList *buddies; | |
1069 time_t current_time = time(NULL); | |
1070 int signing_on = 0; | |
1071 int signing_off = 0; | |
1072 | |
1073 account = gaim_connection_get_account(gc); | |
1074 b = gaim_find_buddy(account, name); | |
1075 | |
1076 if (!b) { | |
1077 gaim_debug(GAIM_DEBUG_ERROR, "server", "No such buddy: %s\n", name); | |
1078 return; | |
1079 } | |
1080 | |
1081 c = gaim_find_conversation_with_account(b->name, account); | |
1082 | |
1083 /* This code will 'align' the name from the TOC */ | |
1084 /* server with what's in our record. We want to */ | |
1085 /* store things how THEY want it... */ | |
1086 if (strcmp(name, b->name)) { | |
1087 gaim_blist_rename_buddy(b, name); | |
1088 } | |
1089 | |
1090 alias = gaim_escape_html(gaim_buddy_get_alias(b)); | |
1091 | |
1092 presence = gaim_buddy_get_presence(b); | |
1093 | |
1094 if (loggedin) { | |
1095 if (!GAIM_BUDDY_IS_ONLINE(b)) { | |
1096 signing_on = TRUE; | |
1097 } | |
1098 } else if (GAIM_BUDDY_IS_ONLINE(b)) { | |
1099 signing_off = TRUE; | |
1100 } | |
1101 | |
1102 | |
1103 if (signing_on) { | |
1104 if (c != NULL) { | |
1105 char *tmp = g_strdup_printf(_("%s logged in."), alias); | |
1106 | |
1107 gaim_conversation_write(c, NULL, tmp, GAIM_MESSAGE_SYSTEM, | |
1108 time(NULL)); | |
1109 g_free(tmp); | |
1110 } | |
1111 #if 0 | |
1112 else if (awayqueue && find_queue_total_by_name(b->name)) { | |
1113 struct queued_message *qm = g_new0(struct queued_message, 1); | |
1114 g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); | |
1115 qm->message = g_strdup_printf(_("%s logged in."), alias); | |
1116 qm->account = gc->account; | |
1117 qm->tm = time(NULL); | |
1118 qm->flags = GAIM_MESSAGE_SYSTEM; | |
1119 message_queue = g_slist_append(message_queue, qm); | |
1120 } | |
1121 #endif | |
1122 gaim_sound_play_event(GAIM_SOUND_BUDDY_ARRIVE); | |
1123 | |
1124 if(gaim_prefs_get_bool("/core/logging/log_system") && | |
1125 gaim_prefs_get_bool("/core/logging/log_signon_signoff")) { | |
1126 GaimAccount *account = gaim_connection_get_account(gc); | |
1127 GaimLog *log = gaim_account_get_log(account); | |
1128 char *tmp = g_strdup_printf(_("%s signed on"), alias); | |
1129 | |
1130 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name), | |
1131 current_time, tmp); | |
1132 g_free(tmp); | |
1133 } | |
1134 } | |
1135 | |
1136 if (signing_off) { | |
1137 if (c != NULL) { | |
1138 char *tmp = g_strdup_printf(_("%s logged out."), alias); | |
1139 gaim_conversation_write(c, NULL, tmp, | |
1140 GAIM_MESSAGE_SYSTEM, time(NULL)); | |
1141 g_free(tmp); | |
1142 } | |
1143 #if 0 | |
1144 else if (awayqueue && find_queue_total_by_name(b->name)) { | |
1145 struct queued_message *qm = g_new0(struct queued_message, 1); | |
1146 g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); | |
1147 qm->message = g_strdup_printf(_("%s logged out."), alias); | |
1148 qm->account = gc->account; | |
1149 qm->tm = time(NULL); | |
1150 qm->flags = GAIM_MESSAGE_SYSTEM; | |
1151 message_queue = g_slist_append(message_queue, qm); | |
1152 } | |
1153 #endif | |
1154 serv_got_typing_stopped(gc, name); /* obviously not typing */ | |
1155 gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE); | |
1156 | |
1157 if(gaim_prefs_get_bool("/core/logging/log_system") && | |
1158 gaim_prefs_get_bool("/core/logging/log_signon_signoff")) { | |
1159 GaimAccount *account = gaim_connection_get_account(gc); | |
1160 GaimLog *log = gaim_account_get_log(account); | |
1161 char *tmp = g_strdup_printf(_("%s signed off"), alias); | |
1162 | |
1163 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name), | |
1164 current_time, tmp); | |
1165 g_free(tmp); | |
1166 } | |
1167 } | |
1168 | |
1169 gaim_blist_update_buddy_signon(b, signon); | |
1170 | |
1171 if (c != NULL) | |
1172 gaim_conversation_update(c, GAIM_CONV_UPDATE_AWAY); | |
1173 | |
1174 gaim_blist_update_buddy_presence(b, loggedin); | |
1175 | |
1176 for (buddies = gaim_find_buddies(account, name); buddies; buddies = g_slist_remove(buddies, buddies->data)) { | |
1177 b = buddies->data; | |
1178 gaim_blist_update_buddy_presence(b, loggedin); | |
1179 } | |
1180 g_free(alias); | |
1181 } | |
1182 | |
1183 void serv_got_typing(GaimConnection *gc, const char *name, int timeout, | 1056 void serv_got_typing(GaimConnection *gc, const char *name, int timeout, |
1184 GaimTypingState state) { | 1057 GaimTypingState state) { |
1185 | 1058 |
1186 GaimBuddy *b; | 1059 GaimBuddy *b; |
1187 GaimConversation *cnv = gaim_find_conversation_with_account(name, gc->account); | 1060 GaimConversation *cnv = gaim_find_conversation_with_account(name, gc->account); |