Commit ecbf2a73 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Introduced FreeDownloadUserMsg text.dat string

Tired of being reminded that you were "awarded 0 credits"  for free downloads? I know I am, so I created another text.dat string (reusing Unused300), for notification of free-download files where no credits are awarded to the uploader. Also updated the default colors of the existing DownloadUserMsg string to have a little more variety.

Not sure why ftpsrvr.c isn't using user_downloaded_file(). That copy/pasta should be eliminated later.
parent 7723edad
Pipeline #2767 passed with stage
in 12 minutes and 23 seconds
......@@ -783,6 +783,7 @@ static void send_thread(void* arg)
ultoac(mod,tmp);
}
if(!(scfg.dir[f.dir]->misc&DIR_QUIET)) {
const char* prefix = xfer.filepos ? "partially FTP-" : "FTP-";
addr_len = sizeof(addr);
if(uploader.level>=SYSOP_LEVEL
&& getpeername(xfer.ctrl_sock,&addr.addr,&addr_len)==0
......@@ -791,10 +792,16 @@ static void send_thread(void* arg)
else
SAFECOPY(username,xfer.user->alias);
/* Inform uploader of downloaded file */
safe_snprintf(str,sizeof(str),text[DownloadUserMsg]
,getfname(xfer.filename)
,xfer.filepos ? "partially FTP-" : "FTP-"
,username,tmp);
if(mod == 0)
safe_snprintf(str,sizeof(str),text[FreeDownloadUserMsg]
,getfname(xfer.filename)
,prefix
,username);
else
safe_snprintf(str,sizeof(str),text[DownloadUserMsg]
,getfname(xfer.filename)
,prefix
,username,tmp);
putsmsg(&scfg,uploader.number,str);
}
}
......
......@@ -310,7 +310,7 @@ enum {
,TagFileQ
,TagFilePrompt
,Unused299
,Unused300
,FreeDownloadUserMsg
,FiAuthor
,FiGroup
,FileAlreadyInQueue
......
......@@ -482,7 +482,8 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x01\x68\x01\x79\x45\x6e\x74\x65\x72\x20\x28\x73\x70\x61\x63\x65\x2d\x73\x65\x70\x61\x72\x61\x74\x65\x64\x29\x20\x54\x61\x67\x73"
"\x3a\x20" // 298 TagFilePrompt
,"\x55\x4e\x55\x53\x45\x44\x32\x39\x39" // 299 Unused299
,"\x55\x4e\x55\x53\x45\x44\x33\x30\x30" // 300 Unused300
,"\x01\x5f\x01\x68\x01\x77\x25\x73\x01\x63\x20\x77\x61\x73\x20\x25\x73\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x65\x64\x20\x62\x79\x20\x01"
"\x77\x25\x73\x0d\x0a" // 300 FreeDownloadUserMsg
,"\x0d\x0a\x01\x6e\x01\x67\x41\x75\x74\x68\x6f\x72\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x25\x73" // 301 FiAuthor
,"\x0d\x0a\x01\x6e\x01\x67\x47\x72\x6f\x75\x70\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x25\x73" // 302 FiGroup
,"\x01\x77\x01\x68\x0d\x0a\x25\x73\x20\x69\x73\x20\x61\x6c\x72\x65\x61\x64\x79\x20\x69\x6e\x20\x74\x68\x65\x20\x71\x75\x65\x75\x65"
......@@ -503,9 +504,9 @@ const char * const text_defaults[TOTAL_TEXT]={
"\x4c\x4f\x41\x44\x45\x44\x21\x01\x6e\x0d\x0a" // 309 FileZeroLength
,"\x01\x5f\x01\x77\x01\x68\x25\x73\x20\x28\x25\x73\x20\x62\x79\x74\x65\x73\x29\x20\x72\x65\x63\x65\x69\x76\x65\x64\x2e\x0d\x0a" // 310 FileNBytesReceived
,"\x01\x5f\x01\x77\x01\x68\x25\x73\x20\x28\x25\x73\x20\x62\x79\x74\x65\x73\x29\x20\x73\x65\x6e\x74\x2e\x0d\x0a" // 311 FileNBytesSent
,"\x01\x5f\x01\x68\x01\x77\x25\x73\x20\x77\x61\x73\x20\x25\x73\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x65\x64\x20\x62\x79\x20\x25\x73\x0d"
"\x0a\x01\x6e\x01\x67\x59\x6f\x75\x20\x77\x65\x72\x65\x20\x61\x77\x61\x72\x64\x65\x64\x20\x25\x73\x20\x63\x72\x65\x64\x69\x74\x73"
"\x2e\x0d\x0a" // 312 DownloadUserMsg
,"\x01\x5f\x01\x68\x01\x77\x25\x73\x01\x63\x20\x77\x61\x73\x20\x25\x73\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x65\x64\x20\x62\x79\x20\x01"
"\x77\x25\x73\x0d\x0a\x01\x6e\x01\x67\x59\x6f\x75\x20\x77\x65\x72\x65\x20\x61\x77\x61\x72\x64\x65\x64\x20\x01\x68\x25\x73\x01\x6e"
"\x01\x67\x20\x63\x72\x65\x64\x69\x74\x73\x2e\x0d\x0a" // 312 DownloadUserMsg
,"\x70\x61\x72\x74\x69\x61\x6c\x6c\x79\x20" // 313 Partially
,"\x01\x6c\x01\x6e\x01\x67\x4c\x69\x62\x72\x61\x72\x79\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x28\x25\x75\x29\x20"
"\x25\x73" // 314 FiLib
......
......@@ -2531,10 +2531,16 @@ BOOL user_downloaded_file(scfg_t* cfg, user_t* user, client_t* client,
SAFECAT(prefix, "-");
}
/* Inform uploader of downloaded file */
SAFEPRINTF4(str, cfg->text[DownloadUserMsg]
,getfname(filename)
,prefix
,username, tmp);
if(mod == 0)
SAFEPRINTF3(str, cfg->text[FreeDownloadUserMsg]
,getfname(filename)
,prefix
,username);
else
SAFEPRINTF4(str, cfg->text[DownloadUserMsg]
,getfname(filename)
,prefix
,username, tmp);
putsmsg(cfg, uploader.number, str);
}
}
......
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