Mercurial > pidgin.yaz
comparison src/protocols/oscar/oscar.c @ 8995:9caf796e74aa
[gaim-migrate @ 9770]
"Luke, if you get a chance, could you commit this? It should improve the
HTML escaping situation between Gaim and other AIM and ICQ clients. I haven't
actually applied it locally or tested it, but it looks ok to me. I would do
it myself, but there are other changes in my oscar.c that aren't ready to
commit, and I want to go to sleep so I can wake up tomorrow...
I'll probably be out of town climbing until Sunday night... "--Mark Doliner
"Below is an email I nearly sent you, before deciding to test & document the
failure cases I knew of.
http://www.nosnilmot.com/gaim/oscar-html.txt shows how current CVS behaves
sending the string "<foo>" between GaimICQ/GaimAIM/ICQLite/WinAIM in various
combinations After that testing I couldn't help trying to fix it :)
The attached patch, from my testing, resolves all those marked with "XX" so
that what is received matches what the user sent. The code might not be the
most efficient and may contain redundant bits but I've had enough of this
for now, 2 Windows crashes which caused VMWare to be weird and half break
my keyboard and require restarting X.
The patch might want a bit more testing, especially with iChat (I'm unable
to test with that). Maybe committing it to CVS might get it some more
testing though ;-)" --Stu Tomlinson
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 21 May 2004 11:55:08 +0000 |
parents | 294ae6548d4e |
children | 67421e0dc497 |
comparison
equal
deleted
inserted
replaced
8994:c5825a04fb97 | 8995:9caf796e74aa |
---|---|
3085 g_error_free(err); | 3085 g_error_free(err); |
3086 } | 3086 } |
3087 } | 3087 } |
3088 | 3088 |
3089 /* | 3089 /* |
3090 * If the message is being sent to an ICQ user then strip any HTML, | 3090 * If the message is being received by an ICQ user then escape any HTML, |
3091 * because HTML should not be sent over ICQ as a means to format a message. | 3091 * because HTML should is not sent over ICQ as a means to format a message. |
3092 * so any HTML we receive is intended to be displayed | |
3093 * | |
3094 * Note: There *may* be some clients which send messages as HTML formatted - | |
3095 * they need to be special-cased somehow. | |
3092 */ | 3096 */ |
3093 if (isdigit(gaim_account_get_username(account)[0])) { | 3097 if (isdigit(gaim_account_get_username(account)[0]) && isdigit(userinfo->sn[0])) { |
3094 gchar *tmp2 = gaim_markup_strip_html(tmp); | 3098 /* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */ |
3099 gchar *tmp2 = gaim_escape_html(tmp); | |
3095 g_free(tmp); | 3100 g_free(tmp); |
3096 tmp = tmp2; | 3101 tmp = tmp2; |
3097 } | 3102 } |
3098 | 3103 |
3099 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); | 3104 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); |
5150 | 5155 |
5151 /* | 5156 /* |
5152 * If we're IMing an ICQ user then send newlines as CR/LF and | 5157 * If we're IMing an ICQ user then send newlines as CR/LF and |
5153 * strip all HTML | 5158 * strip all HTML |
5154 */ | 5159 */ |
5155 if (isdigit(name[0])) { | 5160 if (isdigit(name[0]) ) { |
5156 tmpmsg2 = gaim_markup_strip_html(message); | 5161 /* being sent to an ICQ user */ |
5157 tmpmsg = gaim_str_add_cr(tmpmsg2); | 5162 if (!isdigit(gaim_account_get_username(gc->account)[0])) { |
5158 g_free(tmpmsg2); | 5163 /* from an AIM user - ICQ receiving from AIM *expects the messsage to be HTML formatted* */ |
5159 } else | 5164 tmpmsg = gaim_str_add_cr(message); |
5160 tmpmsg = gaim_strdup_withhtml(message); | 5165 } else { |
5166 /* from an ICQ user - do nothing */ | |
5167 tmpmsg = g_strdup(message); | |
5168 } | |
5169 } else { | |
5170 /* being sent to an AIM user */ | |
5171 if (isdigit(gaim_account_get_username(gc->account)[0])) { | |
5172 /* from an ICQ user */ | |
5173 tmpmsg2 = gaim_strdup_withhtml(message); | |
5174 tmpmsg = gaim_escape_html(tmpmsg2); | |
5175 g_free(tmpmsg2); | |
5176 } else | |
5177 tmpmsg = gaim_strdup_withhtml(message); | |
5178 } | |
5161 len = strlen(tmpmsg); | 5179 len = strlen(tmpmsg); |
5162 | 5180 |
5163 args.flags |= oscar_encoding_check(tmpmsg); | 5181 args.flags |= oscar_encoding_check(tmpmsg); |
5164 if (args.flags & AIM_IMFLAGS_UNICODE) { | 5182 if (args.flags & AIM_IMFLAGS_UNICODE) { |
5165 gaim_debug_info("oscar", "Sending Unicode IM\n"); | 5183 gaim_debug_info("oscar", "Sending Unicode IM\n"); |