* Multiple files: Convert most remaining client code to use new Citadel IPC
authorMichael Hampton <io_error@uncensored.citadel.org>
Mon, 15 Mar 2004 16:36:51 +0000 (16:36 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Mon, 15 Mar 2004 16:36:51 +0000 (16:36 +0000)
  functions.  A few bits remain and will be converted when the chat system
  is rewritten.

citadel/ChangeLog
citadel/citadel.c
citadel/citadel_ipc.c
citadel/client_chat.c
citadel/commands.c
citadel/rooms.c
citadel/routines.c
citadel/routines2.c
citadel/sendcommand.c
citadel/userlist.c
citadel/whobbs.c

index 7525d25c4596c84aba23ee0ef7eaf3413c776f34..7231819aa09baaa6bacb0452512f62b67956f14c 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 614.77  2004/03/15 16:36:50  error
+ * Multiple files:  Convert most remaining client code to use new Citadel IPC
+   functions.  A few bits remain and will be converted when the chat system
+   is rewritten.
+
  Revision 614.76  2004/03/14 06:35:46  ajc
  * Cache IMAP "BODY" fetches in an already-converted format.  This speeds
    up clients like Mozilla and Thunderbird that request big messages in
@@ -5505,4 +5510,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index 22171d57a5ae8967fbfbf4abb96684410f2c4cae..d400ca56ca230e1381c477339986c33231bd1a01 100644 (file)
@@ -1151,7 +1151,7 @@ int main(int argc, char **argv)
 #endif
        ipc_for_signal_handlers = ipc;  /* KLUDGE cover your eyes */
 
-       CtdlIPC_getline(ipc, aaa);
+       CtdlIPC_chat_recv(ipc, aaa);
        if (aaa[0] != '2') {
                scr_printf("%s\n", &aaa[4]);
                logoff(ipc, atoi(aaa));
@@ -1408,14 +1408,16 @@ NEWUSR: if (strlen(rc_password) == 0) {
                                entmsg(ipc, 0, 2);
                                break;
                        case 78:
-                               newprompt("What do you want your username to be? ", aaa, 32);
-                               snprintf(bbb, sizeof bbb, "ENT0 2|0|0|0|%s", aaa);
-                               CtdlIPC_putline(ipc, bbb);
-                               CtdlIPC_getline(ipc, aaa);
-                               if (strncmp("200", aaa, 3))
-                                       scr_printf("\n%s\n", aaa);
-                               else
-                                       entmsg(ipc, 0, 0);
+                               {
+                                       /* Only m.author is used */
+                                       struct ctdlipcmessage m;
+                                       newprompt("What do you want your username to be? ", m.author, USERNAME_SIZE - 1);
+                                       r = CtdlIPCPostMessage(ipc, 2, &m, aaa);
+                                       if (r / 100 != 2)
+                                               scr_printf("%s\n", aaa);
+                                       else
+                                               entmsg(ipc, 0, 0);
+                               }
                                break;
                        case 5:                         /* <G>oto */
                                updatels(ipc);
index 7163617f1ce6f9ed7404bd584011b434a292210f..8e6c45c3deccb9c375e69935f44b389a1f995002 100644 (file)
@@ -77,8 +77,8 @@ static void endtls(SSL *ssl);
 static unsigned long id_callback(void);
 #endif /* THREADED_CLIENT */
 #endif /* HAVE_OPENSSL */
-/* static */ void CtdlIPC_getline(CtdlIPC* ipc, char *buf);
-/* static */ void CtdlIPC_putline(CtdlIPC *ipc, const char *buf);
+static void CtdlIPC_getline(CtdlIPC* ipc, char *buf);
+static void CtdlIPC_putline(CtdlIPC *ipc, const char *buf);
 
 
 /*
@@ -2802,7 +2802,7 @@ static unsigned long id_callback(void) {
 /*
  * input string from socket - implemented in terms of serv_read()
  */
-/* static */ void CtdlIPC_getline(CtdlIPC* ipc, char *buf)
+static void CtdlIPC_getline(CtdlIPC* ipc, char *buf)
 {
        int i;
 
@@ -2831,7 +2831,7 @@ void CtdlIPC_chat_recv(CtdlIPC* ipc, char* buf)
 /*
  * send line to server - implemented in terms of serv_write()
  */
-/* static */ void CtdlIPC_putline(CtdlIPC *ipc, const char *buf)
+static void CtdlIPC_putline(CtdlIPC *ipc, const char *buf)
 {
        /* error_printf("< %s\n", buf); */
        serv_write(ipc, buf, strlen(buf));
index 5b1351f7262f680919c403c1df71d66149a149fa..cf559526a3c00cf72826440f80d80c3afbd6337a 100644 (file)
@@ -71,8 +71,8 @@ void chatmode(CtdlIPC *ipc)
        struct timeval tv;
        int retval;
 
-       CtdlIPC_putline(ipc, "CHAT");
-       CtdlIPC_getline(ipc, buf);
+       CtdlIPC_chat_send(ipc, "CHAT");
+       CtdlIPC_chat_recv(ipc, buf);
        if (buf[0] != '8') {
                scr_printf("%s\n", &buf[4]);
                return;
@@ -102,7 +102,7 @@ void chatmode(CtdlIPC *ipc)
 
                /* If there's data from the server... */
                if (FD_ISSET(CtdlIPC_getsockfd(ipc), &rfds)) {
-                       CtdlIPC_getline(ipc, buf);
+                       CtdlIPC_chat_recv(ipc, buf);
                        recv_complete_line = 1;
                        goto RCL;       /* ugly, but we've gotta get out! */
                }
@@ -126,7 +126,7 @@ void chatmode(CtdlIPC *ipc)
 
                /* if the user hit return, send the line */
 RCL:           if (send_complete_line) {
-                       CtdlIPC_putline(ipc, wbuf);
+                       CtdlIPC_chat_send(ipc, wbuf);
                        last_transmit = time(NULL);
                        strcpy(wbuf, "");
                        send_complete_line = 0;
@@ -140,13 +140,13 @@ RCL:              if (send_complete_line) {
                                        pos = a;
                        }
                        if (pos == 0) {
-                               CtdlIPC_putline(ipc, wbuf);
+                               CtdlIPC_chat_send(ipc, wbuf);
                                last_transmit = time(NULL);
                                strcpy(wbuf, "");
                                send_complete_line = 0;
                        } else {
                                wbuf[pos] = 0;
-                               CtdlIPC_putline(ipc, wbuf);
+                               CtdlIPC_chat_send(ipc, wbuf);
                                last_transmit = time(NULL);
                                strcpy(wbuf, &wbuf[pos + 1]);
                        }
@@ -165,9 +165,9 @@ RCL:                if (send_complete_line) {
                                 * exiting chat.  This little dialog forces
                                 * everything to be hunky-dory.
                                 */
-                               CtdlIPC_putline(ipc, "ECHO __ExitingChat__");
+                               CtdlIPC_chat_send(ipc, "ECHO __ExitingChat__");
                                do {
-                                       CtdlIPC_getline(ipc, buf);
+                                       CtdlIPC_chat_recv(ipc, buf);
                                } while (strcmp(buf, "200 __ExitingChat__"));
                                return;
                        }
@@ -217,7 +217,7 @@ RCL:                if (send_complete_line) {
                 * server to prevent session timeout.
                 */
                if ((time(NULL) - last_transmit) >= S_KEEPALIVE) {
-                       CtdlIPC_putline(ipc, "NOOP");
+                       CtdlIPC_chat_send(ipc, "NOOP");
                        last_transmit = time(NULL);
                }
 
@@ -239,8 +239,8 @@ void page_user(CtdlIPC *ipc)
        if (ipc->ServInfo.paging_level == 0) {
                newprompt("Message: ", msg, 69);
                snprintf(buf, sizeof buf, "SEXP %s|%s", touser, msg);
-               CtdlIPC_putline(ipc, buf);
-               CtdlIPC_getline(ipc, buf);
+               CtdlIPC_chat_send(ipc, buf);
+               CtdlIPC_chat_recv(ipc, buf);
                if (!strncmp(buf, "200", 3)) {
                        strcpy(last_paged, touser);
                }
@@ -250,8 +250,8 @@ void page_user(CtdlIPC *ipc)
        /* new server -- use extended paging */
        else if (ipc->ServInfo.paging_level >= 1) {
                snprintf(buf, sizeof buf, "SEXP %s||", touser);
-               CtdlIPC_putline(ipc, buf);
-               CtdlIPC_getline(ipc, buf);
+               CtdlIPC_chat_send(ipc, buf);
+               CtdlIPC_chat_recv(ipc, buf);
                if (buf[0] != '2') {
                        scr_printf("%s\n", &buf[4]);
                        return;
@@ -263,16 +263,16 @@ void page_user(CtdlIPC *ipc)
                pagefp = fopen(temp, "r");
                unlink(temp);
                snprintf(buf, sizeof buf, "SEXP %s|-", touser);
-               CtdlIPC_putline(ipc, buf);
-               CtdlIPC_getline(ipc, buf);
+               CtdlIPC_chat_send(ipc, buf);
+               CtdlIPC_chat_recv(ipc, buf);
                if (buf[0] == '4') {
                        strcpy(last_paged, touser);
                        while (fgets(buf, sizeof buf, pagefp) != NULL) {
                                buf[strlen(buf) - 1] = 0;
-                               CtdlIPC_putline(ipc, buf);
+                               CtdlIPC_chat_send(ipc, buf);
                        }
                        fclose(pagefp);
-                       CtdlIPC_putline(ipc, "000");
+                       CtdlIPC_chat_send(ipc, "000");
                        scr_printf("Message sent.\n");
                } else {
                        scr_printf("%s\n", &buf[4]);
index 26128b995de8599153447788157e48cd91bc2e14..149f09581a03628d519db4ce67a9360305f5e794 100644 (file)
@@ -377,7 +377,7 @@ static void really_do_keepalive(void) {
         */
        if ( (keepalives_enabled == KA_HALF)
           && (ipc_for_signal_handlers->ServInfo.supports_qnop > 0) ) {
-               CtdlIPC_putline(ipc_for_signal_handlers, "QNOP");
+               CtdlIPC_chat_send(ipc_for_signal_handlers, "QNOP");
        }
 }
 
@@ -1631,7 +1631,7 @@ char keymenu(char *menuprompt, char *menustring) {
                                        scr_printf(" ");
                                }
                        }
-                       scr_printf(" -> ");
+                       scr_printf("-> ");
                        display_prompt = 0;
                }
                ch = lkey();
@@ -1660,7 +1660,7 @@ char keymenu(char *menuprompt, char *menustring) {
                                                        scr_putc(buf[a]);
                                                }
                                        }
-                                       scr_printf("\n\n");
+                                       scr_printf("\n");
                                        return ch;
                                }
                        }
index 91220feddae754eaf3fc22f49806668d2b0e5c4a..3125a0874fe4849ad2a7efbbd08f8f959094f4ea 100644 (file)
@@ -845,19 +845,23 @@ void roomdir(CtdlIPC *ipc)
        char flsz[32];
        char comment[SIZ];
        char buf[SIZ];
+       char *listing = NULL;   /* Returned directory listing */
+       int r;
 
-       CtdlIPC_putline(ipc, "RDIR");
-       CtdlIPC_getline(ipc, buf);
-       if (buf[0] != '1') {
-               pprintf("%s\n", &buf[4]);
+       r = CtdlIPCReadDirectory(ipc, &listing, buf);
+       if (r / 100 != 1) {
+               pprintf("%s\n", buf);
                return;
        }
 
-       extract(comment, &buf[4], 0);
-       extract(flnm, &buf[4], 1);
+       extract(comment, buf, 0);
+       extract(flnm, buf, 1);
        pprintf("\nDirectory of %s on %s\n", flnm, comment);
        pprintf("-----------------------\n");
-       while (CtdlIPC_getline(ipc, buf), strcmp(buf, "000")) {
+       while (*listing && strlen(listing)) {
+               extract_token(buf, listing, 0, '\n');
+               remove_token(listing, 0, '\n');
+
                extract(flnm, buf, 0);
                extract(flsz, buf, 1);
                extract(comment, buf, 2);
@@ -1107,19 +1111,19 @@ void do_edit(CtdlIPC *ipc,
        fp = fopen(temp, "w");
        fclose(fp);
 
-       CtdlIPC_putline(ipc, check_cmd);
-       CtdlIPC_getline(ipc, cmd);
+       CtdlIPC_chat_send(ipc, check_cmd);
+       CtdlIPC_chat_recv(ipc, cmd);
        if (cmd[0] != '2') {
                scr_printf("%s\n", &cmd[4]);
                return;
        }
 
        if (strlen(editor_paths[0]) > 0) {
-               CtdlIPC_putline(ipc, read_cmd);
-               CtdlIPC_getline(ipc, cmd);
+               CtdlIPC_chat_send(ipc, read_cmd);
+               CtdlIPC_chat_recv(ipc, cmd);
                if (cmd[0] == '1') {
                        fp = fopen(temp, "w");
-                       while (CtdlIPC_getline(ipc, cmd), strcmp(cmd, "000")) {
+                       while (CtdlIPC_chat_recv(ipc, cmd), strcmp(cmd, "000")) {
                                fprintf(fp, "%s\n", cmd);
                        }
                        fclose(fp);
@@ -1163,8 +1167,8 @@ void do_edit(CtdlIPC *ipc,
        }
 
        else {
-               CtdlIPC_putline(ipc, write_cmd);
-               CtdlIPC_getline(ipc, cmd);
+               CtdlIPC_chat_send(ipc, write_cmd);
+               CtdlIPC_chat_recv(ipc, cmd);
                if (cmd[0] != '4') {
                        scr_printf("%s\n", &cmd[4]);
                        return;
@@ -1173,10 +1177,10 @@ void do_edit(CtdlIPC *ipc,
                fp = fopen(temp, "r");
                while (fgets(cmd, SIZ - 1, fp) != NULL) {
                        cmd[strlen(cmd) - 1] = 0;
-                       CtdlIPC_putline(ipc, cmd);
+                       CtdlIPC_chat_send(ipc, cmd);
                }
                fclose(fp);
-               CtdlIPC_putline(ipc, "000");
+               CtdlIPC_chat_send(ipc, "000");
        }
 
        unlink(temp);
index cfae5d1831b099d7e6477aadb1f5ae29ea4e2c53..cb002dd5cba3d769b5f32d7bbd088fd9c3f22a2f 100644 (file)
@@ -493,12 +493,12 @@ void locate_host(CtdlIPC* ipc, char *hbuf)
 void misc_server_cmd(CtdlIPC *ipc, char *cmd) {
        char buf[SIZ];
 
-       CtdlIPC_putline(ipc, cmd);
-       CtdlIPC_getline(ipc, buf);
+       CtdlIPC_chat_send(ipc, cmd);
+       CtdlIPC_chat_recv(ipc, buf);
        scr_printf("%s\n",buf);
        if (buf[0]=='1') {
                set_keepalives(KA_HALF);
-               while (CtdlIPC_getline(ipc, buf), strcmp(buf,"000")) {
+               while (CtdlIPC_chat_recv(ipc, buf), strcmp(buf,"000")) {
                        scr_printf("%s\n",buf);
                }
                set_keepalives(KA_YES);
@@ -507,7 +507,7 @@ void misc_server_cmd(CtdlIPC *ipc, char *cmd) {
        if (buf[0]=='4') {
                do {
                        newprompt("> ",buf,255);
-                       CtdlIPC_putline(ipc, buf);
+                       CtdlIPC_chat_send(ipc, buf);
                } while(strcmp(buf,"000"));
                return;
        }
index 6b280dd0fd5d85f058e348530cbc58da3960e4c3..b5ee17f19a6cae42f6fb801a1e782687322bf495 100644 (file)
@@ -908,6 +908,7 @@ void do_internet_configuration(CtdlIPC *ipc)
        int badkey;
        int i, j;
        int quitting = 0;
+       int modified = 0;
        int r;
        
        r = CtdlIPCGetSystemConfigByType(ipc, INTERNETCFG, &resp, buf);
@@ -959,6 +960,7 @@ void do_internet_configuration(CtdlIPC *ipc)
                                                        &buf[strlen(buf)]);
                                        recs[num_recs-1] = strdup(buf);
                                }
+                               modified = 1;
                                break;
                        case 'd':
                                i = intprompt("Delete which one",
@@ -967,6 +969,7 @@ void do_internet_configuration(CtdlIPC *ipc)
                                --num_recs;
                                for (j=i; j<num_recs; ++j)
                                        recs[j] = recs[j+1];
+                               modified = 1;
                                break;
                        case 's':
                                r = 1;
@@ -984,17 +987,19 @@ void do_internet_configuration(CtdlIPC *ipc)
                                r = CtdlIPCSetSystemConfigByType(ipc, INTERNETCFG, resp, buf);
                                if (r / 100 != 4) {
                                        err_printf("%s\n", buf);
+                               } else {
+                                       scr_printf("Wrote %d records.\n", num_recs);
+                                       modified = 0;
                                }
-                               quitting = 1;
                                break;
                        case 'q':
-                               quitting = boolprompt(
+                               quitting = !modified || boolprompt(
                                        "Quit without saving", 0);
                                break;
                        default:
                                badkey = 1;
                }
-       } while (quitting == 0);
+       } while (!quitting);
 
        if (recs != NULL) {
                for (i=0; i<num_recs; ++i) free(recs[i]);
@@ -1089,16 +1094,21 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment)
 
        if (e_ex_code == 0) {           /* Save changes */
                changefp = fopen(changefile, "w");
-               CtdlIPC_putline(ipc, "GNET");
-               CtdlIPC_getline(ipc, buf);
-               if (buf[0] == '1') {
-                       while(CtdlIPC_getline(ipc, buf), strcmp(buf, "000")) {
+               r = CtdlIPCGetRoomNetworkConfig(ipc, &listing, buf);
+               if (r / 100 == 1) {
+                       while(listing && strlen(listing)) {
+                               extract_token(buf, listing, 0, '\n');
+                               remove_token(listing, 0, '\n');
                                extract(instr, buf, 0);
                                if (strcasecmp(instr, entrytype)) {
                                        fprintf(changefp, "%s\n", buf);
                                }
                        }
                }
+               if (listing) {
+                       free(listing);
+                       listing = NULL;
+               }
                tempfp = fopen(filename, "r");
                while (fgets(buf, sizeof buf, tempfp) != NULL) {
                        for (i=0; i<strlen(buf); ++i) {
@@ -1113,19 +1123,15 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment)
                fclose(changefp);
 
                /* now write it to the server... */
-               CtdlIPC_putline(ipc, "SNET");
-               CtdlIPC_getline(ipc, buf);
-               if (buf[0] == '4') {
-                       changefp = fopen(changefile, "r");
-                       if (changefp != NULL) {
-                               while (fgets(buf, sizeof buf,
-                                      changefp) != NULL) {
-                                       buf[strlen(buf) - 1] = 0;
-                                       CtdlIPC_putline(ipc, buf);
-                               }
-                               fclose(changefp);
+               changefp = fopen(changefile, "r");
+               if (changefp != NULL) {
+                       listing = load_message_from_file(changefp);
+                       if (listing) {
+                               r = CtdlIPCSetRoomNetworkConfig(ipc, listing, buf);
+                               free(listing);
+                               listing = NULL;
                        }
-                       CtdlIPC_putline(ipc, "000");
+                       fclose(changefp);
                }
        }
 
@@ -1145,6 +1151,7 @@ void do_ignet_configuration(CtdlIPC *ipc) {
        int badkey;
        int i, j;
        int quitting = 0;
+       int modified = 0;
        char *listing = NULL;
        int r;
 
@@ -1192,6 +1199,7 @@ void do_ignet_configuration(CtdlIPC *ipc) {
                scr_printf("%-3s\n", buf);
                color(DIM_WHITE);
                }
+               scr_printf("\n");
 
                ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
                switch(ch) {
@@ -1212,6 +1220,7 @@ void do_ignet_configuration(CtdlIPC *ipc) {
                                strprompt("Enter port number  : ",
                                        &buf[strlen(buf)-3], 5);
                                recs[num_recs-1] = strdup(buf);
+                               modified = 1;
                                break;
                        case 'd':
                                i = intprompt("Delete which one",
@@ -1220,6 +1229,7 @@ void do_ignet_configuration(CtdlIPC *ipc) {
                                --num_recs;
                                for (j=i; j<num_recs; ++j)
                                        recs[j] = recs[j+1];
+                               modified = 1;
                                break;
                        case 's':
                                r = 1;
@@ -1237,17 +1247,19 @@ void do_ignet_configuration(CtdlIPC *ipc) {
                                r = CtdlIPCSetSystemConfigByType(ipc, IGNETCFG, listing, buf);
                                if (r / 100 != 4) {
                                        scr_printf("%s\n", buf);
+                               } else {
+                                       scr_printf("Wrote %d records.\n", num_recs);
+                                       modified = 0;
                                }
-                               quitting = 1;
                                break;
                        case 'q':
-                               quitting = boolprompt(
+                               quitting = !modified || boolprompt(
                                        "Quit without saving", 0);
                                break;
                        default:
                                badkey = 1;
                }
-       } while (quitting == 0);
+       } while (!quitting);
 
        if (recs != NULL) {
                for (i=0; i<num_recs; ++i) free(recs[i]);
@@ -1267,6 +1279,7 @@ void do_filterlist_configuration(CtdlIPC *ipc)
        int badkey;
        int i, j;
        int quitting = 0;
+       int modified = 0;
        char *listing = NULL;
        int r;
 
@@ -1330,6 +1343,7 @@ void do_filterlist_configuration(CtdlIPC *ipc)
                                        &buf[strlen(buf)], 16);
                                strcat(buf, "|");
                                recs[num_recs-1] = strdup(buf);
+                               modified = 1;
                                break;
                        case 'd':
                                i = intprompt("Delete which one",
@@ -1338,6 +1352,7 @@ void do_filterlist_configuration(CtdlIPC *ipc)
                                --num_recs;
                                for (j=i; j<num_recs; ++j)
                                        recs[j] = recs[j+1];
+                               modified = 1;
                                break;
                        case 's':
                                r = 1;
@@ -1355,17 +1370,19 @@ void do_filterlist_configuration(CtdlIPC *ipc)
                                r = CtdlIPCSetSystemConfigByType(ipc, FILTERLIST, listing, buf);
                                if (r / 100 != 4) {
                                        scr_printf("%s\n", buf);
+                               } else {
+                                       scr_printf("Wrote %d records.\n", num_recs);
+                                       modified = 0;
                                }
-                               quitting = 1;
                                break;
                        case 'q':
-                               quitting = boolprompt(
+                               quitting = !modified || boolprompt(
                                        "Quit without saving", 0);
                                break;
                        default:
                                badkey = 1;
                }
-       } while (quitting == 0);
+       } while (!quitting);
 
        if (recs != NULL) {
                for (i=0; i<num_recs; ++i) free(recs[i]);
index 8bbed185d4d128b9f9e3e86ee1f2574d5275950c..222f339e9959009228d11000b85a3110bc625ad9 100644 (file)
@@ -114,7 +114,7 @@ void np_attach_to_server(void)
        strcpy(portbuf, ".");   /* IPGM will refuse to run on the network */
        fprintf(stderr, "Attaching to server...\n");
        ipc = CtdlIPC_new(1, args, hostbuf, portbuf);
-       CtdlIPC_getline(ipc, buf);
+       CtdlIPC_chat_recv(ipc, buf);
        fprintf(stderr, "%s\n", &buf[4]);
        snprintf(buf, sizeof buf, "IPGM %d", config.c_ipgm_secret);
        r = CtdlIPCInternalProgram(ipc, config.c_ipgm_secret, buf);
@@ -169,12 +169,12 @@ int main(int argc, char **argv)
        fflush(stderr);
 
        fprintf(stderr, "%s\n", cmd);
-       CtdlIPC_putline(ipc, cmd);
-       CtdlIPC_getline(ipc, buf);
+       CtdlIPC_chat_send(ipc, cmd);
+       CtdlIPC_chat_recv(ipc, buf);
        fprintf(stderr, "%s\n", buf);
 
        if (buf[0] == '1') {
-               while (CtdlIPC_getline(ipc, buf), strcmp(buf, "000")) {
+               while (CtdlIPC_chat_recv(ipc, buf), strcmp(buf, "000")) {
                        printf("%s\n", buf);
                }
        } else if (buf[0] == '4') {
@@ -188,9 +188,9 @@ int main(int argc, char **argv)
                                if (buf[strlen(buf) - 1] == '\r')
                                        buf[strlen(buf) - 1] = 0;
                        if (strcmp(buf, "000"))
-                               CtdlIPC_putline(ipc, buf);
+                               CtdlIPC_chat_send(ipc, buf);
                } while (strcmp(buf, "000"));
-               CtdlIPC_putline(ipc, "000");
+               CtdlIPC_chat_send(ipc, "000");
        }
        fprintf(stderr, "sendcommand: processing ended.\n");
        cleanup(0);
index 7df54c9e5ddeb32901e74e919cd05400cd0544a6..9c23f189133d0bc3a1cd970c5e87a7ff7f99e41e 100644 (file)
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
        CtdlIPC *ipc = NULL;
 
        ipc = CtdlIPC_new(argc, argv, hostbuf, portbuf);
-       CtdlIPC_getline(ipc, buf);
+       CtdlIPC_chat_recv(ipc, buf);
        if ((buf[0]!='2')&&(strncmp(buf,"551",3))) {
                fprintf(stderr,"%s: %s\n",argv[0],&buf[4]);
                logoff(atoi(buf));
index 2dd59ef793f446ea4e2a0990b8795cba0e347bc8..42cba2227fb2b86d86d81e42fc882c635395bb04 100644 (file)
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
                fprintf(stderr, "Server not available: %s\n", strerror(errno));
                logoff(errno);
        }
-       CtdlIPC_getline(ipc, buf);
+       CtdlIPC_chat_recv(ipc, buf);
        if ((buf[0]!='2')&&(strncmp(buf,"551",3))) {
                fprintf(stderr,"%s: %s\n",argv[0],&buf[4]);
                logoff(atoi(buf));