]> code.citadel.org Git - citadel.git/commitdiff
* Added client_icq.c and client_icq.h
authorArt Cancro <ajc@citadel.org>
Tue, 3 Aug 1999 11:34:35 +0000 (11:34 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 3 Aug 1999 11:34:35 +0000 (11:34 +0000)
citadel/ChangeLog
citadel/client_icq.c [new file with mode: 0644]
citadel/client_icq.h [new file with mode: 0644]

index 7838ac4e72133e62c6ee6d80eff866ab8d10d974..2432a5cb4710e33bf8aa06aeab0505a608c274c1 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 1.344  1999/08/03 11:34:35  ajc
+* Added client_icq.c and client_icq.h
+
 Revision 1.343  1999/08/03 03:14:51  ajc
 * Wrote the client side of the ICQ gateway.  Now on to other projects.  :)
 
@@ -1170,3 +1173,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
+
diff --git a/citadel/client_icq.c b/citadel/client_icq.c
new file mode 100644 (file)
index 0000000..176eefd
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Citadel/UX
+ *
+ * client_icq.c  --  manage Citadel ICQ configuration
+ *                    (the "single process" version - no more fork() anymore)
+ *
+ * $Id$
+ *
+ */
+
+#include "sysdep.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <string.h>
+#include <signal.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <stdarg.h>
+#include "citadel.h"
+#include "client_chat.h"
+#include "commands.h"
+#include "routines.h"
+#include "ipc.h"
+#include "citadel_decls.h"
+#include "tools.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
+extern struct CtdlServInfo serv_info;
+extern char temp[];
+void citedit(FILE *fp, long int base_pos);
+void getline(char *, int);
+
+struct icq_contact {
+       long uin;
+       char name[256];
+};
+
+
+/* 
+ * Do the Citadel ICQ client setup
+ */
+void setup_icq(void) {
+       char uin[32];
+       char pass[32];
+       char buf[256];
+       int i;
+       
+       struct icq_contact *contacts = NULL;
+       int num_contacts = 0;   
+       
+
+        printf("Do you want to enter your ICQ uin and password? ");
+        if (yesno()) {
+               newprompt("     Enter your ICQ UIN: ", uin, 31);
+               newprompt("Enter your ICQ password: ", pass, -31); 
+               if (atol(uin)<=0L) {
+                       printf("You must enter a UIN.  "
+                               "Citadel ICQ configuration aborted.\n");
+                       return;
+               }
+               sprintf(buf, "CICQ login|%s|%s|", uin, pass);
+               serv_puts(buf);
+               serv_gets(buf);
+               printf("%s\n", &buf[4]);
+               if (buf[0] != '2') return;
+       }
+
+       printf("Do you want to edit your ICQ contact list? ");
+        if (yesno()) {
+               serv_puts("CICQ getcl");
+               serv_gets(buf);
+               if (buf[0]=='1') while (serv_gets(buf), strcmp(buf, "000")) {
+                       contacts = realloc(contacts,
+                               (++num_contacts * sizeof(struct icq_contact)));
+                       contacts[num_contacts-1].uin =
+                               extract_long(buf, 0);
+                       extract(contacts[num_contacts-1].name, buf, 1);
+               }
+               if (num_contacts) for (i=0; i<num_contacts; ++i) {
+                       color(BRIGHT_WHITE);
+                       printf("%10ld ", contacts[i].uin);
+                       color(DIM_WHITE);
+                       printf("(");
+                       color(BRIGHT_CYAN);
+                       printf("%32s", contacts[i].name);
+                       color(DIM_WHITE);
+                       printf(") ... ");
+                       color(BRIGHT_YELLOW);
+                       printf("Keep (yes/no) ? ");
+                       color(DIM_WHITE);
+                       if (!yesno()) contacts[i].uin = 0L;
+               }
+
+               printf("Enter the UIN's of any additional contacts you\n");
+               printf("wish to add.  Enter a blank line when finished.\n");
+               do {
+                       newprompt("> ", buf, 32);
+                       if (atol(buf) > 0L) {
+                               contacts = realloc(contacts,
+                                       (++num_contacts * sizeof(struct icq_contact)));
+                               contacts[num_contacts-1].uin = atoi(buf);
+                       }
+               } while (strlen(buf) > 0);
+
+               serv_puts("CICQ putcl");
+               serv_gets(buf);
+               if (buf[0]=='4') {
+                       if (num_contacts) for (i=0; i<num_contacts; ++i) {
+                               sprintf(buf, "%ld", contacts[i].uin);
+                               serv_puts(buf);
+                       }
+                       if (num_contacts) free(contacts);
+                       serv_puts("000");
+               }
+       }
+}
diff --git a/citadel/client_icq.h b/citadel/client_icq.h
new file mode 100644 (file)
index 0000000..0ee9d4d
--- /dev/null
@@ -0,0 +1,2 @@
+/* $Id$ */
+void setup_icq(void);