Mercurial > pidgin.yaz
comparison src/server.c @ 8573:7dcd6f26e4a7
[gaim-migrate @ 9321]
" This patch reimplements the system log. It writes
system log to
~/.gaim/logs/<protocol>/<username>/.system/<timestamp>.(txt|html),
where <timestamp> is the time that the account
<username> with <protocol> signs on. Nathan (faceprint)
and LSchiere suggested this logging scheme. No code is
currently written to read the old system logs.
Note that if you change the logging format, you need to
re-login the accounts for the change to take effect."
--Ka-Hing (javabsp) Cheung
who continues:
"Now this one applies, also contains a rider patch that, if
you enable sound for "Someone says your name in chat", it
will not play a sound if the message is a system message,
like if jabber chat tells you that "*** becomes available"
and *** is you, it won't play a sound."
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sat, 03 Apr 2004 18:34:29 +0000 |
parents | 88988327a4e0 |
children | 8d5084065107 |
comparison
equal
deleted
inserted
replaced
8572:f6890288bbe0 | 8573:7dcd6f26e4a7 |
---|---|
1098 GaimAccount *account; | 1098 GaimAccount *account; |
1099 GaimConversation *c; | 1099 GaimConversation *c; |
1100 GaimBuddy *b; | 1100 GaimBuddy *b; |
1101 GSList *buddies; | 1101 GSList *buddies; |
1102 int old_idle; | 1102 int old_idle; |
1103 time_t current_time = time(NULL); | |
1104 int signing_on = 0; | |
1105 int signing_off = 0; | |
1103 | 1106 |
1104 account = gaim_connection_get_account(gc); | 1107 account = gaim_connection_get_account(gc); |
1105 b = gaim_find_buddy(account, name); | 1108 b = gaim_find_buddy(account, name); |
1106 | 1109 |
1107 if (signon && (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->options & | 1110 if (signon && (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->options & |
1146 else if (!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE)) | 1149 else if (!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE)) |
1147 system_log(log_away, gc, b, OPT_LOG_BUDDY_AWAY); | 1150 system_log(log_away, gc, b, OPT_LOG_BUDDY_AWAY); |
1148 */ | 1151 */ |
1149 gaim_blist_update_buddy_status(b, type); | 1152 gaim_blist_update_buddy_status(b, type); |
1150 | 1153 |
1154 if (loggedin) { | |
1155 if (!GAIM_BUDDY_IS_ONLINE(b)) { | |
1156 signing_on = TRUE; | |
1157 } | |
1158 } else if (GAIM_BUDDY_IS_ONLINE(b)) { | |
1159 signing_off = TRUE; | |
1160 } | |
1161 | |
1162 | |
1163 if (signing_on) { | |
1164 if (gaim_prefs_get_bool("/core/conversations/im/show_login")) { | |
1165 if (c != NULL) { | |
1166 | |
1167 char *tmp = g_strdup_printf(_("%s logged in."), | |
1168 gaim_get_buddy_alias(b)); | |
1169 | |
1170 gaim_conversation_write(c, NULL, tmp, GAIM_MESSAGE_SYSTEM, | |
1171 time(NULL)); | |
1172 g_free(tmp); | |
1173 } | |
1174 else if (awayqueue && find_queue_total_by_name(b->name)) { | |
1175 struct queued_message *qm = g_new0(struct queued_message, 1); | |
1176 g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); | |
1177 qm->message = g_strdup_printf(_("%s logged in."), | |
1178 gaim_get_buddy_alias(b)); | |
1179 qm->account = gc->account; | |
1180 qm->tm = time(NULL); | |
1181 qm->flags = GAIM_MESSAGE_SYSTEM; | |
1182 message_queue = g_slist_append(message_queue, qm); | |
1183 } | |
1184 } | |
1185 gaim_sound_play_event(GAIM_SOUND_BUDDY_ARRIVE); | |
1186 | |
1187 if(gaim_prefs_get_bool("/core/logging/log_system") && | |
1188 gaim_prefs_get_bool("/core/logging/log_signon_signoff")) { | |
1189 GaimAccount *account = gaim_connection_get_account(gc); | |
1190 GaimLog *log = gaim_account_get_log(account); | |
1191 char *tmp = g_strdup_printf(_("%s signed on"), | |
1192 gaim_get_buddy_alias(b)); | |
1193 | |
1194 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b), | |
1195 current_time, tmp); | |
1196 g_free(tmp); | |
1197 } | |
1198 } | |
1199 | |
1200 if(gaim_prefs_get_bool("/core/logging/log_system") && | |
1201 gaim_prefs_get_bool("/core/logging/log_away_state")) { | |
1202 GaimAccount *account = gaim_connection_get_account(gc); | |
1203 GaimLog *log = gaim_account_get_log(account); | |
1204 char *tmp = NULL; | |
1205 | |
1206 if((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) | |
1207 tmp = g_strdup_printf(_("%s came back"), gaim_get_buddy_alias(b)); | |
1208 else if(!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE)) | |
1209 tmp = g_strdup_printf(_("%s went away"), gaim_get_buddy_alias(b)); | |
1210 | |
1211 if(tmp){ | |
1212 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b), | |
1213 current_time, tmp); | |
1214 g_free(tmp); | |
1215 } | |
1216 } | |
1217 | |
1151 if (!old_idle && idle) { | 1218 if (!old_idle && idle) { |
1152 gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle", b); | 1219 gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle", b); |
1220 if(gaim_prefs_get_bool("/core/logging/log_system") && | |
1221 gaim_prefs_get_bool("/core/logging/log_idle_state")) { | |
1222 GaimAccount *account = gaim_connection_get_account(gc); | |
1223 GaimLog *log = gaim_account_get_log(account); | |
1224 char *tmp = g_strdup_printf(_("%s became idle"), | |
1225 gaim_get_buddy_alias(b)); | |
1226 | |
1227 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b), | |
1228 current_time, tmp); | |
1229 g_free(tmp); | |
1230 } | |
1153 } else if (old_idle && !idle) { | 1231 } else if (old_idle && !idle) { |
1154 gaim_signal_emit(gaim_blist_get_handle(), "buddy-unidle", b); | 1232 gaim_signal_emit(gaim_blist_get_handle(), "buddy-unidle", b); |
1155 } | 1233 |
1156 | 1234 if(gaim_prefs_get_bool("/core/logging/log_system") && |
1157 if (loggedin) { | 1235 gaim_prefs_get_bool("/core/logging/log_idle_state")) { |
1158 if (!GAIM_BUDDY_IS_ONLINE(b)) { | 1236 GaimAccount *account = gaim_connection_get_account(gc); |
1159 if (gaim_prefs_get_bool("/core/conversations/im/show_login")) { | 1237 GaimLog *log = gaim_account_get_log(account); |
1160 if (c != NULL) { | 1238 char *tmp = g_strdup_printf(_("%s became unidle"), |
1161 | 1239 gaim_get_buddy_alias(b)); |
1162 char *tmp = g_strdup_printf(_("%s logged in."), | 1240 |
1163 gaim_get_buddy_alias(b)); | 1241 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b), |
1164 | 1242 current_time, tmp); |
1165 gaim_conversation_write(c, NULL, tmp, GAIM_MESSAGE_SYSTEM, | 1243 g_free(tmp); |
1166 time(NULL)); | 1244 } |
1167 g_free(tmp); | 1245 } |
1168 } | 1246 |
1169 else if (awayqueue && find_queue_total_by_name(b->name)) { | 1247 if (signing_off) { |
1170 struct queued_message *qm = g_new0(struct queued_message, 1); | 1248 if (gaim_prefs_get_bool("/core/conversations/im/show_login")) { |
1171 g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); | 1249 if (c != NULL) { |
1172 qm->message = g_strdup_printf(_("%s logged in."), | 1250 |
1173 gaim_get_buddy_alias(b)); | 1251 char *tmp = g_strdup_printf(_("%s logged out."), |
1174 qm->account = gc->account; | 1252 gaim_get_buddy_alias(b)); |
1175 qm->tm = time(NULL); | 1253 gaim_conversation_write(c, NULL, tmp, |
1176 qm->flags = GAIM_MESSAGE_SYSTEM; | 1254 GAIM_MESSAGE_SYSTEM, time(NULL)); |
1177 message_queue = g_slist_append(message_queue, qm); | 1255 g_free(tmp); |
1178 } | 1256 } else if (awayqueue && find_queue_total_by_name(b->name)) { |
1257 struct queued_message *qm = g_new0(struct queued_message, 1); | |
1258 g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); | |
1259 qm->message = g_strdup_printf(_("%s logged out."), | |
1260 gaim_get_buddy_alias(b)); | |
1261 qm->account = gc->account; | |
1262 qm->tm = time(NULL); | |
1263 qm->flags = GAIM_MESSAGE_SYSTEM; | |
1264 message_queue = g_slist_append(message_queue, qm); | |
1179 } | 1265 } |
1180 gaim_sound_play_event(GAIM_SOUND_BUDDY_ARRIVE); | 1266 } |
1181 /* LOG system_log(log_signon, gc, b, OPT_LOG_BUDDY_SIGNON); */ | 1267 serv_got_typing_stopped(gc, name); /* obviously not typing */ |
1182 } | 1268 gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE); |
1183 } else { | 1269 |
1184 if (GAIM_BUDDY_IS_ONLINE(b)) { | 1270 if(gaim_prefs_get_bool("/core/logging/log_system") && |
1185 | 1271 gaim_prefs_get_bool("/core/logging/log_signon_signoff")) { |
1186 if (gaim_prefs_get_bool("/core/conversations/im/show_login")) { | 1272 GaimAccount *account = gaim_connection_get_account(gc); |
1187 if (c != NULL) { | 1273 GaimLog *log = gaim_account_get_log(account); |
1188 | 1274 char *tmp = g_strdup_printf(_("%s signed off"), |
1189 char *tmp = g_strdup_printf(_("%s logged out."), | 1275 gaim_get_buddy_alias(b)); |
1190 gaim_get_buddy_alias(b)); | 1276 |
1191 gaim_conversation_write(c, NULL, tmp, | 1277 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b), |
1192 GAIM_MESSAGE_SYSTEM, time(NULL)); | 1278 current_time, tmp); |
1193 g_free(tmp); | 1279 g_free(tmp); |
1194 } else if (awayqueue && find_queue_total_by_name(b->name)) { | 1280 } |
1195 struct queued_message *qm = g_new0(struct queued_message, 1); | 1281 } |
1196 g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); | 1282 |
1197 qm->message = g_strdup_printf(_("%s logged out."), | |
1198 gaim_get_buddy_alias(b)); | |
1199 qm->account = gc->account; | |
1200 qm->tm = time(NULL); | |
1201 qm->flags = GAIM_MESSAGE_SYSTEM; | |
1202 message_queue = g_slist_append(message_queue, qm); | |
1203 } | |
1204 } | |
1205 serv_got_typing_stopped(gc, name); /* obviously not typing */ | |
1206 gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE); | |
1207 /* LOG system_log(log_signoff, gc, b, OPT_LOG_BUDDY_SIGNON); */ | |
1208 } | |
1209 } | |
1210 | 1283 |
1211 if (c != NULL) | 1284 if (c != NULL) |
1212 gaim_conversation_update(c, GAIM_CONV_UPDATE_AWAY); | 1285 gaim_conversation_update(c, GAIM_CONV_UPDATE_AWAY); |
1213 | 1286 |
1214 gaim_blist_update_buddy_presence(b, loggedin); | 1287 gaim_blist_update_buddy_presence(b, loggedin); |