1 //  This may look like C code, but it is really -*- C++ -*-
2 
3 //  ------------------------------------------------------------------
4 //  The Goldware Library
5 //  Copyright (C) 1990-1999 Odinn Sorensen
6 //  ------------------------------------------------------------------
7 //  This library is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU Library General Public
9 //  License as published by the Free Software Foundation; either
10 //  version 2 of the License, or (at your option) any later version.
11 //
12 //  This library is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 //  Library General Public License for more details.
16 //
17 //  You should have received a copy of the GNU Library General Public
18 //  License along with this program; if not, write to the Free
19 //  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 //  MA 02111-1307, USA
21 //  ------------------------------------------------------------------
22 //  $Id: gmoxbbs5.cpp,v 1.7 2006/05/14 11:45:05 ssianky Exp $
23 //  ------------------------------------------------------------------
24 //  AdeptXBBS messagebase engine.
25 //  ------------------------------------------------------------------
26 
27 #include <gdbgtrk.h>
28 #include <gmemall.h>
29 #include <gmoxbbs.h>
30 
31 
32 //  ------------------------------------------------------------------
33 
user_lookup(char * __lookfor)34 char* XbbsArea::user_lookup(char* __lookfor)
35 {
36   wide->user->gufh = ::sopen(AddPath(wide->path, "Users"), O_RDWR|O_BINARY, WideSharemode, S_STDRD);
37   if (wide->user->gufh)
38   {
39     wide->user->findwild(__lookfor, __lookfor);
40     ::close(wide->user->gufh);
41   }
42 
43   if(wide->user->found)
44     return __lookfor;
45   else
46     return NULL;
47 }
48 
49 
50 //  ------------------------------------------------------------------
51 
renumber()52 int XbbsArea::renumber() {
53 
54   return false;
55 }
56 
57 
58 //  ------------------------------------------------------------------
59 //  Hexdump the current message header
60 
make_dump_msg(Line * & lin,gmsg * msg,char * lng_head)61 Line* XbbsArea::make_dump_msg(Line*& lin, gmsg* msg, char* lng_head) {
62 
63   GFTRK("XbbsMakeDump");
64 
65   XbbsHdr hdr;
66   load_message(GMSG_HDRTXT, msg, hdr);
67   XbbsIdx* idx = data->idx + (msg->msgno - 1);
68 
69   char buf[100];
70   Line* line = lin =
71   AddLine (NULL, "Hexdump of AdeptXBBS message header and text");
72   AddLineF(line, "------------------------------------------------------------------------------");
73   line = AddLine(line, "");
74   AddLineF(line, "Path       : %s", real_path());
75   AddLineF(line, "UserRecno  : %u (%s)", wide->userno, WideUsername[0]);
76   line = AddLine(line, "");
77   AddLineF(line, "Header Record:");
78   line = AddLine(line, "");
79   AddLineF(line, "Version    : %u.%u", hdr.majorversion, hdr.minorversion);
80   AddLineF(line, "StructLen  : %u", hdr.structlen);
81   AddLineF(line, "From       : %s", hdr.from);
82   AddLineF(line, "To         : %s", hdr.to);
83   AddLineF(line, "Subj       : %s", hdr.subj);
84   AddLineF(line, "Date       : %s", hdr.date);
85   AddLineF(line, "InDate     : %u-%u-%u", hdr.indate[0]+1989, hdr.indate[1], hdr.indate[2]);
86   AddLineF(line, "MsgNum     : %u", hdr.msgnum);
87   AddLineF(line, "TimesRead  : %u", hdr.timesread);
88   AddLineF(line, "TimeRecv   : %s (%08Xh)", TimeToStr(buf, hdr.timerecv), (int32_t)hdr.timerecv);
89   AddLineF(line, "Length     : %u", hdr.length);
90   AddLineF(line, "Start      : %u", hdr.start);
91   AddLineF(line, "Extra1,2,3 : %u, %u, %u", hdr.extra1, hdr.extra2, hdr.extra3);
92   AddLineF(line, "OrigAddr   : %u:%u/%u.%u", hdr.origaddr.zone, hdr.origaddr.net, hdr.origaddr.node, hdr.origaddr.point);
93   AddLineF(line, "DestAddr   : %u:%u/%u.%u", hdr.origaddr.zone, hdr.destaddr.net, hdr.destaddr.node, hdr.destaddr.point);
94   AddLineF(line, "Cost       : %u", hdr.cost);
95   AddLineF(line, "FFlags     : %u (%04Xh)", hdr.fflags, hdr.fflags);
96   AddLineF(line, "XFlags     : %u (%04Xh)", hdr.xflags, hdr.xflags);
97   AddLineF(line, "IFlags     : %u (%08Xh)", hdr.iflags, hdr.iflags);
98   AddLineF(line, "OFlags     : %u (%08Xh)", hdr.oflags, hdr.oflags);
99   line = AddLine(line, "");
100   AddLineF(line, "Index Record:");
101   line = AddLine(line, "");
102   AddLineF(line, "CheckSumTo      : %04Xh (%u)", idx->to,   idx->to);
103   AddLineF(line, "CheckSumFrom    : %04Xh (%u)", idx->from, idx->from);
104   AddLineF(line, "CheckSumSubj    : %04Xh (%u)", idx->subj, idx->subj);
105   AddLineF(line, "MsgidCrc        : %08Xh (%u)", idx->msgidcrc,      idx->msgidcrc);
106   AddLineF(line, "MsgidSerialNo   : %08Xh (%u)", idx->msgidserialno, idx->msgidserialno);
107   AddLineF(line, "ReplyidCrc      : %08Xh (%u)", idx->replycrc,      idx->replycrc);
108   AddLineF(line, "ReplyidSerialNo : %08Xh (%u)", idx->replyserialno, idx->replyserialno);
109   line = AddLine(line, "");
110   AddLineF(line, lng_head);
111   line = AddLine(line, "");
112 
113   int _count;
114   char* _ptr = (char*)&hdr;
115   for(_count=0; _count<sizeof(XbbsHdr); _ptr+=16,_count+=16) {
116     sprintf(buf, "%04X   ", _count);
117     HexDump16(buf+7, _ptr, 16, HEX_DUMP2);
118     line = AddLine(line, buf);
119   }
120   sprintf(buf, "%04X   ", _count);
121   HexDump16(buf+7, _ptr, 14, HEX_DUMP2);
122   line = AddLine(line, buf);
123 
124   GFTRK(0);
125 
126   return line;
127 }
128 
129 
130 //  ------------------------------------------------------------------
131