diff libpurple/protocols/simple/simple.c @ 25237:401f548e3544

propagate from branch 'im.pidgin.pidgin' (head df6eba32e5b6b34d7483cbfb7e9f2e4c836ac35f) to branch 'org.darkrain42.pidgin.buddy-add' (head 6831808999a270f8c1a128c7430a73d3dc0bfae2)
author Paul Aurich <paul@darkrain42.org>
date Sun, 21 Dec 2008 18:32:37 +0000
parents 49f0e5dbeeed
children d378f05079e4 f0c2e27c7ae7 138c729f8c9a
line wrap: on
line diff
--- a/libpurple/protocols/simple/simple.c	Sat Nov 29 18:46:49 2008 +0000
+++ b/libpurple/protocols/simple/simple.c	Sun Dec 21 18:32:37 2008 +0000
@@ -196,7 +196,7 @@
 {
 	struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data;
 	struct simple_buddy *b;
-	if(strncmp("sip:", buddy->name, 4)) {
+	if(strcmp("sip:", buddy->name)) {
 		gchar *buf = g_strdup_printf("sip:%s", buddy->name);
 		purple_blist_rename_buddy(buddy, buf);
 		g_free(buf);
@@ -881,7 +881,7 @@
 
 
 	tmp = sipmsg_find_header(msg, "Event");
-	if(tmp && !strncmp(tmp, "vnd-microsoft-roaming-contacts", 30)){
+	if(tmp && !strcmp(tmp, "vnd-microsoft-roaming-contacts")){
 
 		purple_debug_info("simple", "simple_add_lcs_contacts->%s-%d\n", msg->body, len);
 		/*Convert the contact from XML to Purple Buddies*/
@@ -1013,7 +1013,7 @@
 static void simple_send_message(struct simple_account_data *sip, const char *to, const char *msg, const char *type) {
 	gchar *hdr;
 	gchar *fullto;
-	if(strncmp("sip:", to, 4)) {
+	if(strcmp("sip:", to)) {
 		fullto = g_strdup_printf("sip:%s", to);
 	} else {
 		fullto = g_strdup(to);
@@ -1050,12 +1050,12 @@
 	purple_debug(PURPLE_DEBUG_MISC, "simple", "got message from %s: %s\n", from, msg->body);
 
 	contenttype = sipmsg_find_header(msg, "Content-Type");
-	if(!contenttype || !strncmp(contenttype, "text/plain", 10) || !strncmp(contenttype, "text/html", 9)) {
+	if(!contenttype || !strcmp(contenttype, "text/plain") || !strcmp(contenttype, "text/html")) {
 		serv_got_im(sip->gc, from, msg->body, 0, time(NULL));
 		send_sip_response(sip->gc, msg, 200, "OK", NULL);
 		found = TRUE;
 	}
-	if(!strncmp(contenttype, "application/im-iscomposing+xml", 30)) {
+	else if(!strcmp(contenttype, "application/im-iscomposing+xml")) {
 		xmlnode *isc = xmlnode_from_str(msg->body, msg->bodylen);
 		xmlnode *state;
 		gchar *statedata;
@@ -1077,8 +1077,10 @@
 
 		statedata = xmlnode_get_data(state);
 		if(statedata) {
-			if(strstr(statedata, "active")) serv_got_typing(sip->gc, from, 0, PURPLE_TYPING);
-			else serv_got_typing_stopped(sip->gc, from);
+			if(strstr(statedata, "active"))
+				serv_got_typing(sip->gc, from, 0, PURPLE_TYPING);
+			else
+				serv_got_typing_stopped(sip->gc, from);
 
 			g_free(statedata);
 		}
@@ -1937,6 +1939,14 @@
 		sip->txbuf = purple_circ_buffer_new(0);
 
 	userserver = g_strsplit(username, "@", 2);
+	if (userserver[1] == NULL || userserver[1][0] == '\0') {
+		purple_connection_error_reason(gc,
+			PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
+			_("Unable to connect to server. Please enter the "
+			  "address of the server you wish to connect to."));
+		return;
+	}
+
 	purple_connection_set_display_name(gc, userserver[0]);
 	sip->username = g_strdup(userserver[0]);
 	sip->servername = g_strdup(userserver[1]);