]> andersk Git - libfaim.git/commitdiff
- Thu Mar 23 08:45:40 UTC 2000
authormid <mid>
Thu, 23 Mar 2000 22:42:10 +0000 (22:42 +0000)
committermid <mid>
Thu, 23 Mar 2000 22:42:10 +0000 (22:42 +0000)
   - Removed aim_countconn() > 0 check in aim_select(), its logically redundent
   - Added aim_putuserinfo() (inverse of aim_extractuserinfo())
   - Added aim_sendbuddyoncoming/offgoing()
   - Rearranged loop in rxdispatch()
   - Remove aim_conn_close() if connections dead in aim_get_command()

CHANGES
aim_conn.c
aim_im.c
aim_info.c
aim_rxhandlers.c
aim_rxqueue.c
faim/aim.h

diff --git a/CHANGES b/CHANGES
index 17068a97b23c7733f239dc9865ba3addd7a546c7..e10031f8f9cf34114b1832f83c600e82af3a6f63 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,16 @@
 
 No release numbers
 ------------------
+ - Thu Mar 23 08:45:40 UTC 2000
+   - Removed aim_countconn() > 0 check in aim_select(), its logically redundent
+   - Added aim_putuserinfo() (inverse of aim_extractuserinfo())
+   - Added aim_sendbuddyoncoming/offgoing() 
+   - Rearranged loop in rxdispatch()
+   - Remove aim_conn_close() if connections dead in aim_get_command()
+
+ - Thu Mar 23 00:44:32 UTC 2000
+   - Added a check to purge_rxqueue to skip handled commands
+
  - Mon Mar 20 05:30:59 UTC 2000
    - Added some server-only functions for login
    - Added aim_counttlvchain()
index 5cb4a79fa14fd88d57b9445a45da3ca9da362a93..cb4d1b2372dc8bb9ae94b2c00b6fc9b9fe3386fc 100644 (file)
@@ -176,9 +176,6 @@ struct aim_conn_t *aim_select(struct aim_session_t *sess,
   fd_set fds;
   int i;
 
-  if (aim_countconn(sess) <= 0)
-    return 0;
-
   /* 
    * If we have data waiting to be sent, return immediatly
    */
index 3a777faa6819947c2883cdd194b1568658d311cb..838699212f0fd8d2890402010f79849ac7ddc50b 100644 (file)
--- a/aim_im.c
+++ b/aim_im.c
@@ -185,7 +185,8 @@ int aim_parse_incoming_im_middle(struct aim_session_t *sess,
    * features of AIM2/3/3.5. 
    *
    * Channel 0x0002 is the Rendevous channel, which
-   * is where Chat Invitiations come from.
+   * is where Chat Invitiations and various client-client
+   * connection negotiations come from.
    * 
    */
   channel = aimutil_get16(command->data+i);
index 384c9ce0b5221f7235ce02d2a5eca140ad64016e..8ba5878e3769104cbee701f274fab0f676d978ea 100644 (file)
@@ -364,3 +364,98 @@ int aim_parse_userinfo_middle(struct aim_session_t *sess,
 
   return 1;
 }
+
+/*
+ * Inverse of aim_extractuserinfo()
+ */
+int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info)
+{
+  int i = 0;
+  struct aim_tlvlist_t *tlvlist = NULL;
+
+  if (!buf || !info)
+    return 0;
+
+  i += aimutil_put8(buf+i, strlen(info->sn));
+  i += aimutil_putstr(buf+i, info->sn, strlen(info->sn));
+
+  i += aimutil_put16(buf+i, info->warnlevel);
+
+  /* XXX: we only put down five */
+  i += aimutil_put16(buf+i, 5);
+  aim_addtlvtochain16(&tlvlist, 0x0001, info->class);
+  aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince);
+  aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince);
+  aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime);
+  /* XXX: should put caps here */
+  aim_addtlvtochain32(&tlvlist, (info->class)&AIM_CLASS_AOL?0x0010:0x000f, info->sessionlen);
+  
+  i += aim_writetlvchain(buf+i, buflen-i, &tlvlist);
+  aim_freetlvchain(&tlvlist);
+  
+  return i;
+}
+
+int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info)
+{
+  struct command_tx_struct tx;
+  int i = 0;
+
+  if (!sess || !conn || !info)
+    return 0;
+
+  tx.conn = conn;
+
+  tx.commandlen = 1152; /* too big */
+  tx.data = malloc(tx.commandlen);
+  memset(tx.data, 0x00, tx.commandlen);
+  
+  tx.lock = 1;
+  tx.type = 0x02;
+
+  i += aimutil_put16(tx.data+i, 0x0003);
+  i += aimutil_put16(tx.data+i, 0x000b);
+  i += aimutil_put16(tx.data+i, 0x0000);
+  i += aimutil_put16(tx.data+i, 0x0000);
+  i += aimutil_put16(tx.data+i, 0x0000);
+
+  i += aim_putuserinfo(tx.data+i, tx.commandlen-i, info);
+
+  tx.commandlen = i;
+  tx.lock = 0;
+  aim_tx_enqueue(sess, &tx);
+
+  return 0;
+}
+
+int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn)
+{
+  struct command_tx_struct tx;
+  int i = 0;
+
+  if (!sess || !conn || !sn)
+    return 0;
+
+  tx.conn = conn;
+
+  tx.commandlen = 10 + 1 + strlen(sn);
+  tx.data = malloc(tx.commandlen);
+  memset(tx.data, 0x00, tx.commandlen);
+  
+  tx.lock = 1;
+  tx.type = 0x02;
+
+  i += aimutil_put16(tx.data+i, 0x0003);
+  i += aimutil_put16(tx.data+i, 0x000c);
+  i += aimutil_put16(tx.data+i, 0x0000);
+  i += aimutil_put16(tx.data+i, 0x0000);
+  i += aimutil_put16(tx.data+i, 0x0000);
+
+  i += aimutil_put8(tx.data+i, strlen(sn));
+  i += aimutil_putstr(tx.data+i, sn, strlen(sn));
+  
+  tx.lock = 0;
+  aim_tx_enqueue(sess, &tx);
+
+  return 0;
+}
index 7b0a0f94d81c3fcd00a5630c5eb6f2b9f7afa89d..5b2a1496d1af7d4468fba5a6ecebbbf69fb82e38 100644 (file)
@@ -304,10 +304,13 @@ int aim_rxdispatch(struct aim_session_t *sess)
     return 0;
   } else {
     workingPtr = sess->queue_incoming;
-    for (i = 0; workingPtr != NULL; i++) {
+    for (i = 0; workingPtr != NULL; workingPtr = workingPtr->next, i++) {
       /*
        * XXX: This is still fairly ugly.
        */
+      if (workingPtr->handled)
+       continue;
+
       switch(workingPtr->conn->type) {
       case -1:
        /*
@@ -547,8 +550,6 @@ int aim_rxdispatch(struct aim_session_t *sess)
        workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_UNKNOWN, workingPtr);
        break;
       }        
-      /* move to next command */
-      workingPtr = workingPtr->next;
     }
   }
 
index 88721c4a79d81d15e373a45cb9a222d0844b5f37..7ec7e13d5c394d187f26ca2af50f4e6323c7771a 100644 (file)
@@ -94,7 +94,7 @@ int aim_get_command(struct aim_session_t *sess)
       if ((err = aim_failsaferead(s, &(generic[i]), 1)) < 0)
        {
          /* error is probably not recoverable...(must be a pessimistic day) */
-         aim_conn_close(conn);
+         /* aim_conn_close(conn); */
          return err;
        }
 
index f67bbb858a840c2940aee7d8e413cb6ee2efd825..dc82d194c3acbe2854caed80cb15337a66498787 100644 (file)
@@ -396,6 +396,9 @@ int aim_extractuserinfo(u_char *, struct aim_userinfo_s *);
 int aim_parse_userinfo_middle(struct aim_session_t *, struct command_rx_struct *);
 int aim_parse_oncoming_middle(struct aim_session_t *, struct command_rx_struct *);
 int aim_parse_offgoing_middle(struct aim_session_t *, struct command_rx_struct *);
+int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info);
+int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info);
+int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn);
 
 /* aim_auth.c */
 int aim_auth_sendcookie(struct aim_session_t *, struct aim_conn_t *, u_char *);
This page took 0.081278 seconds and 5 git commands to generate.