libpurple/protocols/jabber/message.c

branch
xmpp.custom_smiley
changeset 24259
e69d72917038
parent 24258
9ae10fafad7a
child 24386
0710eb7a41c5
equal deleted inserted replaced
24258:9ae10fafad7a 24259:e69d72917038
344 const gchar *alt = xmlnode_get_attrib(child, "alt"); 344 const gchar *alt = xmlnode_get_attrib(child, "alt");
345 ref->cid = temp_cid; 345 ref->cid = temp_cid;
346 /* if there is no "alt" string, use the cid... 346 /* if there is no "alt" string, use the cid...
347 include the entire src, eg. "cid:.." to avoid linkification */ 347 include the entire src, eg. "cid:.." to avoid linkification */
348 if (alt && alt[0] != '\0') { 348 if (alt && alt[0] != '\0') {
349 ref->alt = g_strdup(xmlnode_get_attrib(child, "alt")); 349 /* workaround for when "alt" is set to the value of the
350 CID (which Jabbim seems to do), to avoid it showing up
351 as an mailto: link */
352 if (purple_email_is_valid(alt)) {
353 ref->alt = g_strdup_printf("smiley:%s", alt);
354 } else {
355 ref->alt = g_strdup(alt);
356 }
350 } else { 357 } else {
351 ref->alt = g_strdup(src); 358 ref->alt = g_strdup(src);
352 } 359 }
353 g_hash_table_insert(table, temp_cid, ref); 360 g_hash_table_insert(table, temp_cid, ref);
354 } 361 }
422 if (g_str_has_prefix(src, "cid:")) { 429 if (g_str_has_prefix(src, "cid:")) {
423 const gchar *alt = xmlnode_get_attrib(img, "alt"); 430 const gchar *alt = xmlnode_get_attrib(img, "alt");
424 gchar *escaped = NULL; 431 gchar *escaped = NULL;
425 /* if the "alt" attribute is empty, put the cid as smiley string */ 432 /* if the "alt" attribute is empty, put the cid as smiley string */
426 if (alt && alt[0] != '\0') { 433 if (alt && alt[0] != '\0') {
427 escaped = g_markup_escape_text(alt, -1); 434 /* if the "alt" is the same as the CID, as Jabbim does,
428 out = g_string_append(out, escaped); 435 this prevents linkification... */
429 g_free(escaped); 436 if (purple_email_is_valid(alt)) {
437 const gchar *safe_alt = g_strdup_printf("smiley:%s", alt);
438 out = g_string_append(out, safe_alt);
439 g_free(safe_alt);
440 } else {
441 out = g_string_append(out, alt);
442 }
430 } else { 443 } else {
431 out = g_string_append(out, src); 444 out = g_string_append(out, src);
432 } 445 }
433 pos += pos2 - pos; 446 pos += pos2 - pos;
434 } else { 447 } else {

mercurial