comparison src/log.c @ 9613:1b13160bf5a4

[gaim-migrate @ 10456] "Okay, now it's better. Still should close #997210. Note the list below is mostly the same as my initial comment and replaces the former information. 1) Prevent a crash if you sign off and try to dequeue messages from the away dialog. This was because we tried to use the destroyed GaimConnection in a couple places to get the prpl's name for the HTML logger and other conversation data. We look up the information via the account instead. 2) Prevent a possible crash if gaim_gtkconv_write_conv is called with who as NULL. 3) Prevent (null) or an empty string from being logged as the sender's name if the sender no longer has an alias because the account is signed off." --Kevin Stange committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 29 Jul 2004 03:11:00 +0000
parents 9c78aaa4117e
children 70ff55c0939b
comparison
equal deleted inserted replaced
9612:a11bc3f5c3e3 9613:1b13160bf5a4
501 ****************************/ 501 ****************************/
502 502
503 static void html_logger_write(GaimLog *log, GaimMessageFlags type, 503 static void html_logger_write(GaimLog *log, GaimMessageFlags type,
504 const char *from, time_t time, const char *message) 504 const char *from, time_t time, const char *message)
505 { 505 {
506 GaimConnection *gc = gaim_account_get_connection(log->account);
507 char date[64]; 506 char date[64];
508 char *msg_fixed; 507 char *msg_fixed;
509 struct generic_logger_data *data = log->logger_data; 508 struct generic_logger_data *data = log->logger_data;
509 GaimPlugin *plugin = gaim_find_prpl(gaim_account_get_protocol_id(log->account));
510 const char *prpl_name = plugin->info->name;
511
510 if(!data) { 512 if(!data) {
511 /* This log is new */ 513 /* This log is new */
512 char *ud = gaim_user_dir(); 514 char *ud = gaim_user_dir();
513 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account))); 515 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account)));
514 char *chat; 516 char *chat;
515 const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO 517 const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO(plugin)->list_icon(log->account, NULL);
516 (gaim_find_prpl(gaim_account_get_protocol_id(log->account)))->list_icon(log->account, NULL);
517 char *dir; 518 char *dir;
518 char *filename; 519 char *filename;
519 520
520 if (log->type == GAIM_LOG_CHAT) { 521 if (log->type == GAIM_LOG_CHAT) {
521 chat = g_strdup_printf("%s.chat", guy); 522 chat = g_strdup_printf("%s.chat", guy);
575 else if (type & GAIM_MESSAGE_RECV) 576 else if (type & GAIM_MESSAGE_RECV)
576 fprintf(data->file, _("<font color=\"#A82F2F\"><font size=\"2\">(%s)</font> <b>%s &lt;AUTO-REPLY&gt;:</b></font> %s<br/>\n"), date, from, msg_fixed); 577 fprintf(data->file, _("<font color=\"#A82F2F\"><font size=\"2\">(%s)</font> <b>%s &lt;AUTO-REPLY&gt;:</b></font> %s<br/>\n"), date, from, msg_fixed);
577 } else if (type & GAIM_MESSAGE_RECV) { 578 } else if (type & GAIM_MESSAGE_RECV) {
578 if(gaim_message_meify(msg_fixed, -1)) 579 if(gaim_message_meify(msg_fixed, -1))
579 fprintf(data->file, "<font color=\"#6C2585\"><font size=\"2\">(%s)</font> <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n", 580 fprintf(data->file, "<font color=\"#6C2585\"><font size=\"2\">(%s)</font> <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n",
580 date, from, gc->prpl->info->name, msg_fixed); 581 date, from, prpl_name, msg_fixed);
581 else 582 else
582 fprintf(data->file, "<font color=\"#A82F2F\"><font size=\"2\">(%s)</font> <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", 583 fprintf(data->file, "<font color=\"#A82F2F\"><font size=\"2\">(%s)</font> <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n",
583 date, from, gc->prpl->info->name, msg_fixed); 584 date, from, prpl_name, msg_fixed);
584 } else if (type & GAIM_MESSAGE_SEND) { 585 } else if (type & GAIM_MESSAGE_SEND) {
585 if(gaim_message_meify(msg_fixed, -1)) 586 if(gaim_message_meify(msg_fixed, -1))
586 fprintf(data->file, "<font color=\"#6C2585\"><font size=\"2\">(%s)</font> <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n", 587 fprintf(data->file, "<font color=\"#6C2585\"><font size=\"2\">(%s)</font> <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n",
587 date, from, gc->prpl->info->name, msg_fixed); 588 date, from, prpl_name, msg_fixed);
588 else 589 else
589 fprintf(data->file, "<font color=\"#16569E\"><font size=\"2\">(%s)</font> <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", 590 fprintf(data->file, "<font color=\"#16569E\"><font size=\"2\">(%s)</font> <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n",
590 date, from, gc->prpl->info->name, msg_fixed); 591 date, from, prpl_name, msg_fixed);
591 } 592 }
592 } 593 }
593 594
594 g_free(msg_fixed); 595 g_free(msg_fixed);
595 fflush(data->file); 596 fflush(data->file);