comparison src/connection.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 ef881489396e
children 725413cc9fb9
comparison
equal deleted inserted replaced
8572:f6890288bbe0 8573:7dcd6f26e4a7
311 311
312 if (gc->state == GAIM_CONNECTED) { 312 if (gc->state == GAIM_CONNECTED) {
313 GaimBlistNode *gnode,*cnode,*bnode; 313 GaimBlistNode *gnode,*cnode,*bnode;
314 GList *wins; 314 GList *wins;
315 GList *add_buds=NULL; 315 GList *add_buds=NULL;
316 GaimAccount *account = gaim_connection_get_account(gc);
316 317
317 /* Set the time the account came online */ 318 /* Set the time the account came online */
318 time(&gc->login_time); 319 time(&gc->login_time);
319 320
320 if (ops != NULL && ops->connected != NULL) 321 if (ops != NULL && ops->connected != NULL)
321 ops->connected(gc); 322 ops->connected(gc);
322 323
323 gaim_blist_show(); 324 gaim_blist_show();
324 gaim_blist_add_account(gc->account); 325 gaim_blist_add_account(account);
325 326
326 /* 327 /*
327 * XXX This is a hack! Remove this and replace it with a better event 328 * XXX This is a hack! Remove this and replace it with a better event
328 * notification system. 329 * notification system.
329 */ 330 */
333 GAIM_CONV_ACCOUNT_ONLINE); 334 GAIM_CONV_ACCOUNT_ONLINE);
334 } 335 }
335 336
336 /* LOG system_log(log_signon, gc, NULL, 337 /* LOG system_log(log_signon, gc, NULL,
337 OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); */ 338 OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); */
339 if(gaim_prefs_get_bool("/core/logging/log_system") &&
340 gaim_prefs_get_bool("/core/logging/log_own_states")){
341 GaimLog *log = gaim_account_get_log(account);
342 char *msg = g_strdup_printf("+++ %s signed on",
343 gaim_account_get_username(account));
344 gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
345 gaim_account_get_username(account), gc->login_time,
346 msg);
347 g_free(msg);
348 }
349
338 gaim_signal_emit(gaim_connections_get_handle(), "signed-on", gc); 350 gaim_signal_emit(gaim_connections_get_handle(), "signed-on", gc);
339 351
340 #if 0 352 #if 0
341 /* away option given? */ 353 /* away option given? */
342 if (opt_away) { 354 if (opt_away) {
378 } 390 }
379 391
380 serv_set_permit_deny(gc); 392 serv_set_permit_deny(gc);
381 } 393 }
382 else if (gc->state == GAIM_DISCONNECTED) { 394 else if (gc->state == GAIM_DISCONNECTED) {
395 GaimAccount *account = gaim_connection_get_account(gc);
396
397 if(gaim_prefs_get_bool("/core/logging/log_system") &&
398 gaim_prefs_get_bool("/core/logging/log_own_states")){
399 GaimLog *log = gaim_account_get_log(account);
400 char *msg = g_strdup_printf("+++ %s signed off",
401 gaim_account_get_username(account));
402 gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
403 gaim_account_get_username(account), time(NULL),
404 msg);
405 g_free(msg);
406 }
407
408 gaim_account_destroy_log(account);
409
383 if (ops != NULL && ops->disconnected != NULL) 410 if (ops != NULL && ops->disconnected != NULL)
384 ops->disconnected(gc); 411 ops->disconnected(gc);
385 } 412 }
386 } 413 }
387 414
388 void 415 void
389 gaim_connection_set_account(GaimConnection *gc, GaimAccount *account) 416 gaim_connection_set_account(GaimConnection *gc, GaimAccount *account)