- cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
- if (cdbfr != NULL) {
- msglist = realloc(msglist, (num_msgs * sizeof(long)) + cdbfr->len + 1);
- memcpy(&msglist[num_msgs], cdbfr->ptr, cdbfr->len);
- num_msgs += (cdbfr->len / sizeof(long));
- cdb_free(cdbfr);
- }
- }
- }
-
- /*
- * Search-reduce the results if we have the full text index available
- */
- if (CtdlGetConfigInt("c_enable_fulltext")) {
- CtdlModuleDoSearch(&fts_num_msgs, &fts_msgs, search_string, "fulltext");
- if (fts_msgs) {
- for (i=0; i<num_msgs; ++i) {
- search_match = 0;
- for (j=0; j<fts_num_msgs; ++j) {
- if (msglist[i] == fts_msgs[j]) {
- search_match = 1;
- j = fts_num_msgs + 1; /* end the search */
+ num_msgs = CtdlFetchMsgList(CC->room.QRnumber, &msglist);
+
+ // Search-reduce the results if we have the full text index available
+ if (CtdlGetConfigInt("c_enable_fulltext")) {
+ CtdlModuleDoSearch(&fts_num_msgs, &fts_msgs, search_string, "fulltext");
+ if (fts_msgs) {
+ for (i=0; i<num_msgs; ++i) {
+ search_match = 0;
+ for (j=0; j<fts_num_msgs; ++j) {
+ if (msglist[i] == fts_msgs[j]) {
+ search_match = 1;
+ j = fts_num_msgs + 1; // end the search
+ }
+ }
+ if (!search_match) {
+ msglist[i] = 0; // invalidate this result
+ }