-long DrawMessageDropdown(StrBuf *Selector, long maxmsgs, long startmsg, int nMessages, long starting_from)
-{
- StrBuf *TmpBuf;
- wcsession *WCC = WC;
- void *vMsg;
- int lo, hi;
- long ret;
- long hklen;
- const char *key;
- int nItems;
- HashPos *At;
- long vector[16];
- WCTemplputParams SubTP;
- int wantmore = 1;
-
- memset(&SubTP, 0, sizeof(WCTemplputParams));
- SubTP.Filter.ContextType = CTX_LONGVECTOR;
- SubTP.Context = &vector;
- TmpBuf = NewStrBufPlain(NULL, SIZ);
- At = GetNewHashPos(WCC->summ, nMessages);
- nItems = GetCount(WCC->summ);
- ret = nMessages;
- vector[0] = 7;
- vector[2] = 1;
- vector[1] = startmsg;
- vector[3] = 0;
- vector[7] = starting_from;
-
- while (wantmore)
- {
-
- vector[3] = abs(nMessages);
- lo = GetHashPosCounter(WCC->summ, At);
- wantmore = GetNextHashPos(WCC->summ, At, &hklen, &key, &vMsg);
- if (!wantmore)
- break;
- if (nMessages > 0) {
- if (lo + nMessages >= nItems) {
- hi = nItems - 1;
- vector[3] = nItems - lo;
- if (startmsg == lo)
- ret = vector[3];
- }
- else {
- hi = lo + nMessages - 1;
- }
- } else {
- if (lo + nMessages < -1) {
- hi = 0;
- }
- else {
- if ((lo % abs(nMessages)) != 0) {
- int offset = (lo % abs(nMessages) *
- (nMessages / abs(nMessages)));
- hi = lo + offset;
- vector[3] = abs(offset);
- if (startmsg == lo)
- ret = offset;
- }
- else
- hi = lo + nMessages;
- }
- }
-
- /*
- * Bump these because although we're thinking in zero base, the user
- * is a drooling idiot and is thinking in one base.
- */
- vector[4] = lo + 1;
- vector[5] = hi + 1;
- vector[6] = lo;
- FlushStrBuf(TmpBuf);
- dbg_print_longvector(vector);
- DoTemplate(HKEY("select_messageindex"), TmpBuf, &SubTP);
- StrBufAppendBuf(Selector, TmpBuf, 0);
- }
- vector[6] = 0;
- FlushStrBuf(TmpBuf);
- if (maxmsgs == 9999999) {
- vector[1] = 1;
- ret = maxmsgs;
- }
- else
- vector[1] = 0;
- vector[2] = 0;
- dbg_print_longvector(vector);
- DoTemplate(HKEY("select_messageindex_all"), TmpBuf, &SubTP);
- StrBufAppendBuf(Selector, TmpBuf, 0);
- FreeStrBuf(&TmpBuf);
- DeleteHashPos(&At);
- return ret;
-}
-
+struct bbsview {
+ long *msgs; /* Array of msgnums for messages we are displaying */
+ int num_msgs; /* Number of msgnums stored in 'msgs' */
+ long lastseen; /* The number of the last seen message in this room */
+ int alloc_msgs; /* Currently allocated size of array */
+ int requested_page; /* Which page number did the user request? */
+ int num_pages; /* Total number of pages in this room */
+ long start_reading_at; /* Start reading at the page containing this message */
+};