changeset 5917:a747e9e0e2cf

[gaim-migrate @ 6349] 2 compile fixes, one from a Herman mistake and one from a Luke-is-using-a- different-version-of-gettext-that-doesn't-have-as-much-psycho-checking-of- translation "mistake." Also, I made it so "Send File" and "Direct IM" do not show up in the right click menu unless the person is advertising that capability. This probably should have been done a long time ago. Also, some not-yet-used code for setting available messages. I'm working on it. Oh, and I found a new capability in iChat. I don't know what it does yet. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 18 Jun 2003 02:18:26 +0000
parents a51b709b2b3e
children 7134be4a319f
files plugins/iconaway.c po/ko.po src/protocols/oscar/aim.h src/protocols/oscar/info.c src/protocols/oscar/oscar.c src/protocols/oscar/service.c
diffstat 6 files changed, 139 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/iconaway.c	Wed Jun 18 01:32:39 2003 +0000
+++ b/plugins/iconaway.c	Wed Jun 18 02:18:26 2003 +0000
@@ -9,6 +9,8 @@
 
 #ifdef _WIN32
 __declspec(dllimport) GtkWidget *imaway;
+#else
+G_MODULE_IMPORT GtkWidget *imaway;
 #endif
 
 #ifdef USE_APPLET
--- a/po/ko.po	Wed Jun 18 01:32:39 2003 +0000
+++ b/po/ko.po	Wed Jun 18 02:18:26 2003 +0000
@@ -3929,7 +3929,7 @@
 
 #: src/dialogs.c:664
 msgid "Please enter the screenname of the person you would like to IM.\n"
-msgstr "¸Þ½ÅÀú·Î º¸³»·Á´Â »ó´ëÀÇ ¾ÆÀ̵𸦠³Ö¾î ÁֽʽÿÀ."
+msgstr "¸Þ½ÅÀú·Î º¸³»·Á´Â »ó´ëÀÇ ¾ÆÀ̵𸦠³Ö¾î ÁֽʽÿÀ.\n"
 
 #: src/dialogs.c:680 src/dialogs.c:786 src/dialogs.c:3789
 msgid "_Screenname:"
--- a/src/protocols/oscar/aim.h	Wed Jun 18 01:32:39 2003 +0000
+++ b/src/protocols/oscar/aim.h	Wed Jun 18 02:18:26 2003 +0000
@@ -198,6 +198,15 @@
 	"us", "en", \
 }
 
+#define CLIENTINFO_ICHAT_1_0 { \
+	"Apple iChat", \
+	0x311a, \
+	0x0001, 0x0000, \
+	0x0000, 0x003c, \
+	0x000000c6, \
+	"us", "en", \
+}
+
 /* Needs to be checked */
 #define CLIENTINFO_ICQ_4_65_3281 { \
 	"ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \
@@ -561,6 +570,13 @@
 faim_export aim_conn_t *aim_getconn_type_all(aim_session_t *, int type);
 faim_export aim_conn_t *aim_getconn_fd(aim_session_t *, int fd);
 
+
+
+/* service.c */
+faim_export int aim_srv_setavailmsg(aim_session_t *sess, char *msg);
+
+
+
 /* misc.c */
 
 #define AIM_VISIBILITYCHANGE_PERMITADD    0x05
@@ -992,7 +1008,8 @@
 #define AIM_CAPS_TRILLIANCRYPT	0x00010000
 #define AIM_CAPS_ICQUTF8	0x00020000
 #define AIM_CAPS_INTEROPERATE	0x00040000
-#define AIM_CAPS_LAST		0x00080000
+#define AIM_CAPS_ICHAT		0x00080000
+#define AIM_CAPS_LAST		0x00100000
 
 faim_export int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn);
 
--- a/src/protocols/oscar/info.c	Wed Jun 18 01:32:39 2003 +0000
+++ b/src/protocols/oscar/info.c	Wed Jun 18 02:18:26 2003 +0000
@@ -242,15 +242,12 @@
 } aim_caps[] = {
 
 	/*
-	 * Chat is oddball.
+	 * These are mostly in ascending numerical order.
 	 */
-	{AIM_CAPS_CHAT,
-	 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, 
+	{AIM_CAPS_ICHAT,
+	 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
-	/*
-	 * These are mostly in order.
-	 */
 	{AIM_CAPS_VOICE,
 	 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, 
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
@@ -328,6 +325,13 @@
 	  0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}},
 
 	/*
+	 * Chat is oddball.
+	 */
+	{AIM_CAPS_CHAT,
+	 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, 
+	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
+
+	/*
 	{AIM_CAPS_ICQ2GO,
 	 {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd,
 	  0x9f, 0x79, 0x42, 0x26, 0x09, 0xdf, 0xa2, 0xf3}},
@@ -343,7 +347,7 @@
 	  0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, */
 
 	{AIM_CAPS_APINFO, 
-         {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6,
+	 {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6,
 	  0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}},
 
 	{AIM_CAPS_TRILLIANCRYPT,
@@ -638,6 +642,9 @@
 			outinfo->sessionlen = aimbs_get32(bs);
 			outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN;
 
+		} else if (type == 0x0019) {
+			faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV type 0x0019: from %s\n", outinfo->sn);
+
 		} else if (type == 0x001d) {
 			/*
 			 * Type = 0x001d
--- a/src/protocols/oscar/oscar.c	Wed Jun 18 01:32:39 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Jun 18 02:18:26 2003 +0000
@@ -19,10 +19,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-/* No, he's right, real men do only communicate by cvs commits.
- */
-
 #include "internal.h"
 
 #include "account.h"
@@ -3868,8 +3864,8 @@
 	gaim_debug(GAIM_DEBUG_INFO, "oscar", "buddy list loaded\n");
 
 	aim_clientready(sess, fr->conn);
-
-	/* XXX - Should call aim_bos_setidle with 0x0000 */
+/*	aim_srv_setavailmsg(sess, NULL); */
+	aim_bos_setidle(sess, fr->conn, 0);
 
 	if (od->icq) {
 		aim_icq_reqofflinemsgs(sess);
@@ -5848,25 +5844,32 @@
 #endif
 	} else {
 		struct buddy *b = gaim_find_buddy(gc->account, who);
-
-		if ((aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who)) && GAIM_BUDDY_IS_ONLINE(b)) {
-			pbm = g_new0(struct proto_buddy_menu, 1);
-			pbm->label = _("Direct IM");
-			pbm->callback = oscar_ask_direct_im;
-			pbm->gc = gc;
-			m = g_list_append(m, pbm);
-
-			pbm = g_new0(struct proto_buddy_menu, 1);
-			pbm->label = _("Send File");
-			pbm->callback = oscar_ask_sendfile;
-			pbm->gc = gc;
-			m = g_list_append(m, pbm);
+		struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name));
+
+		if (b && bi && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) {
+			if (bi->caps & AIM_CAPS_IMIMAGE) {
+				pbm = g_new0(struct proto_buddy_menu, 1);
+				pbm->label = _("Direct IM");
+				pbm->callback = oscar_ask_direct_im;
+				pbm->gc = gc;
+				m = g_list_append(m, pbm);
+			}
+
+			if (bi->caps & AIM_CAPS_SENDFILE) {
+				pbm = g_new0(struct proto_buddy_menu, 1);
+				pbm->label = _("Send File");
+				pbm->callback = oscar_ask_sendfile;
+				pbm->gc = gc;
+				m = g_list_append(m, pbm);
+			}
 #if 0
-			pbm = g_new0(struct proto_buddy_menu, 1);
-			pbm->label = _("Get File");
-			pbm->callback = oscar_ask_getfile;
-			pbm->gc = gc;
-			m = g_list_append(m, pbm);
+			if (bi->caps & AIM_CAPS_GETFILE) {
+				pbm = g_new0(struct proto_buddy_menu, 1);
+				pbm->label = _("Get File");
+				pbm->callback = oscar_ask_getfile;
+				pbm->gc = gc;
+				m = g_list_append(m, pbm);
+			}
 #endif
 		}
 	}
@@ -6002,6 +6005,21 @@
 	g_free(text);
 }
 
+static void oscar_setavailmsg(GaimConnection *gc, char *text) {
+	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+
+	aim_srv_setavailmsg(od->sess, text);
+}
+
+static void oscar_show_setavailmsg(GaimConnection *gc)
+{
+	gaim_request_input(gc, NULL, _("Available Message:"),
+					   NULL, _("Please talk to me, I'm lonely! (and single)"), TRUE,
+					   _("OK"), G_CALLBACK(oscar_setavailmsg),
+					   _("Cancel"), NULL,
+					   gc);
+}
+
 static void oscar_show_chpassurl(GaimConnection *gc)
 {
 	struct oscar_data *od = gc->proto_data;
@@ -6052,6 +6070,14 @@
 	pam->gc = gc;
 	m = g_list_append(m, pam);
 
+#if 0
+	pam = g_new0(struct proto_actions_menu, 1);
+	pam->label = _("Set Available Message");
+	pam->callback = oscar_show_setavailmsg;
+	pam->gc = gc;
+	m = g_list_append(m, pam);
+#endif
+
 	pam = g_new0(struct proto_actions_menu, 1);
 	pam->label = _("Change Password");
 	pam->callback = show_change_passwd;
@@ -6070,7 +6096,7 @@
 		/* AIM actions */
 		m = g_list_append(m, NULL);
 
-	       	pam = g_new0(struct proto_actions_menu, 1);
+		pam = g_new0(struct proto_actions_menu, 1);
 		pam->label = _("Format Screenname");
 		pam->callback = oscar_show_format_screenname;
 		pam->gc = gc;
--- a/src/protocols/oscar/service.c	Wed Jun 18 01:32:39 2003 +0000
+++ b/src/protocols/oscar/service.c	Wed Jun 18 02:18:26 2003 +0000
@@ -734,9 +734,9 @@
 }
 
 /* 
- * Subtype 0x001e - Set Extended Status
+ * Subtype 0x001e - Extended Status
  *
- * Currently only works if using ICQ.
+ * Sets your ICQ status (available, away, do not disturb, etc.)
  *
  * These are the same TLVs seen in user info.  You can 
  * also set 0x0008 and 0x000c.
@@ -769,6 +769,55 @@
 	return 0;
 }
 
+/* 
+ * Subtype 0x001e - Extended Status.
+ *
+ * Sets your "available" message.  This is currently only supported by iChat 
+ * and Gaim.
+ *
+ * These are the same TLVs seen in user info.  You can 
+ * also set 0x0008 and 0x000c.
+ */
+faim_export int aim_srv_setavailmsg(aim_session_t *sess, char *msg)
+{
+	aim_conn_t *conn;
+	aim_frame_t *fr;
+	aim_snacid_t snacid;
+
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0001)))
+		return -EINVAL;
+
+	if (msg) {
+		if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + strlen(msg) + 2)))
+			return -ENOMEM;
+
+		snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0);
+		aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid);
+
+		aimbs_put16(&fr->data, 0x001d);
+		aimbs_put16(&fr->data, strlen(msg)+2);
+		aimbs_putraw(&fr->data, msg, strlen(msg));
+		aimbs_put16(&fr->data, 0x0000);
+	} else {
+		if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + 8)))
+			return -ENOMEM;
+
+		snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0);
+		aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid);
+
+		aimbs_put16(&fr->data, 0x001d);
+		aimbs_put16(&fr->data, 0x0008);
+		aimbs_put16(&fr->data, 0x0002);
+		aimbs_put16(&fr->data, 0x0404);
+		aimbs_put16(&fr->data, 0x0000);
+		aimbs_put16(&fr->data, 0x0000);
+	}
+
+	aim_tx_enqueue(sess, fr);
+
+	return 0;
+}
+
 /*
  * Starting this past week (26 Mar 2001, say), AOL has started sending
  * this nice little extra SNAC.  AFAIK, it has never been used until now.
@@ -976,7 +1025,8 @@
 			} break;
 		}
 	}
-		return ret;
+
+	return ret;
 }
 
 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)