changeset 891:fa2feef25e1e

[gaim-migrate @ 901] Oscar options? committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 12 Sep 2000 22:59:36 +0000
parents 1fd6a31679f3
children 36dcec9595ee
files libfaim/CHANGES libfaim/CHANGES.gaim libfaim/aim_misc.c libfaim/faim/aim.h src/buddy.c src/gaim.h src/oscar.c src/prefs.c
diffstat 8 files changed, 137 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES	Tue Sep 12 20:24:08 2000 +0000
+++ b/libfaim/CHANGES	Tue Sep 12 22:59:36 2000 +0000
@@ -1,6 +1,21 @@
 
 No release numbers
 ------------------
+ - Tue Sep 12 20:16:51 UTC 2000
+   - Add aim_flap_nop() from my work tree 
+
+ - Tue Sep 12 05:06:53 UTC 2000
+   - Revert the two-byte change in aim_misc, clientready
+
+ - Tue Sep  5 04:41:45 GMT 2000
+   - Few more minor things
+   - Added the changes needed for faimtest.
+   - Removed aimdebugd from default build
+
+ - Tue Sep  5 03:47:26 GMT 2000
+   - More ANSIfication for win32
+   - Forgot aim_misc last time.
+
  - Mon Sep  4 22:08:35 GMT 2000
    - Forgot aim_snac and aim_search
 
--- a/libfaim/CHANGES.gaim	Tue Sep 12 20:24:08 2000 +0000
+++ b/libfaim/CHANGES.gaim	Tue Sep 12 22:59:36 2000 +0000
@@ -1,3 +1,6 @@
+
+Tue Sep 12 22:58:13 UTC 2000 EWarmenhoven
+	- Added option to send flap_nop every minute
 
 Tue Sep 12 20:20:07 UTC 2000 EWarmenhoven
 	- Oscar works again. :)
--- a/libfaim/aim_misc.c	Tue Sep 12 20:24:08 2000 +0000
+++ b/libfaim/aim_misc.c	Tue Sep 12 22:59:36 2000 +0000
@@ -540,6 +540,29 @@
 }
 
 /*
+ * aim_flap_nop()
+ *
+ * No-op.  WinAIM 4.x sends these _every minute_ to keep
+ * the connection alive.  
+ */
+faim_export unsigned long aim_flap_nop(struct aim_session_t *sess,
+				       struct aim_conn_t *conn)
+{
+  struct command_tx_struct *newpacket;
+
+  if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0005, conn, 0)))
+    return sess->snac_nextid;
+
+  newpacket->lock = 1;
+  newpacket->commandlen = 0;
+  newpacket->lock = 0;
+
+  aim_tx_enqueue(sess, newpacket);
+
+  return (sess->snac_nextid);
+}
+
+/*
  * aim_bos_reqrights()
  *
  * Request BOS rights.
--- a/libfaim/faim/aim.h	Tue Sep 12 20:24:08 2000 +0000
+++ b/libfaim/faim/aim.h	Tue Sep 12 22:59:36 2000 +0000
@@ -503,6 +503,7 @@
 
 faim_export int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon);
 faim_export unsigned long aim_bos_nop(struct aim_session_t *, struct aim_conn_t *);
+faim_export unsigned long aim_flap_nop(struct aim_session_t *sess, struct aim_conn_t *conn);
 faim_export unsigned long aim_bos_setidle(struct aim_session_t *, struct aim_conn_t *, u_long);
 faim_export unsigned long aim_bos_changevisibility(struct aim_session_t *, struct aim_conn_t *, int, char *);
 faim_export unsigned long aim_bos_setbuddylist(struct aim_session_t *, struct aim_conn_t *, char *);
--- a/src/buddy.c	Tue Sep 12 20:24:08 2000 +0000
+++ b/src/buddy.c	Tue Sep 12 22:59:36 2000 +0000
@@ -294,6 +294,7 @@
 
 	sprintf(debug_buff, "date: %s\n", full_date());
 	debug_print(debug_buff);
+	update_keepalive(FALSE);
 	serv_close();
         destroy_all_dialogs();
         destroy_buddy();
--- a/src/gaim.h	Tue Sep 12 20:24:08 2000 +0000
+++ b/src/gaim.h	Tue Sep 12 22:59:36 2000 +0000
@@ -408,7 +408,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 895 $"
+#define REVISION "gaim:$Revision: 901 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -491,6 +491,7 @@
 #define OPT_GEN_CTL_CHARS	0x00080000
 #define OPT_GEN_TIK_HACK        0x00100000
 #define OPT_GEN_CTL_SMILEYS     0x00200000
+#define OPT_GEN_KEEPALIVE       0x00400000
 extern int USE_OSCAR;
 
 extern int display_options;
@@ -684,6 +685,7 @@
 extern void oscar_close();
 extern struct chat_connection *find_oscar_chat(char *name);
 extern void oscar_do_directim(char *);
+extern void update_keepalive(gboolean);
 
 /* Functions in toc.c */
 extern void toc_close();
--- a/src/oscar.c	Tue Sep 12 20:24:08 2000 +0000
+++ b/src/oscar.c	Tue Sep 12 22:59:36 2000 +0000
@@ -52,6 +52,7 @@
 int gaim_caps = AIM_CAPS_CHAT | AIM_CAPS_SENDFILE | AIM_CAPS_GETFILE |
 		AIM_CAPS_VOICE | AIM_CAPS_IMIMAGE | AIM_CAPS_BUDDYICON;
 int USE_OSCAR = 0;
+int keepalv = -1;
 
 GList *oscar_chats = NULL;
 
@@ -861,6 +862,9 @@
 		do_error_dialog(_("Your connection may be lost."),
 				_("AOL error"));
 
+	if (keepalv < 0)
+		update_keepalive(TRUE);
+
 	return 1;
 }
 
@@ -1217,3 +1221,22 @@
 	cnv->watcher = gdk_input_add(newconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, newconn);
 	aim_conn_addhandler(gaim_sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE, gaim_directim_initiate, 0);
 }
+
+void send_keepalive(gpointer d) {
+	debug_print("sending oscar NOP\n");
+	if (USE_OSCAR) { /* keeping it open for TOC */
+		aim_flap_nop(gaim_sess, gaim_conn);
+	} else {
+	}
+}
+
+void update_keepalive(gboolean on) {
+	if (on && keepalv < 0 && blist) {
+		debug_print("allowing NOP\n");
+		keepalv = gtk_timeout_add(60000, (GtkFunction)send_keepalive, 0);
+	} else if (!on && keepalv > -1) {
+		debug_print("removing NOP\n");
+		gtk_timeout_remove(keepalv);
+		keepalv = -1;
+	}
+}
--- a/src/prefs.c	Tue Sep 12 20:24:08 2000 +0000
+++ b/src/prefs.c	Tue Sep 12 22:59:36 2000 +0000
@@ -190,6 +190,34 @@
 	GtkWidget *parent;
 	GtkWidget *box;
 	GtkWidget *label;
+
+	parent = prefdialog->parent;
+	gtk_widget_destroy(prefdialog);
+
+	prefdialog = gtk_frame_new(_("TOC Options"));
+	gtk_container_add(GTK_CONTAINER(parent), prefdialog);
+	gtk_signal_connect(GTK_OBJECT(prefdialog), "destroy", GTK_SIGNAL_FUNC(connect_destroy), 0);
+
+	box = gtk_vbox_new(FALSE, 5);
+	gtk_container_add(GTK_CONTAINER(prefdialog), box);
+	gtk_widget_show(box);
+
+	label = gtk_label_new(_("AOL has two protocols for connecting to AIM. One of them is Oscar and the other is TOC.\n\nTOC is a published protocol; AOL allows people to use the TOC protocol in their clients to connect. It is a simplified version of Oscar; it is capable of most tasks, but cannot perform all of the functions of Oscar. Because TOC is published, using TOC in gaim tends to be more stable and reliable.\n\nOscar is a proprietary protocol. AOL has not published any information about it. Gaim is able to use Oscar thanks to libfaim, which reverse-engineered the Oscar protocol and is able to emulate it. While libfaim has not decoded or implemented all of the functions of Oscar, it is still able to perform most functions TOC provides as well as several others. However, using Oscar in gaim tends to be less stable and reliable, though more useable.\n\nChanging this option takes effect at signon time."));
+	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+	gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+	gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5);
+	gtk_widget_show(label);
+
+	gaim_button(_("Use Oscar Protocol"), &general_options, OPT_GEN_USE_OSCAR, box);
+
+	gtk_widget_show(prefdialog);
+}
+
+static void toc_page()
+{
+	GtkWidget *parent;
+	GtkWidget *box;
+	GtkWidget *label;
 	GtkWidget *sep;
 	GtkWidget *hbox;
 	GtkWidget *opt;
@@ -198,7 +226,7 @@
 	parent = prefdialog->parent;
 	gtk_widget_destroy(prefdialog);
 
-	prefdialog = gtk_frame_new(_("Connection Options"));
+	prefdialog = gtk_frame_new(_("TOC Options"));
 	gtk_container_add(GTK_CONTAINER(parent), prefdialog);
 	gtk_signal_connect(GTK_OBJECT(prefdialog), "destroy", GTK_SIGNAL_FUNC(connect_destroy), 0);
 
@@ -206,20 +234,6 @@
 	gtk_container_add(GTK_CONTAINER(prefdialog), box);
 	gtk_widget_show(box);
 
-	label = gtk_label_new(_("All options take effect immediately unless otherwise noted."));
-	gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5);
-	gtk_widget_show(label);
-
-	gaim_button(_("Use Oscar Protocol (experimental; only takes effect before signon)"), &general_options, OPT_GEN_USE_OSCAR, box);
-
-	sep = gtk_hseparator_new();
-	gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 5);
-	gtk_widget_show(sep);
-
-	label = gtk_label_new(_("The following options do not apply if you use Oscar."));
-	gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5);
-	gtk_widget_show(label);
-
 	hbox = gtk_hbox_new(FALSE, 0);
 	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
 	gtk_widget_show(hbox);
@@ -315,6 +329,31 @@
 	gtk_widget_show(prefdialog);
 }
 
+static void oscar_page()
+{
+	GtkWidget *parent;
+	GtkWidget *box;
+	GtkWidget *label;
+
+	parent = prefdialog->parent;
+	gtk_widget_destroy(prefdialog);
+
+	prefdialog = gtk_frame_new(_("Buddy List Options"));
+	gtk_container_add(GTK_CONTAINER(parent), prefdialog);
+
+	box = gtk_vbox_new(FALSE, 5);
+	gtk_container_add(GTK_CONTAINER(prefdialog), box);
+	gtk_widget_show(box);
+
+	label = gtk_label_new(_("All options take effect immediately unless otherwise noted."));
+	gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5);
+	gtk_widget_show(label);
+
+	gaim_button(_("Send Keep-Alive Packet (6 bytes/minute)"), &general_options, OPT_GEN_KEEPALIVE, box);
+
+	gtk_widget_show(prefdialog);
+}
+
 static void buddy_page()
 {
 	GtkWidget *parent;
@@ -1692,6 +1731,9 @@
        	if ((int)option == OPT_GEN_LOG_ALL)
        		update_log_convs();
 
+	if ((int)option == OPT_GEN_KEEPALIVE)
+		update_keepalive(general_options & OPT_GEN_KEEPALIVE);
+
 	if (prefrem)
 		gtk_signal_handler_block_by_data(GTK_OBJECT(prefrem), (int *)OPT_GEN_REMEMBER_PASS);
 	if (remember)
@@ -1777,13 +1819,23 @@
 
 void prefs_build_connect(GtkWidget *preftree)
 {
-	GtkCTreeNode *parent;
+	GtkCTreeNode *parent, *node;
 	char *text[1];
 
 	text[0] = _("Connection");
 	parent = gtk_ctree_insert_node(GTK_CTREE(preftree), NULL, NULL,
 					text, 5, NULL, NULL, NULL, NULL, 0, 1);
 	gtk_ctree_node_set_row_data(GTK_CTREE(preftree), parent, connect_page);
+
+	text[0] = _("TOC Options");
+	node = gtk_ctree_insert_node(GTK_CTREE(preftree), parent, NULL,
+					text, 5, NULL, NULL, NULL, NULL, 0, 1);
+	gtk_ctree_node_set_row_data(GTK_CTREE(preftree), node, toc_page);
+
+	text[0] = _("Oscar Options");
+	node = gtk_ctree_insert_node(GTK_CTREE(preftree), parent, NULL,
+					text, 5, NULL, NULL, NULL, NULL, 0, 1);
+	gtk_ctree_node_set_row_data(GTK_CTREE(preftree), node, oscar_page);
 }
 
 void prefs_build_buddy(GtkWidget *preftree)