Unlimited reply link chain (max was 30 replies)
This commit is contained in:
@@ -39,6 +39,8 @@
|
||||
#include <gvidall.h>
|
||||
#include <gmsgattr.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Internet name typedefs
|
||||
@@ -180,37 +182,53 @@ Line* AddHexdump(Line*& line, void* data, size_t datalen);
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
class gmsg_links {
|
||||
|
||||
class gmsg_links
|
||||
{
|
||||
private:
|
||||
|
||||
enum { list_limit = 29 };
|
||||
|
||||
uint32_t reply_to;
|
||||
uint32_t reply_first;
|
||||
uint32_t reply_list[list_limit];
|
||||
uint32_t reply_next;
|
||||
|
||||
std::vector<uint32_t> reply_list;
|
||||
|
||||
public:
|
||||
|
||||
void reset() {
|
||||
void reset()
|
||||
{
|
||||
reply_to = reply_first = reply_next = 0;
|
||||
for(int n=0; n<list_max(); n++)
|
||||
reply_list[n] = 0;
|
||||
reply_list.clear();
|
||||
}
|
||||
|
||||
int list_max() const { return list_limit; }
|
||||
int list_max() const { return reply_list.size(); }
|
||||
|
||||
void to_set(uint32_t m) { reply_to = m; }
|
||||
void first_set(uint32_t m) { reply_first = m; }
|
||||
void list_set(int n, uint32_t m) { reply_list[n] = m; }
|
||||
void next_set(uint32_t m) { reply_next = m; }
|
||||
|
||||
|
||||
void list_set(size_t n, uint32_t m)
|
||||
{
|
||||
size_t size = reply_list.size();
|
||||
if (n >= size)
|
||||
{
|
||||
for (size_t i = size; i <= n; i++)
|
||||
reply_list.push_back(0);
|
||||
}
|
||||
|
||||
reply_list[n] = m;
|
||||
}
|
||||
|
||||
uint32_t to() const { return reply_to; }
|
||||
uint32_t first() const { return reply_first; }
|
||||
uint32_t list(int n) const { return reply_list[n]; }
|
||||
uint32_t next() const { return reply_next; }
|
||||
|
||||
uint32_t list(size_t n) const
|
||||
{
|
||||
if (n >= reply_list.size())
|
||||
return 0;
|
||||
|
||||
return reply_list[n];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -276,7 +294,7 @@ public:
|
||||
|
||||
uint board; // Board number (if applicable)
|
||||
|
||||
uint32_t msgno; // Message number
|
||||
uint32_t msgno; // Message number
|
||||
gmsg_links link; // Message reply links
|
||||
|
||||
ftn_addr oorig; // Original origination address
|
||||
|
@@ -313,10 +313,12 @@ int JamArea::load_message(int __mode, gmsg* __msg, JamHdr& __hdr) {
|
||||
throw_free(_subfield);
|
||||
|
||||
// Get reply numbers in chain
|
||||
if(wide->lookreplies and __msg->link.first()) {
|
||||
if (wide->lookreplies and __msg->link.first())
|
||||
{
|
||||
int r = 0;
|
||||
uint32_t m = __msg->link.first();
|
||||
while(m and (r < __msg->link.list_max())) {
|
||||
while (m)
|
||||
{
|
||||
JamHdr _rhdr;
|
||||
memset(&_rhdr, 0, sizeof(JamHdr));
|
||||
lseekset(data->fhjdx, m-data->hdrinfo.basemsgnum, sizeof(JamIndex));
|
||||
@@ -324,8 +326,7 @@ int JamArea::load_message(int __mode, gmsg* __msg, JamHdr& __hdr) {
|
||||
lseekset(data->fhjhr, _idx.hdroffset);
|
||||
read(data->fhjhr, &_rhdr, sizeof(JamHdr));
|
||||
m = _rhdr.replynext;
|
||||
if(m)
|
||||
__msg->link.list_set(r++, m);
|
||||
if (m) __msg->link.list_set(r++, m);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -107,8 +107,9 @@ int SquishArea::load_message(int __mode, gmsg* __msg, SqshHdr& __hdr) {
|
||||
// Convert link.list
|
||||
int q = 0;
|
||||
int r = __hdr.replies[0] == __hdr.replies[1] ? 2 : 1;
|
||||
while(r<=8) {
|
||||
if(__hdr.replies[r] and __hdr.replies[r-1] != __hdr.replies[r])
|
||||
while (r <= 8)
|
||||
{
|
||||
if (__hdr.replies[r] and __hdr.replies[r-1] != __hdr.replies[r])
|
||||
__msg->link.list_set(q++, __hdr.replies[r]);
|
||||
r++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user