Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 9083c998 authored by rswindell's avatar rswindell

Fix vote importing from QWK/REP packets

- wasn't opening sub-board correctly (now using new smb_open_sub)
- for single-hope QWK packets, wasn't setting the sender netaddr (QWK-ID)
parent 2bfd3b01
......@@ -1002,7 +1002,7 @@ int sbbs_t::set_qwk_flag(ulong flag)
return putuserrec(&cfg,useron.number,U_QWK,8,ultoa(useron.qwk,str,16));
}
bool sbbs_t::qwk_voting(const char* fname, smb_net_type_t net_type)
bool sbbs_t::qwk_voting(const char* fname, smb_net_type_t net_type, const char* qnet_id)
{
FILE *fp;
str_list_t ini;
......@@ -1036,9 +1036,12 @@ bool sbbs_t::qwk_voting(const char* fname, smb_net_type_t net_type)
msg.hdr.attr = MSG_VOTE;
msg.hdr.vote = iniGetShortInt(ini, votes[u], "vote", 0);
}
if(net_type != NET_NONE)
smb_hfield_netaddr(&msg
,SENDERNETADDR, iniGetString(ini,votes[u], smb_hfieldtype(SENDERNETADDR), NULL, NULL), &net_type);
if(net_type != NET_NONE) {
char* netaddr = iniGetString(ini,votes[u], smb_hfieldtype(SENDERNETADDR), NULL, NULL);
if(netaddr == NULL)
netaddr = qnet_id;
smb_hfield_netaddr(&msg, SENDERNETADDR, netaddr, &net_type);
}
uint subnum = resolve_qwkconf(iniGetInteger(ini, votes[u], "Conference", 0));
if(subnum == INVALID_SUB)
continue;
......@@ -1049,9 +1052,8 @@ bool sbbs_t::qwk_voting(const char* fname, smb_net_type_t net_type)
smb_close(&smb);
smb.subnum = INVALID_SUB;
}
if(smb_open(&smb) != SMB_SUCCESS)
if(smb_open_sub(&cfg, &smb, subnum) != SMB_SUCCESS)
continue;
smb.subnum = subnum;
}
int i;
if((i=votemsg(&cfg, &smb, &msg, text[msg.hdr.attr == MSG_UPVOTE ? MsgUpVoteNotice:MsgDownVoteNotice])) != SMB_SUCCESS)
......
......@@ -643,11 +643,12 @@ public:
int loadmsg(smbmsg_t *msg, ulong number);
void show_msgattr(ushort attr);
void show_msghdr(smbmsg_t* msg);
void show_msg(smbmsg_t* msg, long mode);
void show_msg(smbmsg_t* msg, long mode, post_t* post = NULL);
void msgtotxt(smbmsg_t* msg, char *str, bool header, ulong mode);
ulong getlastmsg(uint subnum, uint32_t *ptr, time_t *t);
time_t getmsgtime(uint subnum, ulong ptr);
ulong getmsgnum(uint subnum, time_t t);
ulong total_votes(post_t* post);
/* readmail.cpp */
void readmail(uint usernumber, int sent);
......@@ -889,7 +890,7 @@ public:
void qwksetptr(uint subnum, char *buf, int reset);
void qwkcfgline(char *buf,uint subnum);
int set_qwk_flag(ulong flag);
bool qwk_voting(const char* fname, smb_net_type_t);
bool qwk_voting(const char* fname, smb_net_type_t, const char* qnet_id);
/* pack_qwk.cpp */
bool pack_qwk(char *packet, ulong *msgcnt, bool prepack);
......
......@@ -332,7 +332,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
SAFEPRINTF(fname, "%sVOTING.DAT", cfg.temp_dir);
if(fexistcase(fname)) {
qwk_voting(fname, NET_QWK);
qwk_voting(fname, NET_QWK, cfg.qhub[hubnum]->id);
remove(fname);
}
......
......@@ -544,7 +544,7 @@ bool sbbs_t::unpack_rep(char* repfile)
bputs(text[R_Voting]);
else {
set_qwk_flag(QWK_VOTING);
qwk_voting(fname, (useron.rest&FLAG('Q')) ? NET_QWK : NET_NONE);
qwk_voting(fname, (useron.rest&FLAG('Q')) ? NET_QWK : NET_NONE, /* QWKnet ID : */useron.alias);
}
remove(fname);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment