From: mid Date: Fri, 15 Jun 2001 00:46:44 +0000 (+0000) Subject: - Thu Jun 14 17:37:47 PDT 2001 X-Git-Tag: rel_0_99_2~33 X-Git-Url: http://andersk.mit.edu/gitweb/libfaim.git/commitdiff_plain/b309471db4d134ce1afd5f562034208b6fe50438 - 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. --- diff --git a/CHANGES b/CHANGES index bce2798..2b73234 100644 --- a/CHANGES +++ b/CHANGES @@ -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. diff --git a/include/aim.h b/include/aim.h index 16217d5..b2fd37b 100644 --- a/include/aim.h +++ b/include/aim.h @@ -548,7 +548,7 @@ faim_export unsigned long aim_flap_nop(struct aim_session_t *sess, struct aim_co 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 *); diff --git a/src/misc.c b/src/misc.c index 8b83e1e..0da3d0d 100644 --- a/src/misc.c +++ b/src/misc.c @@ -204,27 +204,35 @@ faim_export unsigned long aim_bos_setbuddylist(struct aim_session_t *sess, */ 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. */ diff --git a/utils/faimtest/faimtest.c b/utils/faimtest/faimtest.c index a121fb1..89b9857 100644 --- a/utils/faimtest/faimtest.c +++ b/utils/faimtest/faimtest.c @@ -505,6 +505,7 @@ int faimtest_rateresp(struct aim_session_t *sess, struct command_rx_struct *comm char buddies[128]; /* this is the new profile */ char profile[256]; + char awaymsg[] = {"blah blah blah Ole! blah blah blah"}; /* Caution: Buddy1 and Buddy2 are real people! (who I don't know) */ snprintf(buddies, sizeof(buddies), "Buddy1&Buddy2&%s&", ohcaptainmycaptain?ohcaptainmycaptain:"blah"); @@ -513,7 +514,7 @@ int faimtest_rateresp(struct aim_session_t *sess, struct command_rx_struct *comm aim_bos_ackrateresp(sess, command->conn); /* ack rate info response */ aim_bos_reqpersonalinfo(sess, command->conn); aim_bos_reqlocaterights(sess, command->conn); - aim_bos_setprofile(sess, command->conn, profile, NULL, AIM_CAPS_BUDDYICON | AIM_CAPS_CHAT | AIM_CAPS_GETFILE | AIM_CAPS_SENDFILE | AIM_CAPS_IMIMAGE /*| AIM_CAPS_GAMES | AIM_CAPS_SAVESTOCKS*/); + aim_bos_setprofile(sess, command->conn, profile, awaymsg, AIM_CAPS_BUDDYICON | AIM_CAPS_CHAT | AIM_CAPS_GETFILE | AIM_CAPS_SENDFILE | AIM_CAPS_IMIMAGE /*| AIM_CAPS_GAMES | AIM_CAPS_SAVESTOCKS*/); aim_bos_reqbuddyrights(sess, command->conn); /* send the buddy list and profile (required, even if empty) */