From: <ro...@us...> - 2006-07-02 22:58:35
|
Revision: 16403 Author: roast Date: 2006-07-02 15:58:30 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16403&view=rev Log Message: ----------- receiving a message from self detection fixed. normalizing all names; making no assumptions. Modified Paths: -------------- branches/soc-2006-file-loggers/src/log.c Modified: branches/soc-2006-file-loggers/src/log.c =================================================================== --- branches/soc-2006-file-loggers/src/log.c 2006-07-02 22:13:06 UTC (rev 16402) +++ branches/soc-2006-file-loggers/src/log.c 2006-07-02 22:58:30 UTC (rev 16403) @@ -1059,26 +1059,34 @@ written += fprintf(data->file, "\t<message time=\"%s\" sender=\"%s\" gaim:type=\"whisper\">%s</message>\n", date, from, msg_fixed); } else if (type & GAIM_MESSAGE_AUTO_RESP && (type & GAIM_MESSAGE_SEND || type & GAIM_MESSAGE_RECV)) { - gboolean selfsending = FALSE; - if (!g_ascii_strncasecmp(gaim_account_get_username(log->account), - gaim_account_get_username(log->conv->account), - strlen(gaim_account_get_username(log->account)))) { - selfsending = (type & GAIM_MESSAGE_RECV); + gboolean recv_from_self = FALSE; + if (type & GAIM_MESSAGE_RECV) { + char *from_normed = g_strdup(gaim_normalize(log->account, from)); + if (g_ascii_strncasecmp(from_normed, + gaim_normalize(log->account, gaim_account_get_username(log->account)), + strlen(from)) == 0) { + recv_from_self = TRUE; + g_free(from_normed); + } } written += fprintf(data->file, "\t<message time=\"%s\" sender=\"%s\"%s auto=\"true\">%s</message>\n", - date, from, selfsending ? " gaim:self=\"true\"" : "", msg_fixed); + date, from, recv_from_self ? " gaim:self=\"true\"" : "", msg_fixed); } else if (type & GAIM_MESSAGE_SEND || type & GAIM_MESSAGE_RECV) { - gboolean selfsending = FALSE; - if (!g_ascii_strncasecmp(gaim_account_get_username(log->account), - gaim_account_get_username(log->conv->account), - strlen(gaim_account_get_username(log->account)))) { - selfsending = (type & GAIM_MESSAGE_RECV); + gboolean recv_from_self = FALSE; + if (type & GAIM_MESSAGE_RECV) { + char *from_normed = g_strdup(gaim_normalize(log->account, from)); + if (g_ascii_strncasecmp(from_normed, + gaim_normalize(log->account, gaim_account_get_username(log->account)), + strlen(from)) == 0) { + recv_from_self = TRUE; + g_free(from_normed); + } } written += fprintf(data->file, "\t<message time=\"%s\" sender=\"%s\"%s>%s</message>\n", - date, from, selfsending ? " gaim:self=\"true\"" : "", msg_fixed); + date, from, recv_from_self ? " gaim:self=\"true\"" : "", msg_fixed); } else { gaim_debug_error("log", "Unhandled message type."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |