From: Wilfried Göesgens Date: Sat, 20 Dec 2008 18:29:24 +0000 (+0000) Subject: * msg_is_in_mset isn't here X-Git-Tag: v7.86~1689 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=8d1f422aa65bb9f488306f97bc5814bc37d4521a * msg_is_in_mset isn't here * move load_seen into its own function --- diff --git a/webcit/messages.c b/webcit/messages.c index c407bfba7..91fe9b82e 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -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; diff --git a/webcit/webcit.h b/webcit/webcit.h index 9fe3dfad1..70f1e3780 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -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);