aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/jabber_util.c
diff options
context:
space:
mode:
authorGRMrGecko <GRMrGecko@gmail.com>2014-07-24 00:51:07 -0300
committerdequis <dx@dxzone.com.ar>2014-07-24 00:51:07 -0300
commit757515a793748591e8689167e153ea9ff26ff9e5 (patch)
tree2854d3b3092a4e8d2e8454d9bb319ba87cca3cb3 /protocols/jabber/jabber_util.c
parent778ea8abdfd652afad44c3864f9bb02144ce39a0 (diff)
Added jabber_compare_jid to fix JID comparison case sensitivity
Diffstat (limited to 'protocols/jabber/jabber_util.c')
-rw-r--r--protocols/jabber/jabber_util.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c
index 67aa378a..f850e9d6 100644
--- a/protocols/jabber/jabber_util.c
+++ b/protocols/jabber/jabber_util.c
@@ -307,6 +307,28 @@ void jabber_buddy_ask( struct im_connection *ic, char *handle )
g_free( buf );
}
+/* Compares two Jabber IDs to check for match. */
+int jabber_compare_jid( const char *jid1, const char *jid2 )
+{
+ int i;
+
+ for( i = 0; ; i ++ )
+ {
+ if( jid1[i] == '\0' || jid1[i] == '/' || jid2[i] == '\0' || jid2[i] == '/' )
+ {
+ if( ( jid1[i] == '\0' || jid1[i] == '/' ) && ( jid2[i] == '\0' || jid2[i] == '/' ) )
+ break;
+ return FALSE;
+ }
+ if( tolower( jid1[i] ) != tolower( jid2[i] ) )
+ {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
/* Returns a new string. Don't leak it! */
char *jabber_normalize( const char *orig )
{