pidgin: a8298f36: This is a combination of patches from da...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sun Feb 15 17:00:50 EST 2009


-----------------------------------------------------------------
Revision: a8298f36047255fb82e4fd453c6537d35b41fa77
Ancestor: 5157156e1664e8b92db86f44d78afb1866ddf268
Author: rekkanoryo at pidgin.im
Date: 2009-02-15T21:03:40
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a8298f36047255fb82e4fd453c6537d35b41fa77

Modified files:
        COPYRIGHT ChangeLog libpurple/protocols/simple/simple.c

ChangeLog: 

This is a combination of patches from darkrain42 and Marcus Sundberg to fix
some string handling issues in the SIMPLE prpl.  It also fixes some buddy name
handling issues.  Fixes #8128.

-------------- next part --------------
============================================================
--- COPYRIGHT	fd969506d8fdc63d34a1c7f93b96c759af0a7cee
+++ COPYRIGHT	18a4d0ee68b7f780c6281587592461f80746644b
@@ -421,6 +421,7 @@ Sun Microsystems
 Andreas St?hrk
 Oleg Sukhodolsky
 Sun Microsystems
+Marcus Sundberg
 M?rten Svantesson (fursten)
 Amir Szekely (kichik)
 Robert T.
============================================================
--- ChangeLog	9b192027d05c25a758145d011152a61343cda6f8
+++ ChangeLog	fd1137b74db38212a509c9bc77fc795924f7570b
@@ -10,6 +10,8 @@ version 2.5.5 (??/??/????):
 	* XMPP resources using __HOSTNAME__ substitution will now grab only the
 	  short hostname instead of the FQDN on systems which put the FQDN in
 	  the hostname (Mat?j Cepl)
+	* Fix some string handling in the SIMPLE prpl, which fixes some buddy name
+	  handling and other issues. (Paul Aurich, Marcus Sundberg)
 
 	ICQ:
 	* Fix retrieval of status messages from users of ICQ 6.x, Miranda, and
============================================================
--- libpurple/protocols/simple/simple.c	3b88cc06fa54cd7ddf2f5fe97c4826e83ba76e82
+++ libpurple/protocols/simple/simple.c	542b55b363aee7eaa2785f7a449700ceb8a9b4aa
@@ -196,7 +196,7 @@ static void simple_add_buddy(PurpleConne
 {
 	struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data;
 	struct simple_buddy *b;
-	if(strcmp("sip:", buddy->name)) {
+	if(strncmp(buddy->name, "sip:", 4)) {
 		gchar *buf = g_strdup_printf("sip:%s", buddy->name);
 		purple_blist_rename_buddy(buddy, buf);
 		g_free(buf);
@@ -834,10 +834,10 @@ static void simple_subscribe_exp(struct 
 		"Event: presence\r\n",
 		expiration);
 
-	if(strstr(buddy->name, "sip:"))
-		to = g_strdup(buddy->name);
+	if(strncmp(buddy->name, "sip:", 4))
+		to = g_strdup_printf("sip:%s", buddy->name);
 	else
-		to = g_strdup_printf("sip:%s", buddy->name);
+		to = g_strdup(buddy->name);
 
 	tmp = get_contact(sip);
 	contact = g_strdup_printf("%sContact: %s\r\n", tmp2, tmp);
@@ -881,7 +881,7 @@ static gboolean simple_add_lcs_contacts(
 
 
 	tmp = sipmsg_find_header(msg, "Event");
-	if(tmp && !strcmp(tmp, "vnd-microsoft-roaming-contacts")){
+	if(tmp && !strncmp(tmp, "vnd-microsoft-roaming-contacts", 30)){
 
 		purple_debug_info("simple", "simple_add_lcs_contacts->%s-%d\n", msg->body, len);
 		/*Convert the contact from XML to Purple Buddies*/
@@ -1013,11 +1013,11 @@ static void simple_send_message(struct s
 static void simple_send_message(struct simple_account_data *sip, const char *to, const char *msg, const char *type) {
 	gchar *hdr;
 	gchar *fullto;
-	if(strcmp("sip:", to)) {
+	if(strncmp(to, "sip:", 4))
 		fullto = g_strdup_printf("sip:%s", to);
-	} else {
+	else
 		fullto = g_strdup(to);
-	}
+
 	if(type) {
 		hdr = g_strdup_printf("Content-Type: %s\r\n", type);
 	} else {
@@ -1050,12 +1050,12 @@ static void process_incoming_message(str
 	purple_debug(PURPLE_DEBUG_MISC, "simple", "got message from %s: %s\n", from, msg->body);
 
 	contenttype = sipmsg_find_header(msg, "Content-Type");
-	if(!contenttype || !strcmp(contenttype, "text/plain") || !strcmp(contenttype, "text/html")) {
+	if(!contenttype || !strncmp(contenttype, "text/plain", 10) || !strncmp(contenttype, "text/html", 9)) {
 		serv_got_im(sip->gc, from, msg->body, 0, time(NULL));
 		send_sip_response(sip->gc, msg, 200, "OK", NULL);
 		found = TRUE;
 	}
-	else if(!strcmp(contenttype, "application/im-iscomposing+xml")) {
+	else if(!strncmp(contenttype, "application/im-iscomposing+xml", 30)) {
 		xmlnode *isc = xmlnode_from_str(msg->body, msg->bodylen);
 		xmlnode *state;
 		gchar *statedata;


More information about the Commits mailing list