Skip to content
Snippets Groups Projects
Commit 8de13f8e authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Create sbbs_t::putnode_downloading()

Migrated from sbbs_t::start_batch_download(), this just calculates the ETA (of transfer completion) and writes to the node's aux field in the proper format.
parent 14125aa4
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -166,3 +166,22 @@ int sbbs_t::putnodeext(uint number, char *ext) ...@@ -166,3 +166,22 @@ int sbbs_t::putnodeext(uint number, char *ext)
return(0); return(0);
} }
bool sbbs_t::putnode_downloading(off_t size)
{
action = NODE_DLNG;
/* calculate ETA */
time_t t = now;
if(size < cur_cps)
++t;
else if(cur_cps > 0)
t += size / cur_cps;
struct tm tm;
if(localtime_r(&t, &tm) != NULL)
thisnode.aux = (tm.tm_hour * 60) + tm.tm_min;
if(getnodedat(cfg.node_num, &thisnode, /* lock-it: */true) != 0)
return false;
thisnode.action = action;
return putnodedat(cfg.node_num, &thisnode) == 0;
}
...@@ -969,6 +969,7 @@ public: ...@@ -969,6 +969,7 @@ public:
/* putnode.cpp */ /* putnode.cpp */
int putnodedat(uint number, node_t * node); int putnodedat(uint number, node_t * node);
int putnodeext(uint number, char * str); int putnodeext(uint number, char * str);
bool putnode_downloading(off_t size);
/* login.ccp */ /* login.ccp */
int login(const char *user_name, const char *pw_prompt, const char* user_pw = NULL, const char* sys_pw = NULL); int login(const char *user_name, const char *pw_prompt, const char* user_pw = NULL, const char* sys_pw = NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment