]> andersk Git - libfaim.git/blob - utils/faimtest/faimtest.c
Lots of minor cleanups. Adds new (disabled) SNAC-based login.
[libfaim.git] / utils / faimtest / faimtest.c
1 /* 
2  *  -----------------------------------------------------------
3  *  ProtoFAIM: v1.xx.xxplxx
4  *  -----------------------------------------------------------
5  *
6  *  This is ProtoFAIM v1.xx.xxplxx!!! Its nearly completely 
7  *  different than that ugly thing called v0.  This app is
8  *  compatible with the latest version of the libfaim library.
9  *  Work is continuing. 
10  *
11  *  ProtoFAIM should only be used for two things...
12  *   1) Testing the libfaim backend.
13  *   2) For reference on the libfaim API when developing clients.
14  * 
15  *  Its very ugly.  Probably always will be.  Nothing is more
16  *  ugly than the backend itself, however.
17  *
18  *  -----------------------------------------------------------
19  *
20  *  I'm releasing this code and all it's associated linkage
21  *  under the GNU General Public License.  For more information,
22  *  please refer to http://www.fsf.org.  For any questions,
23  *  please contact me at the address below.
24  *
25  *  Most everything:
26  *  (c) 1998 Adam Fritzler, PST, afritz@iname.com
27  *
28  *  The password algorithms
29  *  (c) 1998 Brock Wilcox, awwaiid@iname.com
30  *
31  *  THERE IS NO CODE FROM AOL'S AIM IN THIS CODE, NOR
32  *  WAS THERE ANY DISASSEMBLAGE TO DEFINE PROTOCOL.  All
33  *  information was gained through painstakingly comparing
34  *  TCP dumps while the AIM Java client was running.  Nothing
35  *  more than that, except for a lot of experimenting.
36  *
37  *  -----------------------------------------------------------
38  *
39  */
40
41 /*
42   Current status:
43
44
45  */
46
47 #define FAIMTEST_SCREENNAME "SCREENNAME"
48 #define FAIMTEST_PASSWORD "PASSWORD"
49
50 #include <faim/aim.h> 
51
52 int faimtest_parse_oncoming(struct aim_session_t *, struct command_rx_struct *, ...);
53 int faimtest_parse_offgoing(struct aim_session_t *, struct command_rx_struct *, ...);
54 int faimtest_parse_login_phase3d_f(struct aim_session_t *, struct command_rx_struct *, ...);
55 int faimtest_auth_error(struct aim_session_t *, struct command_rx_struct *, ...);
56 int faimtest_parse_authresp(struct aim_session_t *, struct command_rx_struct *, ...);
57 int faimtest_parse_incoming_im(struct aim_session_t *, struct command_rx_struct *command, ...);
58 int faimtest_parse_userinfo(struct aim_session_t *, struct command_rx_struct *command, ...);
59 int faimtest_handleredirect(struct aim_session_t *, struct command_rx_struct *command, ...);
60 int faimtest_authsvrready(struct aim_session_t *, struct command_rx_struct *command, ...);
61 int faimtest_pwdchngdone(struct aim_session_t *, struct command_rx_struct *command, ...);
62 int faimtest_serverready(struct aim_session_t *, struct command_rx_struct *command, ...);
63 int faimtest_parse_misses(struct aim_session_t *, struct command_rx_struct *command, ...);
64 int faimtest_parse_motd(struct aim_session_t *, struct command_rx_struct *command, ...);
65 int faimtest_parse_login(struct aim_session_t *, struct command_rx_struct *command, ...);
66
67 int main(void)
68 {
69   struct aim_session_t aimsess;
70   struct aim_conn_t *authconn = NULL;
71   int stayconnected = 1;
72   struct client_info_s info = {"FAIMtest (Hi guys!)", 3, 5, 1670, "us", "en"};
73     
74   aim_session_init(&aimsess);
75
76   /*
77    * (I used a goto-based loop here because n wanted quick proof
78    *  that reconnecting without restarting was actually possible...)
79    */
80  enter:
81   authconn = aim_newconn(&aimsess, AIM_CONN_TYPE_AUTH, FAIM_LOGIN_SERVER);
82
83   if (authconn == NULL)
84     {
85       fprintf(stderr, "faimtest: internal connection error while in aim_login.  bailing out.\n");
86       return -1;
87     }
88   else if (authconn->fd == -1)
89     {
90       if (authconn->status & AIM_CONN_STATUS_RESOLVERR)
91         fprintf(stderr, "faimtest: could not resolve authorizer name\n");
92       else if (authconn->status & AIM_CONN_STATUS_CONNERR)
93         fprintf(stderr, "faimtest: could not connect to authorizer\n");
94       return -1;
95     }
96   else
97     {
98 #ifdef SNACLOGIN
99       /* new login code -- not default -- pending new password encryption algo */
100       aim_conn_addhandler(&aimsess, authconn, 0x0017, 0x0007, faimtest_parse_login, 0);
101       aim_conn_addhandler(&aimsess, authconn, 0x0017, 0x0003, faimtest_parse_authresp, 0);
102
103       aim_sendconnack(&aimsess, authconn);
104       aim_request_login(&aimsess, authconn, FAIMTEST_SCREENNAME);
105 #else
106       aim_conn_addhandler(&aimsess, authconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_AUTHSUCCESS, faimtest_parse_authresp, 0);
107       aim_conn_addhandler(&aimsess, authconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SERVERREADY, faimtest_authsvrready, 0);
108       aim_send_login(&aimsess, authconn, FAIMTEST_SCREENNAME, FAIMTEST_PASSWORD, &info);
109  
110 #endif
111     }
112
113   while (aim_select(&aimsess, NULL) > (struct aim_conn_t *)0)
114     {
115       if (aimsess.queue_outgoing)
116         aim_tx_flushqueue(&aimsess);
117
118       if (aim_get_command(&aimsess) < 0)
119         {
120           printf("\afaimtest: connection error!\n");
121         }
122       else
123         aim_rxdispatch(&aimsess);
124     }
125
126   /* Close up */
127   printf("AIM just decided we didn't need to be here anymore, closing up.,,\n");
128   
129   /* close up all connections, dead or no */
130   aim_logoff(&aimsess); 
131
132   if (stayconnected)
133     {
134       printf("\nTrying to reconnect in 2 seconds...\n");
135       sleep(2);
136       goto enter;
137     }
138
139   /* Get out */
140   exit(0);
141 }
142
143 int faimtest_serverready(struct aim_session_t *sess, struct command_rx_struct *command, ...)
144 {
145   switch (command->conn->type)
146     {
147     case AIM_CONN_TYPE_BOS:
148       aim_bos_reqrate(sess, command->conn); /* request rate info */
149       aim_bos_ackrateresp(sess, command->conn);  /* ack rate info response -- can we say timing? */
150       aim_bos_setprivacyflags(sess, command->conn, 0x00000003);
151       
152 #if 0
153       aim_bos_reqpersonalinfo(sess, command->conn);
154 #endif
155       
156       /* Request advertisement service -- see comment in handleredirect */
157       aim_bos_reqservice(sess, command->conn, AIM_CONN_TYPE_ADS);
158       aim_setversions(sess, command->conn);
159
160 #if 0
161       aim_bos_reqrights(sess, command->conn);
162       aim_bos_reqbuddyrights(sess, command->conn);
163       aim_bos_reqlocaterights(sess, command->conn);
164       aim_bos_reqicbmparaminfo(sess, command->conn);
165 #endif
166       
167       /* set group permissions */
168       aim_bos_setgroupperm(sess, command->conn, 0x1f);
169       fprintf(stderr, "faimtest: done with BOS ServerReady\n");
170       break;
171     case AIM_CONN_TYPE_CHATNAV:
172       fprintf(stderr, "faimtest: chatnav: got server ready\n");
173       break;
174     default:
175       fprintf(stderr, "faimtest: unknown connection type on Server Ready\n");
176     }
177   return 1;
178 }
179
180 /*
181   handleredirect()...
182
183   This, of course, handles Service Redirects from OSCAR.
184
185   Should get passed in the following:
186      struct command_rx_struct *command
187        the raw command data
188      int serviceid
189        the destination service ID
190      char *serverip
191        the IP address of the service's server
192      char *cookie
193        the raw auth cookie
194  */
195 int faimtest_handleredirect(struct aim_session_t *sess, struct command_rx_struct *command, ...)
196 {
197   va_list ap;
198   int serviceid;
199   char *ip;
200   char *cookie;
201
202   /* this is the new buddy list */
203   char buddies[] = "Buddy1&Buddy2&";
204   /* this is the new profile */
205   char profile[] = "Hello";  
206
207   va_start(ap, command);
208   serviceid = va_arg(ap, int);
209   ip = va_arg(ap, char *);
210   cookie = va_arg(ap, char *);
211   va_end(ap);
212
213   switch(serviceid)
214     {
215     case 0x0005: /* Advertisements */
216       /*
217        * The craziest explanation yet as to why we finish logging in when
218        * we get the advertisements redirect, of which we don't use anyway....
219        *                    IT WAS EASY!
220        */
221
222       /* send the buddy list and profile (required, even if empty) */
223       aim_bos_setbuddylist(sess, command->conn, buddies);
224       aim_bos_setprofile(sess, command->conn, profile);
225
226       /* send final login command (required) */
227       aim_bos_clientready(sess, command->conn); /* tell BOS we're ready to go live */
228
229       /* you should now be ready to go */
230       printf("\nYou are now officially online.\n");      
231
232       break;
233     case 0x0007: /* Authorizer */
234       {
235         struct aim_conn_t *tstconn;
236         /* Open a connection to the Auth */
237         tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, ip);
238         if ( (tstconn==NULL) || (tstconn->status >= AIM_CONN_STATUS_RESOLVERR) )
239           fprintf(stderr, "faimtest: unable to reconnect with authorizer\n");
240         else
241           /* Send the cookie to the Auth */
242           aim_auth_sendcookie(sess, tstconn, cookie);
243
244       }  
245       break;
246     case 0x000d: /* ChatNav */
247       {
248         struct aim_conn_t *tstconn = NULL;
249         tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, ip);
250         if ( (tstconn==NULL) || (tstconn->status >= AIM_CONN_STATUS_RESOLVERR))
251           {
252             fprintf(stderr, "faimtest: unable to connect to chatnav server\n");
253             return 1;
254           }
255         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_CTN, AIM_CB_SPECIAL_DEFAULT, aim_parse_unknown, 0);
256         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_GEN, AIM_CB_SPECIAL_DEFAULT, aim_parse_unknown, 0);
257         aim_auth_sendcookie(sess, tstconn, cookie);
258         fprintf(stderr, "\achatnav: connected\n");
259       }
260       break;
261     case 0x000e: /* Chat */
262       {
263 #if 0
264         struct aim_conn_t *tstconn = NULL;
265         tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, ip);
266         if ( (tstconn==NULL) || (tstconn->status >= AIM_CONN_STATUS_RESOLVERR))
267           {
268             fprintf(stderr, "faimtest: unable to connect to chat server\n");
269             return 1;
270           }
271         aim_auth_sendcookie(sess, aim_getconn_type(sess, AIM_CONN_TYPE_CHAT), cookie);
272         fprintf(stderr, "\achat: connected\n");
273 #endif
274       }
275       break;
276     default:
277       printf("uh oh... got redirect for unknown service 0x%04x!!\n", serviceid);
278       /* dunno */
279     }
280
281   return 1;
282 }
283
284 #if 0
285 int faimtest_auth_error(struct aim_session_t *sess, struct command_rx_struct *command, ...)
286 {
287   va_list ap;
288   char *errorurl;
289   short errorcode;
290
291   va_start(ap, command);
292   printf("Screen name: %s\n", sess->logininfo.screen_name);
293   errorurl = va_arg(ap, char *);
294   printf("Error URL: %s\n", errorurl);
295   errorcode = va_arg(ap, short);
296   printf("Error code: 0x%02x\n", errorcode);
297   va_end(ap);
298
299   aim_conn_close(aim_getconn_type(sess, AIM_CONN_TYPE_AUTH));
300   exit(0);
301   
302   return 0;
303 }
304 #endif
305
306 int faimtest_parse_authresp(struct aim_session_t *sess, struct command_rx_struct *command, ...)
307 {
308   struct aim_conn_t *bosconn = NULL;
309   
310
311   printf("Screen name: %s\n", sess->logininfo.screen_name);
312
313   /*
314    * Check for error.
315    */
316   if (sess->logininfo.errorcode)
317     {
318       printf("Login Error Code 0x%04x\n", sess->logininfo.errorcode);
319       printf("Error URL: %s\n", sess->logininfo.errorurl);
320       aim_conn_close(command->conn);
321       exit(0); /* XXX: should return in order to let the above things get free()'d. */
322     }
323
324   printf("Reg status: %2d\n", sess->logininfo.regstatus);
325   printf("Email: %s\n", sess->logininfo.email);
326   printf("BOS IP: %s\n", sess->logininfo.BOSIP);
327
328   printf("Closing auth connection...\n");
329   aim_conn_close(command->conn);
330   bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, sess->logininfo.BOSIP);
331   if (bosconn == NULL)
332     {
333       fprintf(stderr, "faimtest: could not connect to BOS: internal error\n");
334     }
335   else if (bosconn->status != 0)
336     {
337       fprintf(stderr, "faimtest: could not connect to BOS\n");
338     }
339   else
340     {
341       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0);
342       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SERVERREADY, faimtest_serverready, 0);
343       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATEINFO, NULL, 0);
344       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, faimtest_handleredirect, 0);
345       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_STS, AIM_CB_STS_SETREPORTINTERVAL, NULL, 0);
346       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, faimtest_parse_oncoming, 0);
347       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, faimtest_parse_offgoing, 0);
348       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, faimtest_parse_incoming_im, 0);
349       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, faimtest_parse_misses, 0);
350       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, faimtest_parse_misses, 0);
351       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, faimtest_parse_misses, 0);
352       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, faimtest_parse_misses, 0);
353       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, faimtest_parse_userinfo, 0);
354
355       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_CTN, AIM_CB_CTN_DEFAULT, aim_parse_unknown, 0);
356       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEFAULT, aim_parse_unknown, 0);
357       aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, faimtest_parse_motd, 0);
358       aim_auth_sendcookie(sess, bosconn, sess->logininfo.cookie);
359     }
360   return 1;
361 }
362
363 int faimtest_parse_userinfo(struct aim_session_t *sess, struct command_rx_struct *command, ...)
364 {
365   struct aim_userinfo_s *userinfo;
366   char *prof_encoding = NULL;
367   char *prof = NULL;
368
369   va_list ap;
370   va_start(ap, command);
371   userinfo = va_arg(ap, struct aim_userinfo_s *);
372   prof_encoding = va_arg(ap, char *);
373   prof = va_arg(ap, char *);
374   va_end(ap);
375   
376   printf("faimtest: userinfo: sn: %s\n", userinfo->sn);
377   printf("faimtest: userinfo: warnlevel: 0x%04x\n", userinfo->warnlevel);
378   printf("faimtest: userinfo: class: 0x%04x = ", userinfo->class);
379
380   /*
381    *  00000000  (binary)
382    *         1  Trial  
383    *        2   Unknown
384    *       3    AOL
385    *      4     Unknown
386    *     5      Free
387    * 
388    * ORed together.
389    *
390    */
391
392   if (userinfo->class & 0x0001)
393     printf("TRIAL ");
394   if (userinfo->class & 0x0002)
395     printf("UNKNOWN_BIT2 ");
396   if (userinfo->class & 0x0004)
397     printf("AOL ");
398   if (userinfo->class & 0x0008)
399     printf("UNKNOWN_BIT4 ");
400   if (userinfo->class & 0x0010)
401     printf("FREE ");
402   printf("\n");
403   
404   printf("faimtest: userinfo: membersince: %lu\n", userinfo->membersince);
405   printf("faimtest: userinfo: onlinesince: %lu\n", userinfo->onlinesince);
406   printf("faimtest: userinfo: idletime: 0x%04x\n", userinfo->idletime);
407   
408   printf("faimtest: userinfo: profile_encoding: %s\n", prof_encoding ? prof_encoding : "[none]");
409   printf("faimtest: userinfo: prof: %s\n", prof ? prof : "[none]");
410   
411   return 1;
412 }
413
414 /*
415  * The user-level Incoming ICBM callback.
416  *
417  * Arguments:
418  *  struct command_rx_struct *  command     if you feel like doing it yourself
419  *  char *                      srcsn       the source name
420  *  char *                      msg         message
421  *  int                         warnlevel   warning/evil level
422  *  int                         class       user class
423  *  ulong                       membersince time_t of date of signup
424  *  ulong                       onsince     time_t of date of singon
425  *  int                         idletime    min (sec?) idle
426  *  u_int                       icbmflags   sets AIM_IMFLAGS_{AWAY,ACK}
427  *
428  */
429 int faimtest_parse_incoming_im(struct aim_session_t *sess, struct command_rx_struct *command, ...)
430 {
431   struct aim_userinfo_s *userinfo;
432   char *msg = NULL;
433   u_int icbmflags = 0;
434   va_list ap;
435   char *tmpstr = NULL;
436   u_short flag1, flag2;
437
438   va_start(ap, command);
439   userinfo = va_arg(ap, struct aim_userinfo_s *);
440   msg = va_arg(ap, char *);
441   icbmflags = va_arg(ap, u_int);
442   flag1 = va_arg(ap, u_short);
443   flag2 = va_arg(ap, u_short);
444   va_end(ap);
445
446   printf("faimtest: icbm: sn = \"%s\"\n", userinfo->sn);
447   printf("faimtest: icbm: warnlevel = 0x%04x\n", userinfo->warnlevel);
448   printf("faimtest: icbm: class = 0x%04x ", userinfo->class);
449   if (userinfo->class & 0x0010)
450     printf("(FREE)\n");
451   else if (userinfo->class & 0x0001)
452     printf("(TRIAL)\n");
453   else if (userinfo->class & 0x0004)
454     printf("(AOL)\n");
455   else
456     printf("(UNKNOWN)\n");
457   printf("faimtest: icbm: membersince = %lu\n", userinfo->membersince);
458   printf("faimtest: icbm: onlinesince = %lu\n", userinfo->onlinesince);
459   printf("faimtest: icbm: idletime = 0x%04x\n", userinfo->idletime);
460
461   printf("faimtest: icbm: icbmflags = ");
462   if (icbmflags & AIM_IMFLAGS_AWAY)
463     printf("away ");
464   if (icbmflags & AIM_IMFLAGS_ACK)
465     printf("ackrequest ");
466   printf("\n");
467   
468   printf("faimtest: icbm: encoding flags = {%04x, %04x}\n", flag1, flag2);
469
470   printf("faimtest: icbm: message: %s\n", msg);
471
472   if (msg)
473     {
474       tmpstr = index(msg, '>');
475       if (tmpstr != NULL)
476         tmpstr+=1;
477       else
478         tmpstr = msg;
479       
480       if ( (strlen(tmpstr) >= 10) &&
481            (!strncmp(tmpstr, "disconnect", 10)) )
482         {
483           aim_send_im(sess, command->conn, "midendian", 0, "ta ta...");
484           aim_logoff(sess);
485         }
486       else if (strstr(tmpstr, "goodday"))
487         {
488           printf("faimtest: icbm: sending response\n");
489           aim_send_im(sess, command->conn, userinfo->sn, 0, "Good day to you too.");
490         }
491 #if 0
492       else if (!strncmp(tmpstr, "joinchat", 8))
493         {
494           aim_chat_join(sess, command->conn, "GoodDay");
495         }
496 #endif
497       else 
498         {
499 #if 0
500           printf("faimtest: icbm:  starting chat...\n");
501           aim_bos_reqservice(sess, command->conn, AIM_CONN_TYPE_CHATNAV);
502 #else
503           aim_bos_setidle(sess, command->conn, 0x0ffffffe);
504 #endif
505         }
506
507     }
508
509   printf("faimtest: icbm: done with ICBM handling\n");
510
511   return 1;
512 }
513
514 int faimtest_authsvrready(struct aim_session_t *sess, struct command_rx_struct *command, ...)
515 {
516   printf("faimtest_authsvrready: called (contype: %d)\n", command->conn->type);
517   sleep(10);
518   /* should just be able to tell it we're ready too... */
519   aim_auth_clientready(sess, command->conn);
520
521 #if 0
522   /*
523    * This is where you'd really begin changing your password.
524    *   However, this callback may get called for reasons other
525    *   than you wanting to change your password.  You should 
526    *   probably check that before actually doing it.
527    */
528   aim_auth_changepasswd(sess, command->conn, "PWD1", "PWD2");
529 #endif
530
531   return 1;
532 }
533
534 int faimtest_pwdchngdone(struct aim_session_t *sess, struct command_rx_struct *command, ...)
535 {
536   printf("PASSWORD CHANGE SUCCESSFUL!!!\n");
537   return 1;
538 }
539
540 int faimtest_parse_oncoming(struct aim_session_t *sess, struct command_rx_struct *command, ...)
541 {
542   struct aim_userinfo_s *userinfo;
543    
544   va_list ap;
545   va_start(ap, command);
546   userinfo = va_arg(ap, struct aim_userinfo_s *);
547   va_end(ap);
548
549   printf("\n%s is now online\n", userinfo->sn);
550
551   return 1;
552 }
553
554 int faimtest_parse_offgoing(struct aim_session_t *sess, struct command_rx_struct *command, ...)
555 {
556   char *sn;
557   va_list ap;
558   
559   va_start(ap, command);
560   sn = va_arg(ap, char *);
561   va_end(ap);
562
563   printf("\n%s has left\n", sn);
564
565   return 1;
566 }
567
568 int faimtest_parse_motd(struct aim_session_t *sess, struct command_rx_struct *command, ...)
569 {
570   char *msg;
571   u_short id;
572   va_list ap;
573   
574   va_start(ap, command);
575   id = va_arg(ap, u_short);
576   msg = va_arg(ap, char *);
577   va_end(ap);
578
579   printf("faimtest: motd: %s\n", msg);
580
581   return 1;
582 }
583
584 /* 
585  * Handles callbacks for: AIM_CB_RATECHANGE, AIM_CB_USERERROR, 
586  *   AIM_CB_MISSED_IM, and AIM_CB_MISSED_CALL.
587  */
588 int faimtest_parse_misses(struct aim_session_t *sess, struct command_rx_struct *command, ...)
589 {
590   u_short family;
591   u_short subtype;
592
593   family = aimutil_get16(command->data+0);
594   subtype= aimutil_get16(command->data+2);
595   
596   switch (family)
597     {
598     case 0x0001:
599       if (subtype == 0x000a) /* or AIM_CB_RATECHANGE */
600         printf("\n****STOP SENDING/RECIEVING MESSAGES SO FAST!****\n\n");
601       break;
602     case 0x0002:
603       if (subtype == 0x0001) /* or AIM_CB_USERERROR */
604         {
605           u_long snacid = 0x00000000;
606           
607           snacid = aimutil_get32(&command->data[6]);
608           
609           printf("Received unknown error in SNAC family 0x0002 (snacid = %08lx)\n", snacid);
610         }
611       break;
612     case 0x0004:
613       if (subtype == 0x0001) /* or AIM_CB_MISSED_IM */
614         printf("\n***LAST IM DIDN\'T MAKE IT BECAUSE THE BUDDY IS NOT ONLINE***\n\n");
615       else if (subtype == 0x000a) /* or AIM_CB_MISSED_CALL */
616         printf("You missed some messages from %s because they were sent too fast\n", &(command->data[13]));
617       break;
618     }
619
620   return 0;
621 }
622
623 #ifdef SNACLOGIN
624 int faimtest_parse_login(struct aim_session_t *sess, struct command_rx_struct *command, ...)
625 {
626   struct client_info_s info = {"FAIMtest (Hi guys!)", 3, 5, 1670, "us", "en"};
627   u_char authcookie[11];
628   int i;
629   
630   for (i = 0; i < (int)command->data[11]; i++)
631     authcookie[i] = command->data[12+i];
632   authcookie[i] = '\0';
633
634   printf("faimtest: logincookie: %s\n", authcookie);
635   
636   aim_send_login(sess, command->conn, FAIMTEST_SCREENNAME, FAIMTEST_PASSWORD, &info);
637  
638   return 1;
639 }
640 #endif
This page took 0.335794 seconds and 5 git commands to generate.