5 * TODO: Seperate a lot of this into an aim_bos.c.
20 * Should set your current idle time in seconds. Idealy, OSCAR should
21 * do this for us. But, it doesn't. The client must call this to set idle
25 faim_export unsigned long aim_bos_setidle(struct aim_session_t *sess,
26 struct aim_conn_t *conn,
29 return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime);
34 * aim_bos_changevisibility(conn, changtype, namelist)
36 * Changes your visibility depending on changetype:
38 * AIM_VISIBILITYCHANGE_PERMITADD: Lets provided list of names see you
39 * AIM_VISIBILITYCHANGE_PERMIDREMOVE: Removes listed names from permit list
40 * AIM_VISIBILITYCHANGE_DENYADD: Hides you from provided list of names
41 * AIM_VISIBILITYCHANGE_DENYREMOVE: Lets list see you again
43 * list should be a list of
44 * screen names in the form "Screen Name One&ScreenNameTwo&" etc.
46 * Equivelents to options in WinAIM:
47 * - Allow all users to contact me: Send an AIM_VISIBILITYCHANGE_DENYADD
48 * with only your name on it.
49 * - Allow only users on my Buddy List: Send an
50 * AIM_VISIBILITYCHANGE_PERMITADD with the list the same as your
52 * - Allow only the uesrs below: Send an AIM_VISIBILITYCHANGE_PERMITADD
53 * with everyone listed that you want to see you.
54 * - Block all users: Send an AIM_VISIBILITYCHANGE_PERMITADD with only
55 * yourself in the list
56 * - Block the users below: Send an AIM_VISIBILITYCHANGE_DENYADD with
57 * the list of users to be blocked
61 faim_export unsigned long aim_bos_changevisibility(struct aim_session_t *sess,
62 struct aim_conn_t *conn,
66 struct command_tx_struct *newpacket;
70 char *localcpy = NULL;
78 localcpy = (char *) malloc(strlen(denylist)+1);
79 memcpy(localcpy, denylist, strlen(denylist)+1);
81 listcount = aimutil_itemcnt(localcpy, '&');
82 packlen = aimutil_tokslen(localcpy, 99, '&') + listcount + 9;
84 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen)))
91 case AIM_VISIBILITYCHANGE_PERMITADD: subtype = 0x05; break;
92 case AIM_VISIBILITYCHANGE_PERMITREMOVE: subtype = 0x06; break;
93 case AIM_VISIBILITYCHANGE_DENYADD: subtype = 0x07; break;
94 case AIM_VISIBILITYCHANGE_DENYREMOVE: subtype = 0x08; break;
96 free(newpacket->data);
101 /* We actually DO NOT send a SNAC ID with this one! */
102 aim_putsnac(newpacket->data, 0x0009, subtype, 0x00, 0);
104 j = 10; /* the next byte */
106 for (i=0; (i < (listcount - 1)) && (i < 99); i++)
108 tmpptr = aimutil_itemidx(localcpy, i, '&');
110 newpacket->data[j] = strlen(tmpptr);
111 memcpy(&(newpacket->data[j+1]), tmpptr, strlen(tmpptr));
112 j += strlen(tmpptr)+1;
119 aim_tx_enqueue(sess, newpacket);
121 return (sess->snac_nextid); /* dont increment */
128 * aim_bos_setbuddylist(buddylist)
130 * This just builds the "set buddy list" command then queues it.
132 * buddy_list = "Screen Name One&ScreenNameTwo&";
134 * TODO: Clean this up.
136 * XXX: I can't stress the TODO enough.
139 faim_export unsigned long aim_bos_setbuddylist(struct aim_session_t *sess,
140 struct aim_conn_t *conn,
145 struct command_tx_struct *newpacket;
149 char *localcpy = NULL;
152 len = 10; /* 10B SNAC headers */
154 if (!buddy_list || !(localcpy = (char *) malloc(strlen(buddy_list)+1)))
156 strncpy(localcpy, buddy_list, strlen(buddy_list)+1);
159 tmpptr = strtok(localcpy, "&");
160 while ((tmpptr != NULL) && (i < 150)) {
162 printf("---adding %d: %s (%d)\n", i, tmpptr, strlen(tmpptr));
164 len += 1+strlen(tmpptr);
166 tmpptr = strtok(NULL, "&");
169 printf("*** send buddy list len: %d (%x)\n", len, len);
172 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, len)))
177 aim_putsnac(newpacket->data, 0x0003, 0x0004, 0x0000, 0);
179 j = 10; /* the next byte */
181 strncpy(localcpy, buddy_list, strlen(buddy_list)+1);
183 tmpptr = strtok(localcpy, "&");
184 while ((tmpptr != NULL) & (i < 150)) {
186 printf("---adding %d: %s (%d)\n", i, tmpptr, strlen(tmpptr));
188 newpacket->data[j] = strlen(tmpptr);
189 memcpy(&(newpacket->data[j+1]), tmpptr, strlen(tmpptr));
190 j += 1+strlen(tmpptr);
192 tmpptr = strtok(NULL, "&");
197 aim_tx_enqueue(sess, newpacket);
201 return (sess->snac_nextid);
205 * aim_bos_setprofile(profile)
207 * Gives BOS your profile.
211 faim_export unsigned long aim_bos_setprofile(struct aim_session_t *sess,
212 struct aim_conn_t *conn,
217 struct command_tx_struct *newpacket;
218 int i = 0, tmp, caplen;
220 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 1152+strlen(profile)+1+(awaymsg?strlen(awaymsg):0))))
223 i += aim_putsnac(newpacket->data, 0x0002, 0x004, 0x0000, sess->snac_nextid);
224 i += aim_puttlv_str(newpacket->data+i, 0x0001, strlen("text/x-aolrtf; charset=\"us-ascii\""), "text/x-aolrtf; charset=\"us-ascii\"");
225 i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(profile), profile);
226 /* why do we send this twice? */
227 i += aim_puttlv_str(newpacket->data+i, 0x0003, strlen("text/x-aolrtf; charset=\"us-ascii\""), "text/x-aolrtf; charset=\"us-ascii\"");
229 /* Away message -- we send this no matter what, even if its blank */
231 i += aim_puttlv_str(newpacket->data+i, 0x0004, strlen(awaymsg), awaymsg);
233 i += aim_puttlv_str(newpacket->data+i, 0x0004, 0x0000, NULL);
235 /* Capability information. */
237 tmp = (i += aimutil_put16(newpacket->data+i, 0x0005));
238 i += aimutil_put16(newpacket->data+i, 0x0000); /* rewritten later */
239 i += (caplen = aim_putcap(newpacket->data+i, 512, caps));
240 aimutil_put16(newpacket->data+tmp, caplen); /* rewrite TLV size */
242 newpacket->commandlen = i;
243 aim_tx_enqueue(sess, newpacket);
245 return (sess->snac_nextid++);
249 * aim_bos_setgroupperm(mask)
251 * Set group permisson mask. Normally 0x1f (all classes).
253 * The group permission mask allows you to keep users of a certain
254 * class or classes from talking to you. The mask should be
255 * a bitwise OR of all the user classes you want to see you.
258 faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *sess,
259 struct aim_conn_t *conn,
262 return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask);
265 faim_internal int aim_parse_bosrights(struct aim_session_t *sess,
266 struct command_rx_struct *command, ...)
268 rxcallback_t userfunc = NULL;
270 struct aim_tlvlist_t *tlvlist;
271 unsigned short maxpermits = 0, maxdenies = 0;
276 if (!(tlvlist = aim_readtlvchain(command->data+10, command->commandlen-10)))
280 * TLV type 0x0001: Maximum number of buddies on permit list.
282 if (aim_gettlv(tlvlist, 0x0001, 1))
283 maxpermits = aim_gettlv16(tlvlist, 0x0001, 1);
286 * TLV type 0x0002: Maximum number of buddies on deny list.
289 if (aim_gettlv(tlvlist, 0x0002, 1))
290 maxdenies = aim_gettlv16(tlvlist, 0x0002, 1);
292 if ((userfunc = aim_callhandler(command->conn, 0x0009, 0x0003)))
293 ret = userfunc(sess, command, maxpermits, maxdenies);
295 aim_freetlvchain(&tlvlist);
301 * aim_bos_clientready()
306 faim_export unsigned long aim_bos_clientready(struct aim_session_t *sess,
307 struct aim_conn_t *conn)
309 struct aim_tool_version tools[] = {
310 {0x0001, 0x0003, AIM_TOOL_WIN32, 0x0686},
311 {0x0002, 0x0001, AIM_TOOL_WIN32, 0x0001},
312 {0x0003, 0x0001, AIM_TOOL_WIN32, 0x0001},
313 {0x0004, 0x0001, AIM_TOOL_WIN32, 0x0001},
314 {0x0006, 0x0001, AIM_TOOL_WIN32, 0x0001},
315 {0x0008, 0x0001, AIM_TOOL_WIN32, 0x0001},
316 {0x0009, 0x0001, AIM_TOOL_WIN32, 0x0001},
317 {0x000a, 0x0001, AIM_TOOL_WIN32, 0x0001},
318 {0x000b, 0x0001, AIM_TOOL_WIN32, 0x0001}
321 struct command_tx_struct *newpacket;
322 int toolcount = sizeof(tools)/sizeof(struct aim_tool_version);
324 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 1152)))
329 i = aim_putsnac(newpacket->data, 0x0001, 0x0002, 0x0000, sess->snac_nextid);
330 aim_cachesnac(sess, 0x0001, 0x0002, 0x0000, NULL, 0);
332 for (j = 0; j < toolcount; j++) {
333 i += aimutil_put16(newpacket->data+i, tools[j].group);
334 i += aimutil_put16(newpacket->data+i, tools[j].version);
335 i += aimutil_put16(newpacket->data+i, tools[j].tool);
336 i += aimutil_put16(newpacket->data+i, tools[j].toolversion);
339 newpacket->commandlen = i;
342 aim_tx_enqueue(sess, newpacket);
344 return sess->snac_nextid;
348 * Request Rate Information.
351 faim_export unsigned long aim_bos_reqrate(struct aim_session_t *sess,
352 struct aim_conn_t *conn)
354 return aim_genericreq_n(sess, conn, 0x0001, 0x0006);
358 * Rate Information Response Acknowledge.
361 faim_export unsigned long aim_bos_ackrateresp(struct aim_session_t *sess,
362 struct aim_conn_t *conn)
364 struct command_tx_struct *newpacket;
365 int packlen = 20, i=0;
367 if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen)))
368 return (sess->snac_nextid);
372 i = aim_putsnac(newpacket->data, 0x0001, 0x0008, 0x0000, 0);
373 i += aimutil_put16(newpacket->data+i, 0x0001);
374 i += aimutil_put16(newpacket->data+i, 0x0002);
375 i += aimutil_put16(newpacket->data+i, 0x0003);
376 i += aimutil_put16(newpacket->data+i, 0x0004);
377 i += aimutil_put16(newpacket->data+i, 0x0005);
379 newpacket->commandlen = i;
382 aim_tx_enqueue(sess, newpacket);
384 return (sess->snac_nextid);
388 * aim_bos_setprivacyflags()
390 * Sets privacy flags. Normally 0x03.
392 * Bit 1: Allows other AIM users to see how long you've been idle.
393 * Bit 2: Allows other AIM users to see how long you've been a member.
396 faim_export unsigned long aim_bos_setprivacyflags(struct aim_session_t *sess,
397 struct aim_conn_t *conn,
400 return aim_genericreq_l(sess, conn, 0x0001, 0x0014, &flags);
404 * aim_bos_reqpersonalinfo()
406 * Requests the current user's information. Can't go generic on this one
407 * because aparently it uses SNAC flags.
410 faim_export unsigned long aim_bos_reqpersonalinfo(struct aim_session_t *sess,
411 struct aim_conn_t *conn)
413 return aim_genericreq_n(sess, conn, 0x0001, 0x000e);
416 faim_export unsigned long aim_setversions(struct aim_session_t *sess,
417 struct aim_conn_t *conn)
419 struct command_tx_struct *newpacket;
422 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10 + (4*12))))
427 i = aim_putsnac(newpacket->data, 0x0001, 0x0017, 0x0000, sess->snac_nextid);
428 aim_cachesnac(sess, 0x0001, 0x0017, 0x0000, NULL, 0);
430 i += aimutil_put16(newpacket->data+i, 0x0001);
431 i += aimutil_put16(newpacket->data+i, 0x0003);
433 i += aimutil_put16(newpacket->data+i, 0x0013);
434 i += aimutil_put16(newpacket->data+i, 0x0001);
436 i += aimutil_put16(newpacket->data+i, 0x0002);
437 i += aimutil_put16(newpacket->data+i, 0x0001);
439 i += aimutil_put16(newpacket->data+i, 0x0003);
440 i += aimutil_put16(newpacket->data+i, 0x0001);
442 i += aimutil_put16(newpacket->data+i, 0x0004);
443 i += aimutil_put16(newpacket->data+i, 0x0001);
445 i += aimutil_put16(newpacket->data+i, 0x0006);
446 i += aimutil_put16(newpacket->data+i, 0x0001);
448 i += aimutil_put16(newpacket->data+i, 0x0008);
449 i += aimutil_put16(newpacket->data+i, 0x0001);
451 i += aimutil_put16(newpacket->data+i, 0x0009);
452 i += aimutil_put16(newpacket->data+i, 0x0001);
454 i += aimutil_put16(newpacket->data+i, 0x000a);
455 i += aimutil_put16(newpacket->data+i, 0x0001);
457 i += aimutil_put16(newpacket->data+i, 0x000b);
458 i += aimutil_put16(newpacket->data+i, 0x0001);
460 i += aimutil_put16(newpacket->data+i, 0x000c);
461 i += aimutil_put16(newpacket->data+i, 0x0001);
463 newpacket->commandlen = i;
465 aim_tx_enqueue(sess, newpacket);
467 return sess->snac_nextid;
472 * aim_bos_reqservice(serviceid)
477 faim_export unsigned long aim_bos_reqservice(struct aim_session_t *sess,
478 struct aim_conn_t *conn,
481 return aim_genericreq_s(sess, conn, 0x0001, 0x0004, &serviceid);
487 * No-op. WinAIM sends these every 4min or so to keep
488 * the connection alive. Its not real necessary.
491 faim_export unsigned long aim_bos_nop(struct aim_session_t *sess,
492 struct aim_conn_t *conn)
494 return aim_genericreq_n(sess, conn, 0x0001, 0x0016);
500 * No-op. WinAIM 4.x sends these _every minute_ to keep
501 * the connection alive.
503 faim_export unsigned long aim_flap_nop(struct aim_session_t *sess,
504 struct aim_conn_t *conn)
506 struct command_tx_struct *newpacket;
508 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0005, conn, 0)))
509 return sess->snac_nextid;
512 newpacket->commandlen = 0;
515 aim_tx_enqueue(sess, newpacket);
517 return (sess->snac_nextid);
521 * aim_bos_reqrights()
523 * Request BOS rights.
526 faim_export unsigned long aim_bos_reqrights(struct aim_session_t *sess,
527 struct aim_conn_t *conn)
529 return aim_genericreq_n(sess, conn, 0x0009, 0x0002);
533 * aim_bos_reqbuddyrights()
535 * Request Buddy List rights.
538 faim_export unsigned long aim_bos_reqbuddyrights(struct aim_session_t *sess,
539 struct aim_conn_t *conn)
541 return aim_genericreq_n(sess, conn, 0x0003, 0x0002);
545 * aim_send_warning(struct aim_session_t *sess,
546 * struct aim_conn_t *conn, char *destsn, int anon)
547 * send a warning to destsn.
548 * anon is anonymous or not;
549 * AIM_WARN_ANON anonymous
551 * returns -1 on error (couldn't alloc packet), next snacid on success.
554 faim_export int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon)
556 struct command_tx_struct *newpacket;
559 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, strlen(destsn)+13)))
565 curbyte += aim_putsnac(newpacket->data+curbyte,
566 0x0004, 0x0008, 0x0000, sess->snac_nextid);
568 curbyte += aimutil_put16(newpacket->data+curbyte, (anon & AIM_WARN_ANON)?1:0);
570 curbyte += aimutil_put8(newpacket->data+curbyte, strlen(destsn));
572 curbyte += aimutil_putstr(newpacket->data+curbyte, destsn, strlen(destsn));
574 newpacket->commandlen = curbyte;
577 aim_tx_enqueue(sess, newpacket);
579 return (sess->snac_nextid++);
583 * aim_debugconn_sendconnect()
585 * For aimdebugd. If you don't know what it is, you don't want to.
587 faim_export unsigned long aim_debugconn_sendconnect(struct aim_session_t *sess,
588 struct aim_conn_t *conn)
590 return aim_genericreq_n(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEBUGCONN_CONNECT);
594 * Generic routine for sending commands.
597 * I know I can do this in a smarter way...but I'm not thinking straight
600 * I had one big function that handled all three cases, but then it broke
601 * and I split it up into three. But then I fixed it. I just never went
602 * back to the single. I don't see any advantage to doing it either way.
605 faim_internal unsigned long aim_genericreq_n(struct aim_session_t *sess,
606 struct aim_conn_t *conn,
607 u_short family, u_short subtype)
609 struct command_tx_struct *newpacket;
611 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10)))
616 aim_putsnac(newpacket->data, family, subtype, 0x0000, sess->snac_nextid);
618 aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0);
620 aim_tx_enqueue(sess, newpacket);
621 return sess->snac_nextid;
628 faim_internal unsigned long aim_genericreq_l(struct aim_session_t *sess,
629 struct aim_conn_t *conn,
630 u_short family, u_short subtype,
633 struct command_tx_struct *newpacket;
636 /* If we don't have data, there's no reason to use this function */
638 return aim_genericreq_n(sess, conn, family, subtype);
640 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+sizeof(u_long))))
645 aim_putsnac(newpacket->data, family, subtype, 0x0000, sess->snac_nextid);
646 aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0);
649 newlong = htonl(*longdata);
650 memcpy(&(newpacket->data[10]), &newlong, sizeof(u_long));
652 aim_tx_enqueue(sess, newpacket);
653 return sess->snac_nextid;
656 faim_internal unsigned long aim_genericreq_s(struct aim_session_t *sess,
657 struct aim_conn_t *conn,
658 u_short family, u_short subtype,
661 struct command_tx_struct *newpacket;
664 /* If we don't have data, there's no reason to use this function */
666 return aim_genericreq_n(sess, conn, family, subtype);
668 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+sizeof(u_short))))
673 aim_putsnac(newpacket->data, family, subtype, 0x0000, sess->snac_nextid);
674 aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0);
677 newshort = htons(*shortdata);
678 memcpy(&(newpacket->data[10]), &newshort, sizeof(u_short));
680 aim_tx_enqueue(sess, newpacket);
681 return sess->snac_nextid;
685 * aim_bos_reqlocaterights()
687 * Request Location services rights.
690 faim_export unsigned long aim_bos_reqlocaterights(struct aim_session_t *sess,
691 struct aim_conn_t *conn)
693 return aim_genericreq_n(sess, conn, 0x0002, 0x0002);
697 * aim_bos_reqicbmparaminfo()
699 * Request ICBM parameter information.
702 faim_export unsigned long aim_bos_reqicbmparaminfo(struct aim_session_t *sess,
703 struct aim_conn_t *conn)
705 return aim_genericreq_n(sess, conn, 0x0004, 0x0004);
709 * Add ICBM parameter? Huh?
711 faim_export unsigned long aim_addicbmparam(struct aim_session_t *sess,
712 struct aim_conn_t *conn)
714 struct command_tx_struct *newpacket;
715 int packlen = 10+16, i=0;
717 if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen)))
718 return (sess->snac_nextid);
722 i = aim_putsnac(newpacket->data, 0x0004, 0x0002, 0x0000, sess->snac_nextid);
723 aim_cachesnac(sess, 0x0004, 0x0002, 0x0000, NULL, 0);
725 i += aimutil_put16(newpacket->data+i, 0x0000);
726 i += aimutil_put16(newpacket->data+i, 0x0000);
727 i += aimutil_put16(newpacket->data+i, 0x0003);
728 i += aimutil_put16(newpacket->data+i, 0x1f40);
729 i += aimutil_put16(newpacket->data+i, 0x03e7);
730 i += aimutil_put16(newpacket->data+i, 0x03e7);
731 i += aimutil_put16(newpacket->data+i, 0x0000);
732 i += aimutil_put16(newpacket->data+i, 0x0000);
734 aim_tx_enqueue(sess, newpacket);
736 return sess->snac_nextid;
740 * Set directory profile data (not the same as aim_bos_setprofile!)
742 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)
744 struct command_tx_struct *newpacket;
745 int packlen = 0, i = 0;
749 if(first) /* TLV 0001 */
750 packlen += (strlen(first) + 4);
752 packlen += (strlen(middle) + 4);
754 packlen += (strlen(last) + 4);
756 packlen += (strlen(maiden) + 4);
758 packlen += (strlen(nickname) + 4);
760 packlen += (strlen(street) + 4);
762 packlen += (strlen(state) + 4);
764 packlen += (strlen(city) + 4);
766 packlen += (strlen(zip) + 4);
768 if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen+10)))
773 i = aim_putsnac(newpacket->data, 0x0002, 0x0009, 0x0000, 0);
775 /* 000a/0002: privacy: 1 to allow search/disp, 0 to disallow */
776 i += aim_puttlv_16(newpacket->data+i, 0x000a, privacy);
780 i += aim_puttlv_str(newpacket->data+i, 0x0001, strlen(first), first);
782 i += aim_puttlv_str(newpacket->data+i, 0x0003, strlen(middle), middle);
784 i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(last), last);
786 i += aim_puttlv_str(newpacket->data+i, 0x0004, strlen(maiden), maiden);
788 i += aim_puttlv_str(newpacket->data+i, 0x000c, strlen(nickname), nickname);
790 i += aim_puttlv_str(newpacket->data+i, 0x0021, strlen(street), street);
792 i += aim_puttlv_str(newpacket->data+i, 0x0008, strlen(city), city);
794 i += aim_puttlv_str(newpacket->data+i, 0x0007, strlen(state), state);
796 i += aim_puttlv_str(newpacket->data+i, 0x000d, strlen(zip), zip);
798 newpacket->commandlen = i;
801 aim_tx_enqueue(sess, newpacket);
803 return(sess->snac_nextid);
806 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)
808 struct command_tx_struct *newpacket;
809 int packlen = 0, i = 0;
814 packlen += (strlen(interest1) + 4);
816 packlen += (strlen(interest2) + 4);
818 packlen += (strlen(interest3) + 4);
820 packlen += (strlen(interest4) + 4);
822 packlen += (strlen(interest5) + 4) ;
825 if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen+10)))
830 i = aim_putsnac(newpacket->data, 0x0002, 0x000f, 0x0000, 0);
832 /* 000a/0002: 0000 ?? ?privacy? */
833 i += aim_puttlv_16(newpacket->data+i, 0x000a, privacy);
836 i += aim_puttlv_str(newpacket->data+i, 0x000b, strlen(interest1), interest1);
838 i += aim_puttlv_str(newpacket->data+i, 0x000b, strlen(interest2), interest2);
840 i += aim_puttlv_str(newpacket->data+i, 0x000b, strlen(interest3), interest3);
842 i += aim_puttlv_str(newpacket->data+i, 0x000b, strlen(interest4), interest4);
844 i += aim_puttlv_str(newpacket->data+i, 0x000b, strlen(interest1), interest5);
846 newpacket->commandlen = i;
849 aim_tx_enqueue(sess, newpacket);
851 return(sess->snac_nextid);
854 faim_export unsigned long aim_icq_setstatus(struct aim_session_t *sess,
855 struct aim_conn_t *conn,
856 unsigned long status)
858 struct command_tx_struct *newpacket;
862 data = 0x00030000 | status; /* yay for error checking ;^) */
864 if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10 + 4)))
869 i = aim_putsnac(newpacket->data, 0x0001, 0x001e, 0x0000, 0x0000001e);
870 i += aim_puttlv_32(newpacket->data+i, 0x0006, data);
872 newpacket->commandlen = i;
875 aim_tx_enqueue(sess, newpacket);
877 return(sess->snac_nextid);