|
|
1.1 root 1: /* msgtoqwk.cpp */
2:
3: /* Synchronet message to QWK format conversion routine */
4:
1.1.1.2 ! root 5: /* $Id: msgtoqwk.cpp,v 1.37 2011/07/21 11:28:22 rswindell Exp $ */
1.1 root 6:
7: /****************************************************************************
8: * @format.tab-size 4 (Plain Text/Source Code File Header) *
9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
10: * *
1.1.1.2 ! root 11: * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
1.1 root 12: * *
13: * This program is free software; you can redistribute it and/or *
14: * modify it under the terms of the GNU General Public License *
15: * as published by the Free Software Foundation; either version 2 *
16: * of the License, or (at your option) any later version. *
17: * See the GNU General Public License for more details: gpl.txt or *
18: * http://www.fsf.org/copyleft/gpl.html *
19: * *
20: * Anonymous FTP access to the most recent released source is available at *
21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
22: * *
23: * Anonymous CVS access to the development source and modification history *
24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
26: * (just hit return, no password is necessary) *
27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
28: * *
29: * For Synchronet coding style and modification guidelines, see *
30: * http://www.synchro.net/source.html *
31: * *
32: * You are encouraged to submit any modifications (preferably in Unix diff *
33: * format) via e-mail to [email protected] *
34: * *
35: * Note: If this box doesn't appear square, then you need to fix your tabs. *
36: ****************************************************************************/
37:
38: #include "sbbs.h"
39: #include "qwk.h"
40:
41: #define MAX_MSGNUM 0x7FFFFFUL // only 7 (decimal) digits allowed for msg num
42:
43: /****************************************************************************/
44: /* Converts message 'msg' to QWK format, writing to file 'qwk_fp'. */
45: /* mode determines how to handle Ctrl-A codes */
46: /****************************************************************************/
47: ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum
1.1.1.2 ! root 48: , int conf, FILE* hdrs)
1.1 root 49: {
50: char str[512],from[512],to[512],ch=0,tear=0,tearwatch=0,*buf,*p;
1.1.1.2 ! root 51: char asc;
! 52: char msgid[256];
1.1 root 53: char tmp[512];
54: long l,size=0,offset;
55: int i;
1.1.1.2 ! root 56: ushort hfield_type;
1.1 root 57: struct tm tm;
58: smbmsg_t remsg;
1.1.1.2 ! root 59: time_t tt;
1.1 root 60:
1.1.1.2 ! root 61: offset=(long)ftell(qwk_fp);
! 62: if(hdrs!=NULL) {
! 63: fprintf(hdrs,"[%x]\n",offset);
! 64:
! 65: /* Message-IDs */
! 66: fprintf(hdrs,"Message-ID: %s\n",get_msgid(&cfg,subnum,msg,msgid,sizeof(msgid)));
! 67: if(msg->reply_id!=NULL)
! 68: fprintf(hdrs,"In-Reply-To: %s\n",msg->reply_id);
! 69:
! 70: /* Time/Date/Zone info */
! 71: fprintf(hdrs,"WhenWritten: %-20s %04hx\n"
! 72: ,xpDateTime_to_isoDateTimeStr(
! 73: time_to_xpDateTime(msg->hdr.when_written.time,smb_tzutc(msg->hdr.when_written.zone))
! 74: ,/* separators: */"","","", /* precision: */0
! 75: ,str,sizeof(str))
! 76: ,msg->hdr.when_written.zone
! 77: );
! 78: fprintf(hdrs,"WhenImported: %-20s %04hx\n"
! 79: ,xpDateTime_to_isoDateTimeStr(
! 80: time_to_xpDateTime(msg->hdr.when_imported.time,smb_tzutc(msg->hdr.when_imported.zone))
! 81: ,/* separators: */"","","", /* precision: */0
! 82: ,str,sizeof(str))
! 83: ,msg->hdr.when_imported.zone
! 84: );
! 85: fprintf(hdrs,"WhenExported: %-20s %04hx\n"
! 86: ,xpDateTime_to_isoDateTimeStr(
! 87: xpDateTime_now()
! 88: ,/* separators: */"","","", /* precision: */0
! 89: ,str,sizeof(str))
! 90: ,sys_timezone(&cfg)
! 91: );
! 92: fprintf(hdrs,"ExportedFrom: %s %s %lu\n"
! 93: ,cfg.sys_id
! 94: ,subnum==INVALID_SUB ? "mail":cfg.sub[subnum]->code
! 95: ,msg->hdr.number
! 96: );
! 97:
! 98: /* SENDER */
! 99: fprintf(hdrs,"%s: %s\n",smb_hfieldtype(SENDER),msg->from);
! 100: if(msg->from_net.type)
! 101: fprintf(hdrs,"%s: %s\n",smb_hfieldtype(SENDERNETADDR),smb_netaddrstr(&msg->from_net,tmp));
! 102: if((p=(char*)smb_get_hfield(msg,hfield_type=SENDERIPADDR,NULL))!=NULL)
! 103: fprintf(hdrs,"%s: %s\n",smb_hfieldtype(hfield_type),p);
! 104: if((p=(char*)smb_get_hfield(msg,hfield_type=SENDERHOSTNAME,NULL))!=NULL)
! 105: fprintf(hdrs,"%s: %s\n",smb_hfieldtype(hfield_type),p);
! 106: if((p=(char*)smb_get_hfield(msg,hfield_type=SENDERPROTOCOL,NULL))!=NULL)
! 107: fprintf(hdrs,"%s: %s\n",smb_hfieldtype(hfield_type),p);
! 108: if(msg->from_org!=NULL)
! 109: fprintf(hdrs,"Organization: %s\n",msg->from_org);
! 110: else if(msg->from_net.type==NET_NONE)
! 111: fprintf(hdrs,"Organization: %s\n",cfg.sys_name);
! 112:
! 113: /* Reply-To */
! 114: if((p=(char*)smb_get_hfield(msg,RFC822REPLYTO,NULL))==NULL) {
! 115: if(msg->replyto_net.type==NET_INTERNET)
! 116: p=(char*)msg->replyto_net.addr;
! 117: else if(msg->replyto!=NULL)
! 118: p=msg->replyto;
! 119: }
! 120: if(p!=NULL)
! 121: fprintf(hdrs,"Reply-To: %s\n",p); /* use original RFC822 header field */
! 122:
! 123: /* SUBJECT */
! 124: fprintf(hdrs,"%s: %s\n",smb_hfieldtype(SUBJECT),msg->subj);
! 125:
! 126: /* RECIPIENT */
! 127: fprintf(hdrs,"%s: %s\n",smb_hfieldtype(RECIPIENT),msg->to);
! 128: if(msg->to_net.type)
! 129: fprintf(hdrs,"%s: %s\n",smb_hfieldtype(RECIPIENTNETADDR),smb_netaddrstr(&msg->to_net,tmp));
! 130:
! 131: /* FidoNet */
! 132: if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOAREA,NULL))!=NULL)
! 133: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 134: if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOSEENBY,NULL))!=NULL)
! 135: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 136: if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOPATH,NULL))!=NULL)
! 137: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 138: if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOMSGID,NULL))!=NULL)
! 139: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 140: if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOREPLYID,NULL))!=NULL)
! 141: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 142: if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOPID,NULL))!=NULL)
! 143: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 144: if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOFLAGS,NULL))!=NULL)
! 145: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 146: if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOTID,NULL))!=NULL)
! 147: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 148:
! 149: /* Synchronet */
! 150: if((p=(char*)smb_get_hfield(msg,hfield_type=SMB_EDITOR,NULL))!=NULL)
! 151: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 152:
! 153: /* USENET */
! 154: if((p=(char*)smb_get_hfield(msg,hfield_type=USENETPATH,NULL))!=NULL)
! 155: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 156: if((p=(char*)smb_get_hfield(msg,hfield_type=USENETNEWSGROUPS,NULL))!=NULL)
! 157: fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p);
! 158:
! 159: /* RFC822 header fields: */
! 160: for(i=0;i<msg->total_hfields;i++)
! 161: if(msg->hfield[i].type==RFC822HEADER)
! 162: fprintf(hdrs,"%s\n",truncsp_lines((char*)msg->hfield_dat[i]));
! 163:
! 164: /* Blank line: */
! 165: fprintf(hdrs,"\n");
! 166: }
! 167:
! 168: fprintf(qwk_fp,"%*s",QWK_BLOCK_LEN,""); /* Init header to space */
! 169:
! 170: /* QWKE compatible kludges */
! 171: SAFECOPY(from,msg->from);
! 172: if(msg->from_net.addr && (uint)subnum==INVALID_SUB && !(mode&QM_TO_QNET)) {
! 173: if(msg->from_net.type==NET_FIDO)
1.1 root 174: sprintf(from,"%.128s@%.128s"
175: ,msg->from,smb_faddrtoa((faddr_t *)msg->from_net.addr,tmp));
1.1.1.2 ! root 176: else if(msg->from_net.type==NET_INTERNET || strchr((char*)msg->from_net.addr,'@')!=NULL)
1.1 root 177: sprintf(from,"%.128s",(char*)msg->from_net.addr);
178: else
179: sprintf(from,"%.128s@%.128s",msg->from,(char*)msg->from_net.addr);
1.1.1.2 ! root 180: }
! 181: if(msg->hdr.attr&MSG_ANONYMOUS && !SYSOP)
! 182: SAFECOPY(from,text[Anonymous]);
! 183: else if((subnum==INVALID_SUB || (useron.qwk&QWK_EXT)) && strlen(from) > QWK_HFIELD_LEN) {
! 184: size+=fprintf(qwk_fp,"From: %.128s%c", from, QWK_NEWLINE);
! 185: SAFECOPY(from,msg->from);
! 186: }
1.1 root 187:
1.1.1.2 ! root 188: SAFECOPY(to,msg->to);
1.1 root 189: if(msg->to_net.addr && (uint)subnum==INVALID_SUB) {
190: if(msg->to_net.type==NET_FIDO)
191: sprintf(to,"%.128s@%s",msg->to,smb_faddrtoa((faddr_t *)msg->to_net.addr,tmp));
192: else if(msg->to_net.type==NET_INTERNET)
193: sprintf(to,"%.128s",(char*)msg->to_net.addr);
194: else if(msg->to_net.type==NET_QWK) {
195: if(mode&QM_TO_QNET) {
196: p=strchr((char *)msg->to_net.addr,'/');
197: if(p) { /* Another hop */
198: p++;
1.1.1.2 ! root 199: SAFECOPY(to,"NETMAIL");
! 200: size+=fprintf(qwk_fp,"%.128s@%.128s%c",msg->to,p,QWK_NEWLINE);
! 201: }
1.1 root 202: else
1.1.1.2 ! root 203: sprintf(to,"%.128s",msg->to);
! 204: }
1.1 root 205: else
1.1.1.2 ! root 206: sprintf(to,"%.128s@%.128s",msg->to,(char*)msg->to_net.addr);
! 207: }
1.1 root 208: else
209: sprintf(to,"%.128s@%.128s",msg->to,(char*)msg->to_net.addr);
1.1.1.2 ! root 210: }
! 211: if((subnum==INVALID_SUB || (useron.qwk&QWK_EXT)) && strlen(to) > QWK_HFIELD_LEN) {
! 212: size+=fprintf(qwk_fp,"To: %.128s%c", to, QWK_NEWLINE);
! 213: if(msg->to_net.type==NET_QWK)
! 214: SAFECOPY(to,"NETMAIL");
! 215: else
! 216: SAFECOPY(to,msg->to);
! 217: }
! 218: if((useron.qwk&QWK_EXT) && strlen(msg->subj) > QWK_HFIELD_LEN)
! 219: size+=fprintf(qwk_fp,"Subject: %.128s%c", msg->subj, QWK_NEWLINE);
! 220:
! 221: if(msg->from_net.type==NET_QWK && mode&QM_VIA && !msg->forwarded)
! 222: size+=fprintf(qwk_fp,"@VIA: %s%c"
! 223: ,(char*)msg->from_net.addr,QWK_NEWLINE);
1.1 root 224:
225: if(mode&QM_MSGID && (uint)subnum!=INVALID_SUB) {
1.1.1.2 ! root 226: size+=fprintf(qwk_fp,"@MSGID: %s%c"
! 227: ,get_msgid(&cfg,subnum,msg,msgid,sizeof(msgid)),QWK_NEWLINE);
1.1 root 228:
229: if(msg->reply_id) {
230: SAFECOPY(tmp,msg->reply_id);
231: truncstr(tmp," ");
1.1.1.2 ! root 232: size+=fprintf(qwk_fp,"@REPLY: %s%c"
! 233: ,tmp,QWK_NEWLINE);
1.1 root 234: } else if(msg->hdr.thread_back) {
235: memset(&remsg,0,sizeof(remsg));
236: remsg.hdr.number=msg->hdr.thread_back;
237: if(smb_getmsgidx(&smb, &remsg))
1.1.1.2 ! root 238: size+=fprintf(qwk_fp,"@REPLY: <%s>%c",smb.last_error,QWK_NEWLINE);
1.1 root 239: else
1.1.1.2 ! root 240: size+=fprintf(qwk_fp,"@REPLY: %s%c"
! 241: ,get_msgid(&cfg,subnum,&remsg,msgid,sizeof(msgid))
1.1 root 242: ,QWK_NEWLINE);
243: }
244: }
245:
1.1.1.2 ! root 246: if(msg->hdr.when_written.zone && mode&QM_TZ)
! 247: size+=fprintf(qwk_fp,"@TZ: %04hx%c",msg->hdr.when_written.zone,QWK_NEWLINE);
1.1 root 248:
1.1.1.2 ! root 249: if(msg->replyto!=NULL && mode&QM_REPLYTO)
! 250: size+=fprintf(qwk_fp,"@REPLYTO: %s%c"
! 251: ,msg->replyto,QWK_NEWLINE);
1.1 root 252:
253: p=0;
254: for(i=0;i<msg->total_hfields;i++) {
255: if(msg->hfield[i].type==SENDER)
256: p=(char *)msg->hfield_dat[i];
257: if(msg->hfield[i].type==FORWARDED && p) {
1.1.1.2 ! root 258: size+=fprintf(qwk_fp,"Forwarded from %s on %s%c",p
! 259: ,timestr(*(time32_t *)msg->hfield_dat[i])
1.1 root 260: ,QWK_NEWLINE);
261: }
262: }
263:
264: buf=smb_getmsgtxt(&smb,msg,GETMSGTXT_ALL);
265: if(!buf)
266: return(0);
267:
268: for(l=0;buf[l];l++) {
269: ch=buf[l];
270:
1.1.1.2 ! root 271: if(ch=='\n') {
1.1 root 272: if(tear)
273: tear++; /* Count LFs after tearline */
274: if(tear>3) /* more than two LFs after the tear */
275: tear=0;
276: if(tearwatch==4) { /* watch for LF---LF */
277: tear=1;
1.1.1.2 ! root 278: tearwatch=0;
! 279: }
1.1 root 280: else if(!tearwatch)
281: tearwatch=1;
282: else
283: tearwatch=0;
1.1.1.2 ! root 284: if(l && buf[l-1]=='\r') /* Replace CRLF with funky char */
! 285: ch=QWK_NEWLINE; /* but leave sole LF (soft-NL) alone */
! 286: fputc(ch,qwk_fp);
1.1 root 287: size++;
1.1.1.2 ! root 288: continue;
! 289: }
1.1 root 290:
1.1.1.2 ! root 291: if(ch=='\r') { /* Ignore CRs */
1.1 root 292: if(tearwatch<4) /* LF---CRLF is okay */
293: tearwatch=0; /* LF-CR- is not okay */
1.1.1.2 ! root 294: continue;
! 295: }
1.1 root 296:
297: if(ch==' ' && tearwatch==4) { /* watch for "LF--- " */
298: tear=1;
1.1.1.2 ! root 299: tearwatch=0;
! 300: }
1.1 root 301:
302: if(ch=='-') { /* watch for "LF---" */
303: if(l==0 || (tearwatch && tearwatch<4))
304: tearwatch++;
305: else
1.1.1.2 ! root 306: tearwatch=0;
! 307: }
1.1 root 308: else
309: tearwatch=0;
310:
311: if((uint)subnum!=INVALID_SUB && cfg.sub[subnum]->misc&SUB_ASCII) {
312: if(ch<' ' && ch!=1)
313: ch='.';
314: else if((uchar)ch>0x7f)
1.1.1.2 ! root 315: ch=exascii_to_ascii_char(ch);
! 316: }
1.1 root 317:
318: if(ch==QWK_NEWLINE) /* funky char */
319: ch='*';
320:
321: if(ch==CTRL_A) {
322: ch=buf[++l];
1.1.1.2 ! root 323: if(ch==0 || toupper(ch)=='Z') /* EOF */
1.1 root 324: break;
1.1.1.2 ! root 325: if((asc=ctrl_a_to_ascii_char(ch)) != 0) {
! 326: fputc(asc,qwk_fp);
! 327: size++;
! 328: continue;
! 329: }
1.1 root 330: if(mode&A_EXPAND) {
331: str[0]=0;
1.1.1.2 ! root 332: switch(toupper(ch)) {
1.1 root 333: case 'W':
1.1.1.2 ! root 334: SAFECOPY(str,ansi(LIGHTGRAY));
1.1 root 335: break;
336: case 'K':
1.1.1.2 ! root 337: SAFECOPY(str,ansi(BLACK));
1.1 root 338: break;
339: case 'H':
1.1.1.2 ! root 340: SAFECOPY(str,ansi(HIGH));
1.1 root 341: break;
342: case 'I':
1.1.1.2 ! root 343: SAFECOPY(str,ansi(BLINK));
1.1 root 344: break;
1.1.1.2 ! root 345: case '-':
! 346: case '_':
1.1 root 347: case 'N': /* Normal */
1.1.1.2 ! root 348: SAFECOPY(str,ansi(ANSI_NORMAL));
1.1 root 349: break;
1.1.1.2 ! root 350: case 'R':
! 351: SAFECOPY(str,ansi(RED));
1.1 root 352: break;
353: case 'G':
1.1.1.2 ! root 354: SAFECOPY(str,ansi(GREEN));
1.1 root 355: break;
356: case 'B':
1.1.1.2 ! root 357: SAFECOPY(str,ansi(BLUE));
1.1 root 358: break;
359: case 'C':
1.1.1.2 ! root 360: SAFECOPY(str,ansi(CYAN));
1.1 root 361: break;
362: case 'M':
1.1.1.2 ! root 363: SAFECOPY(str,ansi(MAGENTA));
1.1 root 364: break;
365: case 'Y': /* Yellow */
1.1.1.2 ! root 366: SAFECOPY(str,ansi(BROWN));
1.1 root 367: break;
368: case '0':
1.1.1.2 ! root 369: SAFECOPY(str,ansi(BG_BLACK));
1.1 root 370: break;
371: case '1':
1.1.1.2 ! root 372: SAFECOPY(str,ansi(BG_RED));
1.1 root 373: break;
374: case '2':
1.1.1.2 ! root 375: SAFECOPY(str,ansi(BG_GREEN));
1.1 root 376: break;
377: case '3':
1.1.1.2 ! root 378: SAFECOPY(str,ansi(BG_BROWN));
1.1 root 379: break;
380: case '4':
1.1.1.2 ! root 381: SAFECOPY(str,ansi(BG_BLUE));
1.1 root 382: break;
383: case '5':
1.1.1.2 ! root 384: SAFECOPY(str,ansi(BG_MAGENTA));
1.1 root 385: break;
386: case '6':
1.1.1.2 ! root 387: SAFECOPY(str,ansi(BG_CYAN));
1.1 root 388: break;
389: case '7':
1.1.1.2 ! root 390: SAFECOPY(str,ansi(BG_LIGHTGRAY));
1.1 root 391: break;
392: }
1.1.1.2 ! root 393: if(str[0])
! 394: size+=fwrite(str,sizeof(char),strlen(str),qwk_fp);
1.1 root 395: continue;
396: } /* End Expand */
1.1.1.2 ! root 397: if(mode&A_LEAVE && valid_ctrl_a_code(ch)) {
! 398: fputc(CTRL_A,qwk_fp);
1.1 root 399: fputc(ch,qwk_fp);
1.1.1.2 ! root 400: size+=2L;
! 401: }
! 402: continue;
! 403: } /* End of Ctrl-A shit */
1.1 root 404: fputc(ch,qwk_fp);
1.1.1.2 ! root 405: size++;
! 406: }
1.1 root 407:
408: free(buf);
409: if(ch!=QWK_NEWLINE) {
410: fputc(QWK_NEWLINE,qwk_fp); /* make sure it ends in CRLF */
1.1.1.2 ! root 411: size++;
! 412: }
1.1 root 413:
414: if(mode&QM_TAGLINE && !(cfg.sub[subnum]->misc&SUB_NOTAG)) {
415: if(!tear) /* no tear line */
1.1.1.2 ! root 416: SAFEPRINTF(str,"\1n---%c",QWK_NEWLINE); /* so add one */
1.1 root 417: else
1.1.1.2 ! root 418: SAFECOPY(str,"\1n");
1.1 root 419: if(cfg.sub[subnum]->misc&SUB_ASCII) ch='*';
420: else ch='�';
1.1.1.2 ! root 421: safe_snprintf(tmp,sizeof(tmp)," %c \1g%.10s\1n %c %.127s%c"
1.1 root 422: ,ch,VERSION_NOTICE,ch,cfg.sub[subnum]->tagline,QWK_NEWLINE);
423: strcat(str,tmp);
424: if(!(mode&A_LEAVE))
1.1.1.2 ! root 425: remove_ctrl_a(str,str);
! 426: size+=fwrite(str,sizeof(char),strlen(str),qwk_fp);
! 427: }
1.1 root 428:
429: while(size%QWK_BLOCK_LEN) { /* Pad with spaces */
430: size++;
1.1.1.2 ! root 431: fputc(' ',qwk_fp);
! 432: }
1.1 root 433:
1.1.1.2 ! root 434: tt=msg->hdr.when_written.time;
! 435: if(localtime_r(&tt,&tm)==NULL)
1.1 root 436: memset(&tm,0,sizeof(tm));
437:
1.1.1.2 ! root 438: safe_snprintf(tmp,sizeof(tmp),"%02u-%02u-%02u%02u:%02u"
1.1 root 439: ,tm.tm_mon+1,tm.tm_mday,TM_YEAR(tm.tm_year)
440: ,tm.tm_hour,tm.tm_min);
441:
442: if(msg->hdr.attr&MSG_PRIVATE) {
443: if(msg->hdr.attr&MSG_READ)
444: ch='*'; /* private, read */
445: else
446: ch='+'; /* private, unread */ }
447: else {
448: if(msg->hdr.attr&MSG_READ)
449: ch='-'; /* public, read */
450: else
451: ch=' '; /* public, unread */ }
452:
453:
1.1.1.2 ! root 454: safe_snprintf(str,sizeof(str),"%c%-7lu%-13.13s%-25.25s"
1.1 root 455: "%-25.25s%-25.25s%12s%-8lu%-6lu\xe1%c%c%c%c%c"
456: ,ch /* message status flag */
457: ,mode&QM_REP ? (ulong)conf /* conference or */
458: : msg->hdr.number&MAX_MSGNUM /* message number */
459: ,tmp /* date and time */
460: ,to /* To: */
461: ,from /* From: */
462: ,msg->subj /* Subject */
463: ,nulstr /* Password */
464: ,msg->hdr.thread_back&MAX_MSGNUM /* Message Re: Number */
465: ,(size/QWK_BLOCK_LEN)+1 /* Number of blocks */
466: ,(char)conf&0xff /* Conference number lo byte */
467: ,(ushort)conf>>8 /* hi byte */
468: ,' ' /* not used */
469: ,' ' /* not used */
470: ,useron.rest&FLAG('Q') ? '*' : ' ' /* Net tag line */
471: );
472:
473: fseek(qwk_fp,offset,SEEK_SET);
474: fwrite(str,QWK_BLOCK_LEN,1,qwk_fp);
475: fseek(qwk_fp,size,SEEK_CUR);
476:
477: return(size);
478: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.