]> andersk Git - libfaim.git/blob - aim_misc.c
- Sat Sep 2 23:42:37 UTC 2000
[libfaim.git] / aim_misc.c
1
2 /*
3  * aim_misc.c
4  *
5  * TODO: Seperate a lot of this into an aim_bos.c.
6  *
7  * Other things...
8  *
9  *   - Idle setting 
10  * 
11  *
12  */
13
14 #include <faim/aim.h> 
15
16 /*
17  * aim_bos_setidle()
18  *
19  *  Should set your current idle time in seconds.  Idealy, OSCAR should
20  *  do this for us.  But, it doesn't.  The client must call this to set idle
21  *  time.  
22  *
23  */
24 u_long aim_bos_setidle(struct aim_session_t *sess,
25                        struct aim_conn_t *conn, 
26                        u_long idletime)
27 {
28   return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime);
29 }
30
31
32 /*
33  * aim_bos_changevisibility(conn, changtype, namelist)
34  *
35  * Changes your visibility depending on changetype:
36  *
37  *  AIM_VISIBILITYCHANGE_PERMITADD: Lets provided list of names see you
38  *  AIM_VISIBILITYCHANGE_PERMIDREMOVE: Removes listed names from permit list
39  *  AIM_VISIBILITYCHANGE_DENYADD: Hides you from provided list of names
40  *  AIM_VISIBILITYCHANGE_DENYREMOVE: Lets list see you again
41  *
42  * list should be a list of 
43  * screen names in the form "Screen Name One&ScreenNameTwo&" etc.
44  *
45  * Equivelents to options in WinAIM:
46  *   - Allow all users to contact me: Send an AIM_VISIBILITYCHANGE_DENYADD
47  *      with only your name on it.
48  *   - Allow only users on my Buddy List: Send an 
49  *      AIM_VISIBILITYCHANGE_PERMITADD with the list the same as your
50  *      buddy list
51  *   - Allow only the uesrs below: Send an AIM_VISIBILITYCHANGE_PERMITADD 
52  *      with everyone listed that you want to see you.
53  *   - Block all users: Send an AIM_VISIBILITYCHANGE_PERMITADD with only 
54  *      yourself in the list
55  *   - Block the users below: Send an AIM_VISIBILITYCHANGE_DENYADD with
56  *      the list of users to be blocked
57  *
58  *
59  */
60 u_long aim_bos_changevisibility(struct aim_session_t *sess,
61                                 struct aim_conn_t *conn, 
62                                 int changetype, char *denylist)
63 {
64   struct command_tx_struct *newpacket;
65   int packlen = 0;
66   u_short subtype;
67
68   char *localcpy = NULL;
69   char *tmpptr = NULL;
70   int i,j;
71   int listcount;
72
73   if (!denylist)
74     return 0;
75
76   localcpy = (char *) malloc(strlen(denylist)+1);
77   memcpy(localcpy, denylist, strlen(denylist)+1);
78   
79   listcount = aimutil_itemcnt(localcpy, '&');
80   packlen = aimutil_tokslen(localcpy, 99, '&') + listcount + 9;
81
82   if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen)))
83     return -1;
84
85   newpacket->lock = 1;
86
87   switch(changetype)
88     {
89     case AIM_VISIBILITYCHANGE_PERMITADD:    subtype = 0x05; break;
90     case AIM_VISIBILITYCHANGE_PERMITREMOVE: subtype = 0x06; break;
91     case AIM_VISIBILITYCHANGE_DENYADD:      subtype = 0x07; break;
92     case AIM_VISIBILITYCHANGE_DENYREMOVE:   subtype = 0x08; break;
93     default:
94       free(newpacket->data);
95       free(newpacket);
96       return 0;
97     }
98
99   /* We actually DO NOT send a SNAC ID with this one! */
100   aim_putsnac(newpacket->data, 0x0009, subtype, 0x00, 0);
101  
102   j = 10;  /* the next byte */
103   
104   for (i=0; (i < (listcount - 1)) && (i < 99); i++)
105     {
106       tmpptr = aimutil_itemidx(localcpy, i, '&');
107
108       newpacket->data[j] = strlen(tmpptr);
109       memcpy(&(newpacket->data[j+1]), tmpptr, strlen(tmpptr));
110       j += strlen(tmpptr)+1;
111       free(tmpptr);
112     }
113   free(localcpy);
114
115   newpacket->lock = 0;
116
117   aim_tx_enqueue(sess, newpacket);
118
119   return (sess->snac_nextid); /* dont increment */
120
121 }
122
123
124
125 /*
126  * aim_bos_setbuddylist(buddylist)
127  *
128  * This just builds the "set buddy list" command then queues it.
129  *
130  * buddy_list = "Screen Name One&ScreenNameTwo&";
131  *
132  * TODO: Clean this up.  
133  *
134  * XXX: I can't stress the TODO enough.
135  *
136  */
137 u_long aim_bos_setbuddylist(struct aim_session_t *sess,
138                             struct aim_conn_t *conn, 
139                             char *buddy_list)
140 {
141   int i, j;
142
143   struct command_tx_struct *newpacket;
144
145   int len = 0;
146
147   char *localcpy = NULL;
148   char *tmpptr = NULL;
149
150   len = 10; /* 10B SNAC headers */
151
152   if (!buddy_list || !(localcpy = (char *) malloc(strlen(buddy_list)+1))) 
153     return -1;
154   strncpy(localcpy, buddy_list, strlen(buddy_list)+1);
155
156   i = 0;
157   tmpptr = strtok(localcpy, "&");
158   while ((tmpptr != NULL) && (i < 150)) {
159 #if debug > 0
160     printf("---adding %d: %s (%d)\n", i, tmpptr, strlen(tmpptr));
161 #endif
162     len += 1+strlen(tmpptr);
163     i++;
164     tmpptr = strtok(NULL, "&");
165   }
166 #if debug > 0
167   printf("*** send buddy list len: %d (%x)\n", len, len);
168 #endif
169
170   if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, len)))
171     return -1;
172
173   newpacket->lock = 1;
174   
175   aim_putsnac(newpacket->data, 0x0003, 0x0004, 0x0000, 0);
176
177   j = 10;  /* the next byte */
178
179   strncpy(localcpy, buddy_list, strlen(buddy_list)+1);
180   i = 0;
181   tmpptr = strtok(localcpy, "&");
182   while ((tmpptr != NULL) & (i < 150)) {
183 #if debug > 0
184     printf("---adding %d: %s (%d)\n", i, tmpptr, strlen(tmpptr));
185 #endif
186     newpacket->data[j] = strlen(tmpptr);
187     memcpy(&(newpacket->data[j+1]), tmpptr, strlen(tmpptr));
188     j += 1+strlen(tmpptr);
189     i++;
190     tmpptr = strtok(NULL, "&");
191   }
192
193   newpacket->lock = 0;
194
195   aim_tx_enqueue(sess, newpacket);
196
197   free(localcpy);
198
199   return (sess->snac_nextid);
200 }
201
202 /* 
203  * aim_bos_setprofile(profile)
204  *
205  * Gives BOS your profile.
206  *
207  * 
208  */
209 u_long aim_bos_setprofile(struct aim_session_t *sess,
210                           struct aim_conn_t *conn, 
211                           char *profile,
212                           char *awaymsg,
213                           unsigned int caps)
214 {
215   struct command_tx_struct *newpacket;
216   int i = 0, tmp, caplen;
217
218   if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 1152+strlen(profile)+1+(awaymsg?strlen(awaymsg):0))))
219     return -1;
220
221   i += aim_putsnac(newpacket->data, 0x0002, 0x004, 0x0000, sess->snac_nextid);
222   i += aim_puttlv_str(newpacket->data+i, 0x0001, strlen("text/x-aolrtf; charset=\"us-ascii\""), "text/x-aolrtf; charset=\"us-ascii\"");
223   i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(profile), profile);
224   /* why do we send this twice?  */
225   i += aim_puttlv_str(newpacket->data+i, 0x0003, strlen("text/x-aolrtf; charset=\"us-ascii\""), "text/x-aolrtf; charset=\"us-ascii\"");
226   
227   /* Away message -- we send this no matter what, even if its blank */
228   if (awaymsg)
229     i += aim_puttlv_str(newpacket->data+i, 0x0004, strlen(awaymsg), awaymsg);
230   else
231     i += aim_puttlv_str(newpacket->data+i, 0x0004, 0x0000, NULL);
232
233   /* Capability information. */
234  
235   tmp = (i += aimutil_put16(newpacket->data+i, 0x0005));
236   i += aimutil_put16(newpacket->data+i, 0x0000); /* rewritten later */
237   i += (caplen = aim_putcap(newpacket->data+i, 512, caps));
238   aimutil_put16(newpacket->data+tmp, caplen); /* rewrite TLV size */
239
240   newpacket->commandlen = i;
241   aim_tx_enqueue(sess, newpacket);
242   
243   return (sess->snac_nextid++);
244 }
245
246 /* 
247  * aim_bos_setgroupperm(mask)
248  * 
249  * Set group permisson mask.  Normally 0x1f (all classes).
250  *
251  * The group permission mask allows you to keep users of a certain
252  * class or classes from talking to you.  The mask should be
253  * a bitwise OR of all the user classes you want to see you.
254  *
255  */
256 u_long aim_bos_setgroupperm(struct aim_session_t *sess,
257                             struct aim_conn_t *conn, 
258                             u_long mask)
259 {
260   return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask);
261 }
262
263 int aim_parse_bosrights(struct aim_session_t *sess,
264                         struct command_rx_struct *command, ...)
265 {
266   rxcallback_t userfunc = NULL;
267   int ret=1;
268   struct aim_tlvlist_t *tlvlist;
269   struct aim_tlv_t *tlv;
270   unsigned short maxpermits = 0, maxdenies = 0;
271
272   /* 
273    * TLVs follow 
274    */
275   if (!(tlvlist = aim_readtlvchain(command->data+10, command->commandlen-10)))
276     return ret;
277
278   /*
279    * TLV type 0x0001: Maximum number of buddies on permit list.
280    */
281   if ((tlv = aim_gettlv(tlvlist, 0x0001, 1))) {
282     maxpermits = aimutil_get16(tlv->value);
283   }
284
285   /*
286    * TLV type 0x0002: Maximum number of buddies on deny list.
287    *
288    */
289   if ((tlv = aim_gettlv(tlvlist, 0x0002, 1))) {
290     maxdenies = aimutil_get16(tlv->value);
291   }
292   
293   userfunc = aim_callhandler(command->conn, 0x0009, 0x0003);
294   if (userfunc)
295     ret =  userfunc(sess, command, maxpermits, maxdenies);
296
297   aim_freetlvchain(&tlvlist);
298
299   return ret;  
300 }
301
302 /*
303  * aim_bos_clientready()
304  * 
305  * Send Client Ready.  
306  *
307  * TODO: Dynamisize.
308  *
309  */
310 u_long aim_bos_clientready(struct aim_session_t *sess,
311                            struct aim_conn_t *conn)
312 {
313   u_char command_2[] = {
314      /* placeholders for dynamic data */
315      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
316      0xff, 0xff, 
317      /* real data */
318      0x00, 0x01,   
319      0x00, 0x03, 
320      0x00, 0x04, 
321      0x07, 0xda,  
322
323      0x00, 0x02, 
324      0x00, 0x01,  
325      0x00, 0x04, 
326      0x00, 0x01, 
327  
328      0x00, 0x03, 
329      0x00, 0x01,  
330      0x00, 0x04, 
331      0x00, 0x01,
332  
333      0x00, 0x04, 
334      0x00, 0x01, 
335      0x00, 0x04,
336      0x00, 0x01,
337  
338      0x00, 0x06, 
339      0x00, 0x01, 
340      0x00, 0x04,  
341      0x00, 0x01, 
342      0x00, 0x08, 
343      0x00, 0x01, 
344      0x00, 0x04,
345      0x00, 0x01,
346  
347      0x00, 0x09, 
348      0x00, 0x01, 
349      0x00, 0x04,
350      0x00, 0x01, 
351      0x00, 0x0a, 
352      0x00, 0x01, 
353      0x00, 0x04,
354      0x00, 0x01,
355  
356      0x00, 0x0b,
357      0x00, 0x01, 
358      0x00, 0x04,
359      0x00, 0x01
360   };
361   int command_2_len = 0x52;
362   struct command_tx_struct *newpacket;
363   
364   if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, command_2_len)))
365     return -1;
366
367   newpacket->lock = 1;
368
369   memcpy(newpacket->data, command_2, command_2_len);
370   
371   /* This write over the dynamic parts of the byte block */
372   aim_putsnac(newpacket->data, 0x0001, 0x0002, 0x0000, sess->snac_nextid);
373
374   aim_tx_enqueue(sess, newpacket);
375
376   return (sess->snac_nextid++);
377 }
378
379 /* 
380  *  Request Rate Information.
381  * 
382  */
383 u_long aim_bos_reqrate(struct aim_session_t *sess,
384                        struct aim_conn_t *conn)
385 {
386   return aim_genericreq_n(sess, conn, 0x0001, 0x0006);
387 }
388
389 /* 
390  *  Rate Information Response Acknowledge.
391  *
392  */
393 u_long aim_bos_ackrateresp(struct aim_session_t *sess,
394                            struct aim_conn_t *conn)
395 {
396   struct command_tx_struct *newpacket;
397   int packlen = 20, i=0;
398
399   if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen)))
400     return (sess->snac_nextid);
401   
402   newpacket->lock = 1;
403
404   i = aim_putsnac(newpacket->data, 0x0001, 0x0008, 0x0000, 0);
405   i += aimutil_put16(newpacket->data+i, 0x0001); 
406   i += aimutil_put16(newpacket->data+i, 0x0002);
407   i += aimutil_put16(newpacket->data+i, 0x0003);
408   i += aimutil_put16(newpacket->data+i, 0x0004);
409   i += aimutil_put16(newpacket->data+i, 0x0005);
410   
411   aim_tx_enqueue(sess, newpacket);
412
413   return (sess->snac_nextid);
414 }
415
416 /* 
417  * aim_bos_setprivacyflags()
418  *
419  * Sets privacy flags. Normally 0x03.
420  *
421  *  Bit 1:  Allows other AIM users to see how long you've been idle.
422  *  Bit 2:  Allows other AIM users to see how long you've been a member.
423  *
424  */
425 u_long aim_bos_setprivacyflags(struct aim_session_t *sess,
426                                struct aim_conn_t *conn, 
427                                u_long flags)
428 {
429   return aim_genericreq_l(sess, conn, 0x0001, 0x0014, &flags);
430 }
431
432 /*
433  * aim_bos_reqpersonalinfo()
434  *
435  * Requests the current user's information. Can't go generic on this one
436  * because aparently it uses SNAC flags.
437  *
438  */
439 u_long aim_bos_reqpersonalinfo(struct aim_session_t *sess,
440                                struct aim_conn_t *conn)
441 {
442   return aim_genericreq_n(sess, conn, 0x0001, 0x000e);
443 }
444
445 u_long aim_setversions(struct aim_session_t *sess,
446                                struct aim_conn_t *conn)
447 {
448   struct command_tx_struct *newpacket;
449   int i;
450
451   if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10 + (4*12))))
452     return -1;
453
454   newpacket->lock = 1;
455
456   i = aim_putsnac(newpacket->data, 0x0001, 0x0017, 0x0000, sess->snac_nextid);
457
458   i += aimutil_put16(newpacket->data+i, 0x0001);
459   i += aimutil_put16(newpacket->data+i, 0x0003);
460
461   i += aimutil_put16(newpacket->data+i, 0x0002);
462   i += aimutil_put16(newpacket->data+i, 0x0001);
463
464   i += aimutil_put16(newpacket->data+i, 0x0003);
465   i += aimutil_put16(newpacket->data+i, 0x0001);
466
467   i += aimutil_put16(newpacket->data+i, 0x0004);
468   i += aimutil_put16(newpacket->data+i, 0x0001);
469
470   i += aimutil_put16(newpacket->data+i, 0x0006);
471   i += aimutil_put16(newpacket->data+i, 0x0001);
472
473   i += aimutil_put16(newpacket->data+i, 0x0008);
474   i += aimutil_put16(newpacket->data+i, 0x0001);
475
476   i += aimutil_put16(newpacket->data+i, 0x0009);
477   i += aimutil_put16(newpacket->data+i, 0x0001);
478
479   i += aimutil_put16(newpacket->data+i, 0x000a);
480   i += aimutil_put16(newpacket->data+i, 0x0001);
481
482   i += aimutil_put16(newpacket->data+i, 0x000b);
483   i += aimutil_put16(newpacket->data+i, 0x0002);
484
485   i += aimutil_put16(newpacket->data+i, 0x000c);
486   i += aimutil_put16(newpacket->data+i, 0x0001);
487
488   i += aimutil_put16(newpacket->data+i, 0x0013);
489   i += aimutil_put16(newpacket->data+i, 0x0001);
490
491   i += aimutil_put16(newpacket->data+i, 0x0015);
492   i += aimutil_put16(newpacket->data+i, 0x0001);
493
494 #if 0
495   for (j = 0; j < 0x10; j++) {
496     i += aimutil_put16(newpacket->data+i, j); /* family */
497     i += aimutil_put16(newpacket->data+i, 0x0003); /* version */
498   }
499 #endif
500   newpacket->lock = 0;
501   aim_tx_enqueue(sess, newpacket);
502
503   return (sess->snac_nextid++);
504 }
505
506
507 /*
508  * aim_bos_reqservice(serviceid)
509  *
510  * Service request. 
511  *
512  */
513 u_long aim_bos_reqservice(struct aim_session_t *sess,
514                           struct aim_conn_t *conn, 
515                           u_short serviceid)
516 {
517   return aim_genericreq_s(sess, conn, 0x0001, 0x0004, &serviceid);
518 }
519
520 /*
521  * aim_bos_nop()
522  *
523  * No-op.  WinAIM sends these every 4min or so to keep
524  * the connection alive.  Its not real necessary.
525  *
526  */
527 u_long aim_bos_nop(struct aim_session_t *sess,
528                    struct aim_conn_t *conn)
529 {
530   return aim_genericreq_n(sess, conn, 0x0001, 0x0016);
531 }
532
533 /*
534  * aim_bos_reqrights()
535  *
536  * Request BOS rights.
537  *
538  */
539 u_long aim_bos_reqrights(struct aim_session_t *sess,
540                          struct aim_conn_t *conn)
541 {
542   return aim_genericreq_n(sess, conn, 0x0009, 0x0002);
543 }
544
545 /*
546  * aim_bos_reqbuddyrights()
547  *
548  * Request Buddy List rights.
549  *
550  */
551 u_long aim_bos_reqbuddyrights(struct aim_session_t *sess,
552                               struct aim_conn_t *conn)
553 {
554   return aim_genericreq_n(sess, conn, 0x0003, 0x0002);
555 }
556
557 /*
558  * aim_send_warning(struct aim_session_t *sess, 
559  *                  struct aim_conn_t *conn, char *destsn, int anon)
560  * send a warning to destsn.
561  * anon is anonymous or not;
562  *  AIM_WARN_ANON anonymous
563  *
564  * returns -1 on error (couldn't alloc packet), next snacid on success.
565  *
566  */
567 int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon)
568 {
569   struct command_tx_struct *newpacket;
570   int curbyte;
571
572   if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, strlen(destsn)+13)))
573     return -1;
574
575   newpacket->lock = 1;
576
577   curbyte  = 0;
578   curbyte += aim_putsnac(newpacket->data+curbyte,
579                         0x0004, 0x0008, 0x0000, sess->snac_nextid);
580
581   curbyte += aimutil_put16(newpacket->data+curbyte, (anon & AIM_WARN_ANON)?1:0);
582
583   curbyte += aimutil_put8(newpacket->data+curbyte, strlen(destsn));
584
585   curbyte += aimutil_putstr(newpacket->data+curbyte, destsn, strlen(destsn));
586
587   newpacket->commandlen = curbyte;
588   newpacket->lock = 0;
589
590   aim_tx_enqueue(sess, newpacket);
591
592   return (sess->snac_nextid++);
593 }
594
595
596
597 /*
598  * aim_debugconn_sendconnect()
599  *
600  * For aimdebugd.  If you don't know what it is, you don't want to.
601  */
602 u_long aim_debugconn_sendconnect(struct aim_session_t *sess,
603                                  struct aim_conn_t *conn)
604 {
605   return aim_genericreq_n(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEBUGCONN_CONNECT);
606 }
607
608 /*
609  * Generic routine for sending commands.
610  *
611  *
612  * I know I can do this in a smarter way...but I'm not thinking straight
613  * right now...
614  *
615  * I had one big function that handled all three cases, but then it broke
616  * and I split it up into three.  But then I fixed it.  I just never went
617  * back to the single.  I don't see any advantage to doing it either way.
618  *
619  */
620 u_long aim_genericreq_n(struct aim_session_t *sess,
621                         struct aim_conn_t *conn, 
622                         u_short family, u_short subtype)
623 {
624   struct command_tx_struct *newpacket;
625
626   if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10)))
627     return 0;
628
629   newpacket->lock = 1;
630
631   aim_putsnac(newpacket->data, family, subtype, 0x0000, sess->snac_nextid);
632  
633   aim_tx_enqueue(sess, newpacket);
634   return (sess->snac_nextid++);
635 }
636
637 /*
638  *
639  *
640  */
641 u_long aim_genericreq_l(struct aim_session_t *sess,
642                         struct aim_conn_t *conn, 
643                         u_short family, u_short subtype, u_long *longdata)
644 {
645   struct command_tx_struct *newpacket;
646   u_long newlong;
647
648   /* If we don't have data, there's no reason to use this function */
649   if (!longdata)
650     return aim_genericreq_n(sess, conn, family, subtype);
651
652   if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+sizeof(u_long))))
653     return -1;
654
655   newpacket->lock = 1;
656
657   aim_putsnac(newpacket->data, family, subtype, 0x0000, sess->snac_nextid);
658
659   /* copy in data */
660   newlong = htonl(*longdata);
661   memcpy(&(newpacket->data[10]), &newlong, sizeof(u_long));
662
663   aim_tx_enqueue(sess, newpacket);
664   return (sess->snac_nextid++);
665 }
666
667 u_long aim_genericreq_s(struct aim_session_t *sess,
668                         struct aim_conn_t *conn, 
669                         u_short family, u_short subtype, u_short *shortdata)
670 {
671   struct command_tx_struct *newpacket;
672   u_short newshort;
673
674   /* If we don't have data, there's no reason to use this function */
675   if (!shortdata)
676     return aim_genericreq_n(sess, conn, family, subtype);
677
678   if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+sizeof(u_short))))
679     return -1;
680
681   newpacket->lock = 1;
682
683   aim_putsnac(newpacket->data, family, subtype, 0x0000, sess->snac_nextid);
684
685   /* copy in data */
686   newshort = htons(*shortdata);
687   memcpy(&(newpacket->data[10]), &newshort, sizeof(u_short));
688
689   aim_tx_enqueue(sess, newpacket);
690   return (sess->snac_nextid++);
691 }
692
693 /*
694  * aim_bos_reqlocaterights()
695  *
696  * Request Location services rights.
697  *
698  */
699 u_long aim_bos_reqlocaterights(struct aim_session_t *sess,
700                                struct aim_conn_t *conn)
701 {
702   return aim_genericreq_n(sess, conn, 0x0002, 0x0002);
703 }
704
705 /*
706 * aim_bos_reqicbmparaminfo()
707  *
708  * Request ICBM parameter information.
709  *
710  */
711 u_long aim_bos_reqicbmparaminfo(struct aim_session_t *sess,
712                                 struct aim_conn_t *conn)
713 {
714   return aim_genericreq_n(sess, conn, 0x0004, 0x0004);
715 }
716
717 /*
718  * Add ICBM parameter? Huh?
719  */
720 unsigned long aim_addicbmparam(struct aim_session_t *sess,
721                                struct aim_conn_t *conn)
722 {
723   struct command_tx_struct *newpacket;
724   int packlen = 10+16, i=0;
725
726   if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen)))
727     return (sess->snac_nextid);
728   
729   newpacket->lock = 1;
730
731   i = aim_putsnac(newpacket->data, 0x0004, 0x0002, 0x0000, sess->snac_nextid);
732   i += aimutil_put16(newpacket->data+i, 0x0000); 
733   i += aimutil_put16(newpacket->data+i, 0x0000);
734   i += aimutil_put16(newpacket->data+i, 0x0003);
735   i += aimutil_put16(newpacket->data+i, 0x1f40);
736   i += aimutil_put16(newpacket->data+i, 0x03e7);
737   i += aimutil_put16(newpacket->data+i, 0x03e7);
738   i += aimutil_put16(newpacket->data+i, 0x0000); 
739   i += aimutil_put16(newpacket->data+i, 0x0000); 
740   
741   aim_tx_enqueue(sess, newpacket);
742
743   return (sess->snac_nextid);
744 }
This page took 0.423544 seconds and 5 git commands to generate.