changeset 931:59d9e1177ab5

[gaim-migrate @ 941] yay! let's recompile everything, again! committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 20 Sep 2000 23:35:17 +0000
parents a88af4cc626a
children 13bdc97d433e
files libfaim/CHANGES libfaim/CHANGES.gaim libfaim/README.gaim libfaim/aim_info.c libfaim/aim_misc.c libfaim/faim/aim.h src/server.c
diffstat 7 files changed, 154 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES	Wed Sep 20 23:04:48 2000 +0000
+++ b/libfaim/CHANGES	Wed Sep 20 23:35:17 2000 +0000
@@ -1,6 +1,10 @@
 
 No release numbers
 ------------------
+ - Tue Sep 19 03:10:07 UTC 2000
+   - Add aim_setuserinterests() and aim_setdirectoryinfo()
+   - Add ICQ away status
+
  - Thu Sep 14 00:54:48 UTC 2000
    - Added create room callback
 
--- a/libfaim/CHANGES.gaim	Wed Sep 20 23:04:48 2000 +0000
+++ b/libfaim/CHANGES.gaim	Wed Sep 20 23:35:17 2000 +0000
@@ -1,3 +1,8 @@
+
+Wed Sep 20 23:30:32 UTC 2000 EWarmenhoven
+	- libfaim does dir info now
+	- for those wishing to use gaim as an ICQ client, libfaim took one
+	  step closer to that. but gaim hasn't taken the corresponding step.
 
 Thu Sep 14 17:37:28 UTC 2000 EWarmenhoven
 	- libfaim has create room callback now, so you can create and join
--- a/libfaim/README.gaim	Wed Sep 20 23:04:48 2000 +0000
+++ b/libfaim/README.gaim	Wed Sep 20 23:35:17 2000 +0000
@@ -40,6 +40,7 @@
 Setting your info
 Getting users' info
 Getting users' away messages
+Setting your dir info
 Warning users/getting warned
 Chat:
  - joining rooms
@@ -56,7 +57,7 @@
 Telling the server who's on your permit/deny lists
 Chat:
  - whispering (this will never happen)
-Getting/setting dir info
+Getting dir info
 Changing your password
 File Transfer (Get/Send)
 Voice Chat
--- a/libfaim/aim_info.c	Wed Sep 20 23:04:48 2000 +0000
+++ b/libfaim/aim_info.c	Wed Sep 20 23:35:17 2000 +0000
@@ -314,6 +314,18 @@
       break;
       
       /*
+       * Type = 0x0006: ICQ Online Status
+       *
+       * ICQ's Away/DND/etc "enriched" status
+       * Some decoding of values done by Scott <darkagl@pcnet.com>
+       */
+    case 0x0006:
+      if (aimutil_get16(buf+i+2) != 0x04)
+	break;
+      outinfo->icqinfo.status = aimutil_get16(buf+i+2+2+2);
+      break;
+
+      /*
        * Type = 0x000d
        *
        * Capability information.  Not real sure of
--- a/libfaim/aim_misc.c	Wed Sep 20 23:04:48 2000 +0000
+++ b/libfaim/aim_misc.c	Wed Sep 20 23:35:17 2000 +0000
@@ -774,3 +774,118 @@
 
   return (sess->snac_nextid);
 }
+
+/* 
+ * Set directory profile data (not the same as aim_bos_setprofile!)
+ */
+faim_export unsigned long aim_setdirectoryinfo(struct aim_session_t *sess, struct aim_conn_t *conn, char *first, char *middle, char *last, char *maiden, char *nickname, char *street, char *city, char *state, char *zip, int country, unsigned short privacy) 
+{
+  struct command_tx_struct *newpacket;
+  int packlen = 0, i = 0;
+
+  packlen += 2+2+2;
+
+  if(first) /* TLV 0001 */
+    packlen += (strlen(first) + 4);
+  if(middle) 
+    packlen += (strlen(middle) + 4);
+  if(last)
+    packlen += (strlen(last) + 4);
+  if(maiden)
+    packlen += (strlen(maiden) + 4);
+  if(nickname)
+    packlen += (strlen(nickname) + 4);
+  if(street)
+    packlen += (strlen(street) + 4);
+  if(state)
+    packlen += (strlen(state) + 4);
+  if(city)
+    packlen += (strlen(city) + 4);
+  if(zip)
+    packlen += (strlen(zip) + 4);
+    
+  if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen+10)))
+    return -1;
+
+  newpacket->lock = 1;
+
+  i = aim_putsnac(newpacket->data, 0x0002, 0x0009, 0x0000, 0);
+
+  /* 000a/0002: privacy: 1 to allow search/disp, 0 to disallow */
+  i += aim_puttlv_16(newpacket->data+i, 0x000a, privacy);
+
+
+  if (first)
+    i += aim_puttlv_str(newpacket->data+i, 0x0001, strlen(first), first);
+  if (middle)
+    i += aim_puttlv_str(newpacket->data+i, 0x0003, strlen(middle), middle);
+  if (last)
+    i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(last), last);
+  if (maiden)
+    i += aim_puttlv_str(newpacket->data+i, 0x0004, strlen(maiden), maiden);
+  if (nickname)
+    i += aim_puttlv_str(newpacket->data+i, 0x000c, strlen(nickname), nickname);
+  if (street)
+    i += aim_puttlv_str(newpacket->data+i, 0x0021, strlen(street), street);
+  if (city)
+    i += aim_puttlv_str(newpacket->data+i, 0x0008, strlen(city), city);
+  if (state)
+    i += aim_puttlv_str(newpacket->data+i, 0x0007, strlen(state), state);
+  if (zip)
+    i += aim_puttlv_str(newpacket->data+i, 0x000d, strlen(zip), zip);
+
+  newpacket->commandlen = i;
+  newpacket->lock = 0;
+
+  aim_tx_enqueue(sess, newpacket);
+   
+  return(sess->snac_nextid);
+}
+
+faim_export unsigned long aim_setuserinterests(struct aim_session_t *sess, struct aim_conn_t *conn, char *interest1, char *interest2, char *interest3, char *interest4, char *interest5, unsigned short privacy)
+{
+  struct command_tx_struct *newpacket;
+  int packlen = 0, i = 0;
+
+  packlen += 2+2+2;
+
+  if(interest1)
+    packlen += (strlen(interest1) + 4);
+  if(interest2)
+    packlen += (strlen(interest2) + 4);
+  if(interest3)
+    packlen += (strlen(interest3) + 4);
+  if(interest4)
+    packlen += (strlen(interest4) + 4);
+  if(interest5)
+    packlen += (strlen(interest5) + 4) ;
+
+    
+  if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen+10)))
+    return -1;
+
+  newpacket->lock = 1;
+
+  i = aim_putsnac(newpacket->data, 0x0002, 0x000f, 0x0000, 0);
+
+  /* 000a/0002: 0000 ?? ?privacy? */
+  i += aim_puttlv_16(newpacket->data+i, 0x000a, privacy); 
+
+  if(interest1) 
+    i += aim_puttlv_str(newpacket->data+i, 0x000b, strlen(interest1), interest1);
+  if(interest2) 
+    i += aim_puttlv_str(newpacket->data+i, 0x000b, strlen(interest2), interest2);
+  if(interest3) 
+    i += aim_puttlv_str(newpacket->data+i, 0x000b, strlen(interest3), interest3);
+  if(interest4) 
+    i += aim_puttlv_str(newpacket->data+i, 0x000b, strlen(interest4), interest4);
+  if(interest5) 
+    i += aim_puttlv_str(newpacket->data+i, 0x000b, strlen(interest1), interest5);
+
+  newpacket->commandlen = i;
+  newpacket->lock = 0;
+    
+  aim_tx_enqueue(sess, newpacket);
+    
+  return(sess->snac_nextid);
+}
--- a/libfaim/faim/aim.h	Wed Sep 20 23:04:48 2000 +0000
+++ b/libfaim/faim/aim.h	Wed Sep 20 23:35:17 2000 +0000
@@ -347,6 +347,9 @@
   u_long onlinesince;
   u_long sessionlen;  
   u_short capabilities;
+  struct {
+    unsigned short status;
+  } icqinfo;
 };
 
 #define AIM_FLAG_UNCONFIRMED 	0x0001 /* "damned transients" */
@@ -522,6 +525,8 @@
 faim_export unsigned long aim_bos_reqicbmparaminfo(struct aim_session_t *, struct aim_conn_t *);
 faim_export unsigned long aim_addicbmparam(struct aim_session_t *sess,struct aim_conn_t *conn);
 faim_export unsigned long aim_setversions(struct aim_session_t *sess, struct aim_conn_t *conn);
+faim_export unsigned long aim_setdirectoryinfo(struct aim_session_t *sess, struct aim_conn_t *conn, char *first, char *middle, char *last, char *maiden, char *nickname, char *street, char *city, char *state, char *zip, int country, unsigned short privacy);
+faim_export unsigned long aim_setuserinterests(struct aim_session_t *sess, struct aim_conn_t *conn, char *interest1, char *interest2, char *interest3, char *interest4, char *interest5, unsigned short privacy);
 
 faim_internal struct aim_fileheader_t *aim_getlisting(struct aim_session_t*);
 faim_internal int aim_listenestablish(u_short);
--- a/src/server.c	Wed Sep 20 23:04:48 2000 +0000
+++ b/src/server.c	Wed Sep 20 23:35:17 2000 +0000
@@ -197,13 +197,17 @@
 		  char *city, char *state, char *country, int web)
 {
 	if (!USE_OSCAR) {
-	char buf2[BUF_LEN*4], buf[BUF_LEN];
-	g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first,
-		   middle, last, maiden, city, state, country,
-		   (web == 1) ? "Y" : "");
-	escape_text(buf2);
-	g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2);
-	sflap_send(buf, -1, TYPE_DATA);
+		char buf2[BUF_LEN*4], buf[BUF_LEN];
+		g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first,
+			   middle, last, maiden, city, state, country,
+			   (web == 1) ? "Y" : "");
+		escape_text(buf2);
+		g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2);
+		sflap_send(buf, -1, TYPE_DATA);
+	} else {
+		/* FIXME : some of these things are wrong, but i'm lazy */
+		aim_setdirectoryinfo(gaim_sess, gaim_conn, first, middle, last,
+				maiden, NULL, NULL, city, state, NULL, 0, web);
 	}
 }