comparison libpurple/util.c @ 25902:be3ba7e07de5

merge of '123d615deaa8daeeea7d7c341a87eab4e83a7958' and 'e3b2ac4f2d9e6a6bc13c0394f980b28a75765258'
author Kevin Stange <kevin@simguy.net>
date Tue, 06 Jan 2009 07:53:19 +0000
parents a6e3cb32cdd2
children 584063555949
comparison
equal deleted inserted replaced
25901:4670851af098 25902:be3ba7e07de5
1407 if(tag) { 1407 if(tag) {
1408 while(tags) { 1408 while(tags) {
1409 struct purple_parse_tag *pt = tags->data; 1409 struct purple_parse_tag *pt = tags->data;
1410 if(xhtml) 1410 if(xhtml)
1411 g_string_append_printf(xhtml, "</%s>", pt->dest_tag); 1411 g_string_append_printf(xhtml, "</%s>", pt->dest_tag);
1412 if(plain && !strcmp(pt->src_tag, "a")) { 1412 if(plain && purple_strequal(pt->src_tag, "a")) {
1413 /* if this is a link, we have to add the url to the plaintext, too */ 1413 /* if this is a link, we have to add the url to the plaintext, too */
1414 if (cdata && url && 1414 if (cdata && url &&
1415 (!g_string_equal(cdata, url) && (g_ascii_strncasecmp(url->str, "mailto:", 7) != 0 || 1415 (!g_string_equal(cdata, url) && (g_ascii_strncasecmp(url->str, "mailto:", 7) != 0 ||
1416 g_utf8_collate(url->str + 7, cdata->str) != 0))) 1416 g_utf8_collate(url->str + 7, cdata->str) != 0)))
1417 g_string_append_printf(plain, " <%s>", g_strstrip(url->str)); 1417 g_string_append_printf(plain, " <%s>", g_strstrip(url->str));
2947 if (tmp == NULL) 2947 if (tmp == NULL)
2948 return FALSE; 2948 return FALSE;
2949 g_free(tmp); 2949 g_free(tmp);
2950 2950
2951 session = g_getenv("KDE_FULL_SESSION"); 2951 session = g_getenv("KDE_FULL_SESSION");
2952 if (session != NULL && !strcmp(session, "true")) 2952 if (purple_strequal(session, "true"))
2953 return TRUE; 2953 return TRUE;
2954 2954
2955 /* If you run Purple from Konsole under !KDE, this will provide a 2955 /* If you run Purple from Konsole under !KDE, this will provide a
2956 * a false positive. Since we do the GNOME checks first, this is 2956 * a false positive. Since we do the GNOME checks first, this is
2957 * only a problem if you're running something !(KDE || GNOME) and 2957 * only a problem if you're running something !(KDE || GNOME) and
2988 2988
2989 2989
2990 /************************************************************************** 2990 /**************************************************************************
2991 * String Functions 2991 * String Functions
2992 **************************************************************************/ 2992 **************************************************************************/
2993 gboolean
2994 purple_strequal(const gchar *left, const gchar *right)
2995 {
2996 #if GLIB_CHECK_VERSION(2,16,0)
2997 return (g_strcmp0(left, right) == 0);
2998 #else
2999 return ((left == NULL && right == NULL) ||
3000 (left != NULL && right != NULL && strcmp(left, right) == 0));
3001 #endif
3002 }
3003
2993 const char * 3004 const char *
2994 purple_normalize(const PurpleAccount *account, const char *str) 3005 purple_normalize(const PurpleAccount *account, const char *str)
2995 { 3006 {
2996 const char *ret = NULL; 3007 const char *ret = NULL;
2997 static char buf[BUF_LEN]; 3008 static char buf[BUF_LEN];
3102 3113
3103 g_return_val_if_fail(s != NULL, FALSE); 3114 g_return_val_if_fail(s != NULL, FALSE);
3104 g_return_val_if_fail(x != NULL, FALSE); 3115 g_return_val_if_fail(x != NULL, FALSE);
3105 3116
3106 off = strlen(s) - strlen(x); 3117 off = strlen(s) - strlen(x);
3107 return (off >= 0 && !strcmp(s + off, x)); 3118 return (off >= 0 && purple_strequal(s + off, x));
3108 #endif 3119 #endif
3109 } 3120 }
3110 3121
3111 char * 3122 char *
3112 purple_str_add_cr(const char *text) 3123 purple_str_add_cr(const char *text)
4699 return buf; 4710 return buf;
4700 } 4711 }
4701 4712
4702 const char *_purple_oscar_convert(const char *act, const char *protocol) 4713 const char *_purple_oscar_convert(const char *act, const char *protocol)
4703 { 4714 {
4704 if (protocol && act && strcmp(protocol, "prpl-oscar") == 0) { 4715 if (act && purple_strequal(protocol, "prpl-oscar")) {
4705 int i; 4716 int i;
4706 for (i = 0; act[i] != '\0'; i++) 4717 for (i = 0; act[i] != '\0'; i++)
4707 if (!isdigit(act[i])) 4718 if (!isdigit(act[i]))
4708 return "prpl-aim"; 4719 return "prpl-aim";
4709 return "prpl-icq"; 4720 return "prpl-icq";