changeset 904:e1a7fc4482b9

[gaim-migrate @ 914] oscar can join empty chat rooms committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 14 Sep 2000 17:40:48 +0000
parents 16492f41410d
children 2876c40108cd
files libfaim/CHANGES.gaim libfaim/README.gaim src/gaim.h src/oscar.c src/server.c
diffstat 5 files changed, 62 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES.gaim	Thu Sep 14 17:12:27 2000 +0000
+++ b/libfaim/CHANGES.gaim	Thu Sep 14 17:40:48 2000 +0000
@@ -1,3 +1,7 @@
+
+Thu Sep 14 17:37:28 UTC 2000 EWarmenhoven
+	- libfaim has create room callback now, so you can create and join
+	  empty rooms.
 
 Tue Sep 12 22:58:13 UTC 2000 EWarmenhoven
 	- Added option to send flap_nop every minute
--- a/libfaim/README.gaim	Thu Sep 14 17:12:27 2000 +0000
+++ b/libfaim/README.gaim	Thu Sep 14 17:40:48 2000 +0000
@@ -47,6 +47,7 @@
  - talking
  - inviting someone
  - getting invited
+ - creating rooms (needed to join empty rooms)
  - refreshing the chatlist in the preferences dialog
 Direct IM (aka IM Image, for sounds and pictures)
 
@@ -55,7 +56,6 @@
 Telling the server who's on your permit/deny lists
 Chat:
  - whispering (this will never happen)
- - creating rooms (needed to join empty rooms)
 Getting/setting dir info
 Changing your password
 File Transfer (Get/Send)
--- a/src/gaim.h	Thu Sep 14 17:12:27 2000 +0000
+++ b/src/gaim.h	Thu Sep 14 17:40:48 2000 +0000
@@ -408,7 +408,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 912 $"
+#define REVISION "gaim:$Revision: 914 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -430,6 +430,8 @@
 extern struct aim_session_t *gaim_sess;
 extern struct aim_conn_t    *gaim_conn;
 extern GList *oscar_chats;
+extern int create_exchange;
+extern char *create_name;
 
 /* Globals in server.c */
 extern int correction_time;
--- a/src/oscar.c	Thu Sep 14 17:12:27 2000 +0000
+++ b/src/oscar.c	Thu Sep 14 17:40:48 2000 +0000
@@ -53,6 +53,8 @@
 		AIM_CAPS_VOICE | AIM_CAPS_IMIMAGE | AIM_CAPS_BUDDYICON;
 int USE_OSCAR = 0;
 int keepalv = -1;
+int create_exchange = 0;
+char *create_name = NULL;
 
 GList *oscar_chats = NULL;
 
@@ -901,6 +903,46 @@
 				debug_print(debug_buff);
 				i++;
 			}
+			if (create_exchange) {
+				sprintf(debug_buff, "creating room %s\n",
+						create_name);
+				debug_print(debug_buff);
+				aim_chatnav_createroom(sess, command->conn, create_name, create_exchange);
+				create_exchange = 0;
+				g_free(create_name);
+				create_name = NULL;
+			}
+			}
+			break;
+		case 0x0008: {
+			char *fqcn, *name, *ck;
+			u_short instance, flags, maxmsglen, maxoccupancy, unknown;
+			unsigned char createperms;
+			unsigned long createtime;
+
+			fqcn = va_arg(ap, char *);
+			instance = (u_short)va_arg(ap, u_int);
+			flags = (u_short)va_arg(ap, u_int);
+			createtime = va_arg(ap, unsigned long);
+			maxmsglen = (u_short)va_arg(ap, u_int);
+			maxoccupancy = (u_short)va_arg(ap, u_int);
+			createperms = va_arg(ap, unsigned char);
+			unknown = (u_short)va_arg(ap, u_int);
+			name = va_arg(ap, char *);
+			ck = va_arg(ap, char *);
+			va_end(ap);
+
+			sprintf(debug_buff, "created room: %s %d %d %lu %d %d %d %d %s %s\n", fqcn, instance, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck);
+			debug_print(debug_buff);
+			if (flags & 0x4) {
+				sprintf(debug_buff, "joining %s on exchange 5\n", name);
+				debug_print(debug_buff);
+				aim_chat_join(gaim_sess, gaim_conn, 5, ck);
+			} else 
+				sprintf(debug_buff, "joining %s on exchange 4\n", name);{
+				debug_print(debug_buff);
+				aim_chat_join(gaim_sess, gaim_conn, 4, ck);
+			}
 			}
 			break;
 		default:
@@ -1231,7 +1273,7 @@
 }
 
 void update_keepalive(gboolean on) {
-	if (on && keepalv < 0 && blist) {
+	if (on && keepalv < 0 && blist && (general_options & OPT_GEN_KEEPALIVE)) {
 		debug_print("allowing NOP\n");
 		keepalv = gtk_timeout_add(60000, (GtkFunction)send_keepalive, 0);
 	} else if (!on && keepalv > -1) {
--- a/src/server.c	Thu Sep 14 17:12:27 2000 +0000
+++ b/src/server.c	Thu Sep 14 17:40:48 2000 +0000
@@ -498,9 +498,19 @@
 	        g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name);
 	        sflap_send(buf, -1, TYPE_DATA);
 	} else {
+		struct aim_conn_t *cur = NULL;
 		sprintf(debug_buff, "Attempting to join chat room %s.\n", name);
 		debug_print(debug_buff);
-		aim_chat_join(gaim_sess, gaim_conn, exchange, name);
+		if ((cur = aim_getconn_type(gaim_sess, AIM_CONN_TYPE_CHATNAV))) {
+			debug_print("chatnav exists, creating room\n");
+			aim_chatnav_createroom(gaim_sess, cur, name, exchange);
+		} else {
+			/* this gets tricky */
+			debug_print("chatnav does not exist, opening chatnav\n");
+			create_exchange = exchange;
+			create_name = g_strdup(name);
+			aim_bos_reqservice(gaim_sess, gaim_conn, AIM_CONN_TYPE_CHATNAV);
+		}
 	}
 }