4 * client_icq.c -- manage Citadel ICQ configuration
5 * (the "single process" version - no more fork() anymore)
21 #include <sys/types.h>
24 #include "client_chat.h"
28 #include "citadel_decls.h"
34 extern struct CtdlServInfo serv_info;
36 void getline(char *, int);
45 * Do the Citadel ICQ client setup
47 void setup_icq(void) {
53 struct icq_contact *contacts = NULL;
57 printf("Do you want to enter your ICQ uin and password? ");
59 newprompt(" Enter your ICQ UIN: ", uin, 31);
60 newprompt("Enter your ICQ password: ", pass, -31);
62 printf("You must enter a UIN. "
63 "Citadel ICQ configuration aborted.\n");
66 sprintf(buf, "CICQ login|%s|%s|", uin, pass);
69 printf("%s\n", &buf[4]);
70 if (buf[0] != '2') return;
73 printf("Do you want to edit your ICQ contact list? ");
75 serv_puts("CICQ getcl");
77 if (buf[0]=='1') while (serv_gets(buf), strcmp(buf, "000")) {
78 contacts = realloc(contacts,
79 (++num_contacts * sizeof(struct icq_contact)));
80 contacts[num_contacts-1].uin =
82 extract(contacts[num_contacts-1].name, buf, 1);
84 if (num_contacts) for (i=0; i<num_contacts; ++i) {
86 printf("%10ld ", contacts[i].uin);
90 printf("%32s", contacts[i].name);
94 printf("Keep (yes/no) ? ");
96 if (!yesno()) contacts[i].uin = 0L;
99 printf("Enter the UIN's of any additional contacts you\n");
100 printf("wish to add. Enter a blank line when finished.\n");
102 newprompt("> ", buf, 32);
103 if (atol(buf) > 0L) {
104 contacts = realloc(contacts,
105 (++num_contacts * sizeof(struct icq_contact)));
106 contacts[num_contacts-1].uin = atoi(buf);
108 } while (strlen(buf) > 0);
110 serv_puts("CICQ putcl");
113 if (num_contacts) for (i=0; i<num_contacts; ++i) {
114 sprintf(buf, "%ld", contacts[i].uin);
117 if (num_contacts) free(contacts);