]> code.citadel.org Git - citadel.git/blobdiff - citadel/messages.c
* Replaced all "Citadel/UX" references with "Citadel"
[citadel.git] / citadel / messages.c
index 54d8557ebadc6d418d0fb76c34dc40a1fdd118ba..f29dddfbe6554acea109c2deffd99311a8122ea2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * $Id$
  *
- * Citadel/UX message support routines
+ * Citadel message support routines
  * see copyright.txt for copyright information
  */
 
@@ -63,7 +63,7 @@ void sttybbs(int cmd);
 int haschar(const char *st, int ch);
 void getline(char *string, int lim);
 int file_checksum(char *filename);
-void progress(unsigned long curr, unsigned long cmax);
+void progress(CtdlIPC* ipc, unsigned long curr, unsigned long cmax);
 
 unsigned long *msg_arr = NULL;
 int msg_arr_size = 0;
@@ -73,7 +73,6 @@ char rc_reply_extedit;
 extern char room_name[];
 extern unsigned room_flags;
 extern long highest_msg_read;
-extern struct CtdlServInfo serv_info;
 extern char temp[];
 extern char temp2[];
 extern int screenwidth;
@@ -510,8 +509,8 @@ int read_message(CtdlIPC *ipc,
                }
                if (strlen(message->node)) {
                        if ((room_flags & QR_NETWORK)
-                           || ((strcasecmp(message->node, serv_info.serv_nodename)
-                            && (strcasecmp(message->node, serv_info.serv_fqdn))))) {
+                           || ((strcasecmp(message->node, ipc->ServInfo.nodename)
+                            && (strcasecmp(message->node, ipc->ServInfo.fqdn))))) {
                                if (strlen(message->email) == 0) {
                                        if (dest) {
                                                fprintf(dest, "@%s ", message->node);
@@ -524,7 +523,7 @@ int read_message(CtdlIPC *ipc,
                                }
                        }
                }
-               if (strcasecmp(message->hnod, serv_info.serv_humannode)
+               if (strcasecmp(message->hnod, ipc->ServInfo.humannode)
                    && (strlen(message->hnod)) && (!strlen(message->email))) {
                        if (dest) {
                                fprintf(dest, "(%s) ", message->hnod);
@@ -1434,7 +1433,7 @@ void image_view(CtdlIPC *ipc, unsigned long msg)
                                        size_t len;
        
                                        len = (size_t)extract_long(buf, 0);
-                                       progress(len, len);
+                                       progress(ipc, len, len);
                                        scr_flush();
                                        snprintf(tmp, sizeof tmp, "%s.%s",
                                                tmpnam(NULL),
@@ -1814,30 +1813,24 @@ RMSGREAD:       scr_flush();
             int lasta = a;
             for (finda = a; ((finda < num_msgs) && (finda >= 0)); finda += rdir)
               {
-                /* This is repetitively dumb, but that's what computers are for.
-                   We have to load up messages until we find one by us */
-                char buf[SIZ];
-                int founda = 0;
+               /* This is repetitively dumb, but that's what computers are for.
+                  We have to load up messages until we find one by us */
+               char buf[SIZ];
+               int founda = 0;
+               struct ctdlipcmessage *msg = NULL;
                 
                /* read the header so we can get 'from=' */
-                       snprintf(buf, sizeof buf, "MSG0 %ld|1", msg_arr[finda]);
-               CtdlIPC_putline(ipc, buf);
-               CtdlIPC_getline(ipc, buf);
-               while (CtdlIPC_getline(ipc, buf), strcmp(buf, "000")) 
-                  {
-                       if ((!strncasecmp(buf, "from=", 5)) && (finda != a)) /* Skip current message. */
-                     { 
-                        if (strcasecmp(buf+5, fullname) == 0)
-                          {
-                            a = lasta; /* meesa current */
-                            founda = 1;
-                          }
-                         }
-                 }
-                   /* we are now in synch with the server */
-                if (founda)
-                  break; /* for */
-                lasta = finda; /* keep one behind or we skip on the reentrance to the for */
+               r = CtdlIPCGetSingleMessage(ipc, msg_arr[finda], 1, 0, &msg, buf);
+               if (!strncasecmp(msg->author, fullname, sizeof(fullname))) {
+                       a = lasta; /* meesa current */
+                       founda = 1;
+               }
+
+               free(msg);
+
+               if (founda)
+                       break; /* for */
+               lasta = finda; /* keep one behind or we skip on the reentrance to the for */
               } /* for */
           } /* case 'y' */
       } /* switch */