* msg_is_in_mset isn't here
authorWilfried Göesgens <willi@citadel.org>
Sat, 20 Dec 2008 18:29:24 +0000 (18:29 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 20 Dec 2008 18:29:24 +0000 (18:29 +0000)
* move load_seen into its own function

webcit/messages.c
webcit/webcit.h

index c407bfba7e7968d7f76d4b2dbc92759d20db6cdf..91fe9b82e764a4e26ce8b3ca0f18c1f774177c42 100644 (file)
@@ -536,6 +536,39 @@ void DrawMessageDropdown(StrBuf *Selector, long maxmsgs, long startmsg)
        DeleteHashPos(&At);
 }
 
+void load_seen_flags(void)
+{
+       message_summary *Msg;
+       const char *HashKey;
+       long HKLen;
+       StrBuf *OldMsg = NewStrBuf();;
+       wcsession *WCC = WC;
+       HashPos *at;
+       void *vMsg;
+
+       serv_puts("GTSN");
+       StrBuf_ServGetln(OldMsg);
+       if (ChrPtr(OldMsg)[0] == '2') {
+               StrBufCutLeft(OldMsg, 4);
+       }
+       else {
+               FreeStrBuf(&OldMsg);
+               return;
+       }
+       at = GetNewHashPos(WCC->summ, 0);
+       while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
+               /** Are you a new message, or an old message? */
+               Msg = (message_summary*) vMsg;
+               if (is_msg_in_mset(ChrPtr(OldMsg), Msg->msgnum)) {
+                       Msg->is_new = 0;
+               }
+               else {
+                       Msg->is_new = 1;
+               }
+       }
+       FreeStrBuf(&OldMsg);
+       DeleteHashPos(&at);
+}
 
 extern readloop_struct rlid[];
 
@@ -552,7 +585,6 @@ void readloop(long oper)
        message_summary *Msg;
        char cmd[256] = "";
        char buf[SIZ];
-       char old_msgs[SIZ];
        int a = 0;
        int nummsgs;
        long startmsg = 0;
@@ -704,29 +736,7 @@ void readloop(long oper)
                }
        }
 
-       /* This is done to make it run faster; WC is a function */
-       if (load_seen){
-               void *vMsg;
-
-               strcpy(old_msgs, "");
-               serv_puts("GTSN");
-               serv_getln(buf, sizeof buf);
-               if (buf[0] == '2') {
-                       strcpy(old_msgs, &buf[4]);
-               }
-               at = GetNewHashPos(WCC->summ, 0);
-               while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
-                       /** Are you a new message, or an old message? */
-                       Msg = (message_summary*) vMsg;
-                       if (is_msg_in_mset(old_msgs, Msg->msgnum)) {
-                               Msg->is_new = 0;
-                       }
-                       else {
-                               Msg->is_new = 1;
-                       }
-               }
-               DeleteHashPos(&at);
-       }
+       if (load_seen) load_seen_flags();
 
        if (sortit) {
                CompareFunc SortIt;
index 9fe3dfad168a64d32f367913e067ead1569f6bcc..70f1e37806b078ac4d84c3a7d5fe5d0957a4d386 100644 (file)
@@ -899,7 +899,6 @@ StrBuf *get_ROOM_PREFS(const char *key, size_t keylen);
 #define set_room_pref(a, b, c) set_ROOM_PREFS(a, sizeof(a) - 1, b, c)
 void set_ROOM_PREFS(const char *key, size_t keylen, StrBuf *value, int save_to_server);
 
-int is_msg_in_mset(char *mset, long msgnum);
 void display_addressbook(long msgnum, char alpha);
 void offer_start_page(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType);
 void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext);