Index: ChangeLog
===================================================================
--- ChangeLog	(revision b0430a683d52c6a111698411501de4c752a24641)
+++ ChangeLog	(revision 952bb256ee34cacb75564c94ce839869ad7c017e)
@@ -1,4 +1,9 @@
 $Id$
 
+2.1.1-pre-2
+	Added the 'aim search' command.  The popup on callback may be
+	  dangerous, should switch to an admin msg for results, or add a
+	  new event queue
+	
 2.1.1-pre-1
 	Only print forced AIM logout message once.
Index: aim.c
===================================================================
--- aim.c	(revision c8735aa93281dbf3405f1ca5c7a2db4bdb96c59c)
+++ aim.c	(revision 952bb256ee34cacb75564c94ce839869ad7c017e)
@@ -280,4 +280,16 @@
 }
 
+void owl_aim_search(char *email)
+{
+  int ret;
+
+  owl_function_debugmsg("owl_aim_search: doing search for %s", email);
+  ret=aim_search_address(owl_global_get_aimsess(&g), 
+			 aim_getconn_type(owl_global_get_aimsess(&g), AIM_CONN_TYPE_BOS),
+			 email);
+
+  if (ret) owl_function_error("owl_aim_search: aim_search_address returned %i", ret);
+}
+
 
 int owl_aim_set_awaymsg(char *msg)
@@ -571,6 +583,13 @@
   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE,         faimtest_parse_ratechange, 0);
   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL,               faimtest_parse_evilnotify, 0);
+
   aim_conn_addhandler(sess, bosconn, 0x000a,         0x0001,                        faimtest_parse_searcherror, 0);
   aim_conn_addhandler(sess, bosconn, 0x000a,         0x0003,                        faimtest_parse_searchreply, 0);
+
+  /*
+  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, faimtest_parse_searcherror, 0);
+  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, faimtest_parse_searchreply, 0);
+  */
+  
   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR,              faimtest_parse_msgerr, 0);
   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO,           faimtest_parse_userinfo, 0);
@@ -1822,4 +1841,5 @@
   char *address, *SNs;
   int num, i;
+  owl_list list;
   
   va_start(ap, fr);
@@ -1828,12 +1848,15 @@
   SNs = va_arg(ap, char *);
   va_end(ap);
+
+  owl_list_create(&list);
   
   owl_function_debugmsg("faimtest_parse_searchreply: E-Mail Search Results for %s: ", address);
-  
-  for(i = 0; i < num; i++) {
+  for (i=0; i<num; i++) {
     owl_function_debugmsg("  %s", &SNs[i*(MAXSNLEN+1)]);
-  }
-  
-  return 1;
+    owl_list_append_element(&list, &SNs[i*(MAXSNLEN+1)]);
+  }
+  owl_function_aimsearch_results(address, &list);
+  owl_list_free_simple(&list);
+  return(1);
 }
 
@@ -1846,8 +1869,9 @@
   address = va_arg(ap, char *);
   va_end(ap);
-  
+
+  owl_function_error("No results searching for %s", address);
   owl_function_debugmsg("faimtest_parse_searcherror: E-Mail Search Results for %s: No Results or Invalid Email\n", address);
   
-  return 1;
+  return(1);
 }
 
Index: commands.c
===================================================================
--- commands.c	(revision 2674412c0adaeea507e6503a0552d66507ce2604)
+++ commands.c	(revision 952bb256ee34cacb75564c94ce839869ad7c017e)
@@ -237,4 +237,9 @@
 	      "source <filename>",
 	      "Execute the owl commands in <filename>.\n"),
+
+  OWLCMD_ARGS("aim", owl_command_aim, OWL_CTX_INTERACTIVE,
+	      "AIM specific commands",
+	      "aim search <email>",
+	      ""),
 
   OWLCMD_ARGS("addbuddy", owl_command_addbuddy, OWL_CTX_INTERACTIVE,
@@ -961,4 +966,24 @@
   sprintf(buff, "Owl version %s", OWL_VERSION_STRING);
   owl_function_makemsg(buff);
+}
+
+char *owl_command_aim(int argc, char **argv, char *buff)
+{
+  if (argc<2) {
+    owl_function_makemsg("not enough arguments to aim command");
+    return(NULL);
+  }
+
+  if (!strcmp(argv[1], "search")) {
+    if (argc!=3) {
+      owl_function_makemsg("not enough arguments to aim search command");
+      return(NULL);
+    }
+    owl_aim_search(argv[2]);
+  } else {
+    owl_function_makemsg("unknown subcommand '%s' for aim command");
+    return(NULL);
+  }
+  return(NULL);
 }
 
Index: functions.c
===================================================================
--- functions.c	(revision 2de4f206ba6966298557091b6bf7d2a02d9cdae8)
+++ functions.c	(revision 952bb256ee34cacb75564c94ce839869ad7c017e)
@@ -3426,2 +3426,23 @@
 #endif
 }
+
+void owl_function_aimsearch_results(char *email, owl_list *namelist)
+{
+  owl_fmtext fm;
+  int i, j;
+
+  owl_fmtext_init_null(&fm);
+  owl_fmtext_append_normal(&fm, "AIM screennames associated with ");
+  owl_fmtext_append_normal(&fm, email);
+  owl_fmtext_append_normal(&fm, ":\n");
+
+  j=owl_list_get_size(namelist);
+  for (i=0; i<j; i++) {
+    owl_fmtext_append_normal(&fm, "  ");
+    owl_fmtext_append_normal(&fm, owl_list_get_element(namelist, i));
+    owl_fmtext_append_normal(&fm, "\n");
+  }
+
+  owl_function_popless_fmtext(&fm);
+  owl_fmtext_free(&fm);
+}
Index: owl.h
===================================================================
--- owl.h	(revision 5a95b694a7bf7fc985f38c07fa998fbb8ce63d7d)
+++ owl.h	(revision 952bb256ee34cacb75564c94ce839869ad7c017e)
@@ -20,6 +20,6 @@
 static const char owl_h_fileIdent[] = "$Id$";
 
-#define OWL_VERSION         2.1.1-pre-1
-#define OWL_VERSION_STRING "2.1.1-pre-1"
+#define OWL_VERSION         2.1.1-pre-2
+#define OWL_VERSION_STRING "2.1.1-pre-2"
 
 /* Feature that is being tested to redirect stderr through a pipe. 
