im.pidgin.pidgin: f54573b65af85e75346c81a3b92d66dc8956d6f2

markdoliner at pidgin.im markdoliner at pidgin.im
Sun Dec 2 15:10:43 EST 2007


-----------------------------------------------------------------
Revision: f54573b65af85e75346c81a3b92d66dc8956d6f2
Ancestor: 0c8becc7bfae681339c2ffd4e38951ab922ee528
Author: markdoliner at pidgin.im
Date: 2007-12-02T20:02:53
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/oscar/oscar.c

ChangeLog: 

g_return_if_fail() if the chat room name or exchange aren't set or
don't meet the requirements specified by the proto_chat_entry.
It is the UI's responsibility to send the prpl valid chat room
parameters.

Fixes #4137.

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	5173447a84a424231ba2b32fee111c82a85bc97d
+++ libpurple/protocols/oscar/oscar.c	afe9df6349cd4f1054470af9aee4c79691c9c5f5
@@ -5352,26 +5352,29 @@ oscar_join_chat(PurpleConnection *gc, GH
 	OscarData *od = (OscarData *)gc->proto_data;
 	FlapConnection *conn;
 	char *name, *exchange;
+	int exchange_int;
 
 	name = g_hash_table_lookup(data, "room");
 	exchange = g_hash_table_lookup(data, "exchange");
 
-	if ((name == NULL) || (*name == '\0')) {
-		purple_notify_error(gc, NULL, _("Invalid chat name specified."), NULL);
-		return;
-	}
+	g_return_if_fail(name != NULL && *name != '\0');
+	g_return_if_fail(exchange != NULL);
 
+	errno = 0;
+	exchange_int = strtol(exchange, NULL, 10);
+	g_return_if_fail(errno == 0);
+
 	purple_debug_info("oscar", "Attempting to join chat room %s.\n", name);
 
 	if ((conn = flap_connection_getbytype(od, SNAC_FAMILY_CHATNAV)))
 	{
 		purple_debug_info("oscar", "chatnav exists, creating room\n");
-		aim_chatnav_createroom(od, conn, name, atoi(exchange));
+		aim_chatnav_createroom(od, conn, name, exchange_int);
 	} else {
 		/* this gets tricky */
 		struct create_room *cr = g_new0(struct create_room, 1);
 		purple_debug_info("oscar", "chatnav does not exist, opening chatnav\n");
-		cr->exchange = atoi(exchange);
+		cr->exchange = exchange_int;
 		cr->name = g_strdup(name);
 		od->create_rooms = g_slist_prepend(od->create_rooms, cr);
 		aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV);


More information about the Commits mailing list