changeset 2026:4bf0163563ca

[gaim-migrate @ 2036] evidently this will stop annoying winaim users. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 16 Jun 2001 01:17:36 +0000
parents 1bfef3e8ba63
children be42a5dc2f69
files libfaim/CHANGES libfaim/aim.h libfaim/misc.c
diffstat 3 files changed, 27 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES	Sat Jun 16 01:14:43 2001 +0000
+++ b/libfaim/CHANGES	Sat Jun 16 01:17:36 2001 +0000
@@ -1,6 +1,11 @@
 
 No release numbers
 ------------------
+ - Thu Jun 14 17:37:47 PDT 2001
+  - Rearrange aim_setprofile().  It will now let you _not_ send a profile,
+      if you really want to (pass NULL).  Note that this is quite different
+      than sending a _blank_ profile.  Also fixes the "asci" bug.
+
  - Mon Jun  4 12:57:46 PDT 2001
   - Fix chatnav.  Whoops.
 
--- a/libfaim/aim.h	Sat Jun 16 01:14:43 2001 +0000
+++ b/libfaim/aim.h	Sat Jun 16 01:17:36 2001 +0000
@@ -548,7 +548,7 @@
 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 *);
-faim_export unsigned long aim_bos_setprofile(struct aim_session_t *, struct aim_conn_t *, char *, char *, unsigned short);
+faim_export unsigned long aim_bos_setprofile(struct aim_session_t *sess, struct aim_conn_t *conn, const char *profile, const char *awaymsg, unsigned short caps);
 faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *, struct aim_conn_t *, u_long);
 faim_export unsigned long aim_bos_clientready(struct aim_session_t *, struct aim_conn_t *);
 faim_export unsigned long aim_bos_reqrate(struct aim_session_t *, struct aim_conn_t *);
--- a/libfaim/misc.c	Sat Jun 16 01:14:43 2001 +0000
+++ b/libfaim/misc.c	Sat Jun 16 01:17:36 2001 +0000
@@ -204,27 +204,35 @@
  */
 faim_export unsigned long aim_bos_setprofile(struct aim_session_t *sess,
 					     struct aim_conn_t *conn, 
-					     char *profile,
-					     char *awaymsg,
+					     const char *profile,
+					     const char *awaymsg,
 					     unsigned short caps)
 {
   struct command_tx_struct *newpacket;
   int i = 0, tmp, caplen;
+  static const char defencoding[] = {"text/aolrtf; charset=\"us-ascii\""};
 
-  if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 1152+strlen(profile)+1+(awaymsg?strlen(awaymsg):0))))
+  i = 10;
+  if (profile)
+    i += 4+strlen(defencoding)+4+strlen(profile);
+  if (awaymsg)
+    i += 4+strlen(defencoding)+4+strlen(awaymsg);
+  i += 4+512; /* for capabilities */
+
+  if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, i)))
     return -1;
 
-  i += aim_putsnac(newpacket->data, 0x0002, 0x004, 0x0000, sess->snac_nextid);
-  i += aim_puttlv_str(newpacket->data+i, 0x0001, strlen("text/aolrtf; charset=\"us-ascii\""), "text/x-aolrtf; charset=\"us-ascii\"");
-  i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(profile), profile);
-  /* why do we send this twice?  */
-  i += aim_puttlv_str(newpacket->data+i, 0x0003, strlen("text/aolrtf; charset=\"us-ascii\""), "text/x-aolrtf; charset=\"us-ascii\"");
-  
-  /* Away message -- we send this no matter what, even if its blank */
-  if (awaymsg)
+  i = aim_putsnac(newpacket->data, 0x0002, 0x004, 0x0000, sess->snac_nextid);
+
+  if (profile) {
+    i += aim_puttlv_str(newpacket->data+i, 0x0001, strlen(defencoding), defencoding);
+    i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(profile), profile);
+  }
+
+  if (awaymsg) {
+    i += aim_puttlv_str(newpacket->data+i, 0x0003, strlen(defencoding), defencoding);
     i += aim_puttlv_str(newpacket->data+i, 0x0004, strlen(awaymsg), awaymsg);
-  else
-    i += aim_puttlv_str(newpacket->data+i, 0x0004, 0x0000, NULL);
+  }
 
   /* Capability information. */