]> andersk Git - libfaim.git/blobdiff - aim_auth.c
- Mon Feb 26 01:46:34 UTC 2001
[libfaim.git] / aim_auth.c
index 64c47ed4c42b6b409723b310c99616ab1d9f2da6..dcc354061014fe41cd92beaca6e65b72590f3131 100644 (file)
@@ -5,12 +5,13 @@
 
  */
 
+#define FAIM_INTERNAL
 #include <faim/aim.h> 
 
 /* this just pushes the passed cookie onto the passed connection -- NO SNAC! */
-int aim_auth_sendcookie(struct aim_session_t *sess, 
-                       struct aim_conn_t *conn, 
-                       u_char *chipsahoy)
+faim_export int aim_auth_sendcookie(struct aim_session_t *sess, 
+                                   struct aim_conn_t *conn, 
+                                   unsigned char *chipsahoy)
 {
   struct command_tx_struct *newpacket;
   int curbyte=0;
@@ -29,48 +30,43 @@ int aim_auth_sendcookie(struct aim_session_t *sess,
   return aim_tx_enqueue(sess, newpacket);
 }
 
-u_long aim_auth_clientready(struct aim_session_t *sess,
-                           struct aim_conn_t *conn)
+faim_export unsigned long aim_auth_clientready(struct aim_session_t *sess,
+                                              struct aim_conn_t *conn)
 {
+  struct aim_tool_version tools[] = {
+    {0x0001, 0x0003,    AIM_TOOL_NEWWIN, 0x0361},
+    {0x0007, 0x0001,    AIM_TOOL_NEWWIN, 0x0361},
+  };
+  int i,j;
   struct command_tx_struct *newpacket;
-  int curbyte = 0;
+  int toolcount = sizeof(tools)/sizeof(struct aim_tool_version);
 
-  if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 26)))
+  if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 1152)))
     return -1;
 
   newpacket->lock = 1;
 
-  curbyte += aim_putsnac(newpacket->data+curbyte, 0x0001, 0x0002, 0x0000, sess->snac_nextid);
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002);
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0013);
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0007);
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
-
-  aim_tx_enqueue(sess, newpacket);
+  i = aim_putsnac(newpacket->data, 0x0001, 0x0002, 0x0000, sess->snac_nextid);
+  aim_cachesnac(sess, 0x0001, 0x0002, 0x0000, NULL, 0);
 
-  {
-    struct aim_snac_t snac;
-    
-    snac.id = sess->snac_nextid;
-    snac.family = 0x0001;
-    snac.type = 0x0004;
-    snac.flags = 0x0000;
+  for (j = 0; j < toolcount; j++) {
+    i += aimutil_put16(newpacket->data+i, tools[j].group);
+    i += aimutil_put16(newpacket->data+i, tools[j].version);
+    i += aimutil_put16(newpacket->data+i, tools[j].tool);
+    i += aimutil_put16(newpacket->data+i, tools[j].toolversion);
+  }
 
-    snac.data = NULL;
+  newpacket->commandlen = i;
+  newpacket->lock = 0;
 
-    aim_newsnac(sess, &snac);
-  }
+  aim_tx_enqueue(sess, newpacket);
 
-  return (sess->snac_nextid++);
+  return sess->snac_nextid;
 }
 
-u_long aim_auth_changepasswd(struct aim_session_t *sess,
-                            struct aim_conn_t *conn, 
-                            char *new, char *current)
+faim_export unsigned long aim_auth_changepasswd(struct aim_session_t *sess,
+                                               struct aim_conn_t *conn, 
+                                               char *new, char *current)
 {
   struct command_tx_struct *newpacket;
   int i;
@@ -81,27 +77,109 @@ u_long aim_auth_changepasswd(struct aim_session_t *sess,
   newpacket->lock = 1;
 
   i = aim_putsnac(newpacket->data, 0x0007, 0x0004, 0x0000, sess->snac_nextid);
+  aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0);
 
-  /* current password TLV t(0002) */
-  i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(current), current);
+  /* new password TLV t(0002) */
+  i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(new), new);
 
-  /* new password TLV t(0012) */
-  i += aim_puttlv_str(newpacket->data+i, 0x0012, strlen(new), new);
+  /* current password TLV t(0012) */
+  i += aim_puttlv_str(newpacket->data+i, 0x0012, strlen(current), current);
 
   aim_tx_enqueue(sess, newpacket);
 
-  {
-    struct aim_snac_t snac;
-    
-    snac.id = sess->snac_nextid;
-    snac.family = 0x0001;
-    snac.type = 0x0004;
-    snac.flags = 0x0000;
+  return sess->snac_nextid;
+}
 
-    snac.data = NULL;
+faim_export unsigned long aim_auth_setversions(struct aim_session_t *sess,
+                                              struct aim_conn_t *conn)
+{
+  struct command_tx_struct *newpacket;
+  int i;
 
-    aim_newsnac(sess, &snac);
-  }
+  if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10 + (4*2))))
+    return -1;
+
+  newpacket->lock = 1;
+
+  i = aim_putsnac(newpacket->data, 0x0001, 0x0017, 0x0000, sess->snac_nextid);
+  aim_cachesnac(sess, 0x0001, 0x0017, 0x0000, NULL, 0);
+
+  i += aimutil_put16(newpacket->data+i, 0x0001);
+  i += aimutil_put16(newpacket->data+i, 0x0003);
+
+  i += aimutil_put16(newpacket->data+i, 0x0007);
+  i += aimutil_put16(newpacket->data+i, 0x0001);
+
+  newpacket->commandlen = i;
+  newpacket->lock = 0;
+  aim_tx_enqueue(sess, newpacket);
+
+  return sess->snac_nextid;
+}
+
+/*
+ * Request account confirmation. 
+ *
+ * This will cause an email to be sent to the address associated with
+ * the account.  By following the instructions in the mail, you can
+ * get the TRIAL flag removed from your account.
+ *
+ */
+faim_export unsigned long aim_auth_reqconfirm(struct aim_session_t *sess,
+                                             struct aim_conn_t *conn)
+{
+  return aim_genericreq_n(sess, conn, 0x0007, 0x0006);
+}
+
+/*
+ * Request a bit of account info.
+ *
+ * The only known valid tag is 0x0011 (email address).
+ *
+ */ 
+faim_export unsigned long aim_auth_getinfo(struct aim_session_t *sess,
+                                          struct aim_conn_t *conn,
+                                          unsigned short info)
+{
+  struct command_tx_struct *newpacket;
+  int i;
+
+  if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10 + 4)))
+    return -1;
+
+  newpacket->lock = 1;
+
+  i = aim_putsnac(newpacket->data, 0x0007, 0x0002, 0x0000, sess->snac_nextid);
+  aim_cachesnac(sess, 0x0002, 0x0002, 0x0000, NULL, 0);
+
+  i += aimutil_put16(newpacket->data+i, info);
+  i += aimutil_put16(newpacket->data+i, 0x0000);
+
+  newpacket->commandlen = i;
+  newpacket->lock = 0;
+  aim_tx_enqueue(sess, newpacket);
+
+  return sess->snac_nextid;
+}
+
+faim_export unsigned long aim_auth_setemail(struct aim_session_t *sess,
+                                           struct aim_conn_t *conn, 
+                                           char *newemail)
+{
+  struct command_tx_struct *newpacket;
+  int i;
+
+  if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+2+2+strlen(newemail))))
+    return -1;
+
+  newpacket->lock = 1;
+
+  i = aim_putsnac(newpacket->data, 0x0007, 0x0004, 0x0000, sess->snac_nextid);
+  aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0);
+
+  i += aim_puttlv_str(newpacket->data+i, 0x0011, strlen(newemail), newemail);
+
+  aim_tx_enqueue(sess, newpacket);
 
-  return (sess->snac_nextid++);
+  return sess->snac_nextid;
 }
This page took 0.042451 seconds and 4 git commands to generate.