comparison src/log.c @ 5563:9eb5b13fd412

[gaim-migrate @ 5965] Just a taste of what's coming. Standard "This won't compile" thing. Plugin authors, you're going to hate me, but that's okay, because I have friends too! It's really late. My brain resembles that of fish swimming in jello pudding with neon lights flying around chanting musicals. I'm not on drugs. I'm just that tired. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 30 May 2003 09:38:29 +0000
parents b7319c094153
children b07aa997ddd8
comparison
equal deleted inserted replaced
5562:3c8d34574601 5563:9eb5b13fd412
281 } 281 }
282 282
283 return fd; 283 return fd;
284 } 284 }
285 285
286 void system_log(enum log_event what, struct gaim_connection *gc, 286 void system_log(enum log_event what, GaimConnection *gc,
287 struct buddy *who, int why) 287 struct buddy *who, int why)
288 { 288 {
289 GaimAccount *account;
289 FILE *fd; 290 FILE *fd;
290 char text[256], html[256]; 291 char text[256], html[256];
291 292
293 account = gaim_connection_get_account(gc);
294
292 if (((why & OPT_LOG_MY_SIGNON) && 295 if (((why & OPT_LOG_MY_SIGNON) &&
293 !gaim_prefs_get_bool("/gaim/gtk/logging/log_own_states"))) { 296 !gaim_prefs_get_bool("/gaim/gtk/logging/log_own_states"))) {
294 297
295 return; 298 return;
296 } 299 }
297 300
298 if (gaim_prefs_get_bool("/gaim/gtk/logging/individual_logs")) { 301 if (gaim_prefs_get_bool("/gaim/gtk/logging/individual_logs")) {
299 if (why & OPT_LOG_MY_SIGNON) 302 if (why & OPT_LOG_MY_SIGNON)
300 fd = open_system_log_file(gc ? gc->username : NULL); 303 fd = open_system_log_file(gc ? (char *)gaim_account_get_username(account) : NULL);
301 else 304 else
302 fd = open_system_log_file(who->name); 305 fd = open_system_log_file(who->name);
303 } else 306 } else
304 fd = open_system_log_file(NULL); 307 fd = open_system_log_file(NULL);
305 308
308 311
309 if (why & OPT_LOG_MY_SIGNON) { 312 if (why & OPT_LOG_MY_SIGNON) {
310 switch (what) { 313 switch (what) {
311 case log_signon: 314 case log_signon:
312 g_snprintf(text, sizeof(text), _("+++ %s (%s) signed on @ %s"), 315 g_snprintf(text, sizeof(text), _("+++ %s (%s) signed on @ %s"),
313 gc->username, gc->prpl->info->name, full_date()); 316 gaim_account_get_username(account), gc->prpl->info->name, full_date());
314 g_snprintf(html, sizeof(html), "<B>%s</B>", text); 317 g_snprintf(html, sizeof(html), "<B>%s</B>", text);
315 break; 318 break;
316 case log_signoff: 319 case log_signoff:
317 g_snprintf(text, sizeof(text), _("+++ %s (%s) signed off @ %s"), 320 g_snprintf(text, sizeof(text), _("+++ %s (%s) signed off @ %s"),
318 gc->username, gc->prpl->info->name, full_date()); 321 gaim_account_get_username(account), gc->prpl->info->name, full_date());
319 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text); 322 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
320 break; 323 break;
321 case log_away: 324 case log_away:
322 g_snprintf(text, sizeof(text), _("+++ %s (%s) changed away state @ %s"), 325 g_snprintf(text, sizeof(text), _("+++ %s (%s) changed away state @ %s"),
323 gc->username, gc->prpl->info->name, full_date()); 326 gaim_account_get_username(account), gc->prpl->info->name, full_date());
324 g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text); 327 g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text);
325 break; 328 break;
326 case log_back: 329 case log_back:
327 g_snprintf(text, sizeof(text), _("+++ %s (%s) came back @ %s"), 330 g_snprintf(text, sizeof(text), _("+++ %s (%s) came back @ %s"),
328 gc->username, gc->prpl->info->name, full_date()); 331 gaim_account_get_username(account), gc->prpl->info->name, full_date());
329 g_snprintf(html, sizeof(html), "%s", text); 332 g_snprintf(html, sizeof(html), "%s", text);
330 break; 333 break;
331 case log_idle: 334 case log_idle:
332 g_snprintf(text, sizeof(text), _("+++ %s (%s) became idle @ %s"), 335 g_snprintf(text, sizeof(text), _("+++ %s (%s) became idle @ %s"),
333 gc->username, gc->prpl->info->name, full_date()); 336 gaim_account_get_username(account), gc->prpl->info->name, full_date());
334 g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text); 337 g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text);
335 break; 338 break;
336 case log_unidle: 339 case log_unidle:
337 g_snprintf(text, sizeof(text), _("+++ %s (%s) returned from idle @ %s"), 340 g_snprintf(text, sizeof(text), _("+++ %s (%s) returned from idle @ %s"),
338 gc->username, gc->prpl->info->name, full_date()); 341 gaim_account_get_username(account), gc->prpl->info->name, full_date());
339 g_snprintf(html, sizeof(html), "%s", text); 342 g_snprintf(html, sizeof(html), "%s", text);
340 break; 343 break;
341 case log_quit: 344 case log_quit:
342 g_snprintf(text, sizeof(text), _("+++ Program exit @ %s"), full_date()); 345 g_snprintf(text, sizeof(text), _("+++ Program exit @ %s"), full_date());
343 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text); 346 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
345 } 348 }
346 } else if (gaim_get_buddy_alias_only(who)) { 349 } else if (gaim_get_buddy_alias_only(who)) {
347 switch (what) { 350 switch (what) {
348 case log_signon: 351 case log_signon:
349 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) signed on @ %s"), 352 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) signed on @ %s"),
350 gc->username, gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date()); 353 gaim_account_get_username(account), gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
351 g_snprintf(html, sizeof(html), "<B>%s</B>", text); 354 g_snprintf(html, sizeof(html), "<B>%s</B>", text);
352 break; 355 break;
353 case log_signoff: 356 case log_signoff:
354 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) signed off @ %s"), 357 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) signed off @ %s"),
355 gc->username, gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date()); 358 gaim_account_get_username(account), gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
356 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text); 359 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
357 break; 360 break;
358 case log_away: 361 case log_away:
359 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) went away @ %s"), 362 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) went away @ %s"),
360 gc->username, gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date()); 363 gaim_account_get_username(account), gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
361 g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text); 364 g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text);
362 break; 365 break;
363 case log_back: 366 case log_back:
364 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) came back @ %s"), 367 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) came back @ %s"),
365 gc->username, gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date()); 368 gaim_account_get_username(account), gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
366 g_snprintf(html, sizeof(html), "%s", text); 369 g_snprintf(html, sizeof(html), "%s", text);
367 break; 370 break;
368 case log_idle: 371 case log_idle:
369 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) became idle @ %s"), 372 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) became idle @ %s"),
370 gc->username, gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date()); 373 gaim_account_get_username(account), gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
371 g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text); 374 g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text);
372 break; 375 break;
373 case log_unidle: 376 case log_unidle:
374 g_snprintf(text, sizeof(text), 377 g_snprintf(text, sizeof(text),
375 _("%s (%s) reported that %s (%s) returned from idle @ %s"), gc->username, 378 _("%s (%s) reported that %s (%s) returned from idle @ %s"), gaim_account_get_username(account),
376 gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date()); 379 gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
377 g_snprintf(html, sizeof(html), "%s", text); 380 g_snprintf(html, sizeof(html), "%s", text);
378 break; 381 break;
379 default: 382 default:
380 fclose(fd); 383 fclose(fd);
383 } 386 }
384 } else { 387 } else {
385 switch (what) { 388 switch (what) {
386 case log_signon: 389 case log_signon:
387 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s signed on @ %s"), 390 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s signed on @ %s"),
388 gc->username, gc->prpl->info->name, who->name, full_date()); 391 gaim_account_get_username(account), gc->prpl->info->name, who->name, full_date());
389 g_snprintf(html, sizeof(html), "<B>%s</B>", text); 392 g_snprintf(html, sizeof(html), "<B>%s</B>", text);
390 break; 393 break;
391 case log_signoff: 394 case log_signoff:
392 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s signed off @ %s"), 395 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s signed off @ %s"),
393 gc->username, gc->prpl->info->name, who->name, full_date()); 396 gaim_account_get_username(account), gc->prpl->info->name, who->name, full_date());
394 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text); 397 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
395 break; 398 break;
396 case log_away: 399 case log_away:
397 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s went away @ %s"), 400 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s went away @ %s"),
398 gc->username, gc->prpl->info->name, who->name, full_date()); 401 gaim_account_get_username(account), gc->prpl->info->name, who->name, full_date());
399 g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text); 402 g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text);
400 break; 403 break;
401 case log_back: 404 case log_back:
402 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s came back @ %s"), 405 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s came back @ %s"),
403 gc->username, gc->prpl->info->name, who->name, full_date()); 406 gaim_account_get_username(account), gc->prpl->info->name, who->name, full_date());
404 g_snprintf(html, sizeof(html), "%s", text); 407 g_snprintf(html, sizeof(html), "%s", text);
405 break; 408 break;
406 case log_idle: 409 case log_idle:
407 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s became idle @ %s"), 410 g_snprintf(text, sizeof(text), _("%s (%s) reported that %s became idle @ %s"),
408 gc->username, gc->prpl->info->name, who->name, full_date()); 411 gaim_account_get_username(account), gc->prpl->info->name, who->name, full_date());
409 g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text); 412 g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text);
410 break; 413 break;
411 case log_unidle: 414 case log_unidle:
412 g_snprintf(text, sizeof(text), 415 g_snprintf(text, sizeof(text),
413 _("%s (%s) reported that %s returned from idle @ %s"), gc->username, 416 _("%s (%s) reported that %s returned from idle @ %s"), gaim_account_get_username(account),
414 gc->prpl->info->name, who->name, full_date()); 417 gc->prpl->info->name, who->name, full_date());
415 g_snprintf(html, sizeof(html), "%s", text); 418 g_snprintf(html, sizeof(html), "%s", text);
416 break; 419 break;
417 default: 420 default:
418 fclose(fd); 421 fclose(fd);