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: gmoezyc5.cpp,v 1.4 2006/05/14 11:45:05 ssianky Exp $
23 //  ------------------------------------------------------------------
24 //  Ezycom msgbase handling
25 //  ------------------------------------------------------------------
26 
27 #include <gdbgtrk.h>
28 #include <gmemall.h>
29 #include <gutlmisc.h>
30 #include <gmoezyc.h>
31 
32 
33 //  ------------------------------------------------------------------
34 
user_lookup(char * __lookfor)35 char* EzycomArea::user_lookup(char* __lookfor)
36 {
37   wide->user->gufh = ::sopen(AddPath(wide->userbasepath, "USERS.BBS"), O_RDWR|O_BINARY, WideSharemode, S_STDRW);
38   if (wide->user->gufh)
39   {
40     wide->user->findwild(__lookfor, __lookfor);
41     ::close(wide->user->gufh);
42   }
43 
44   if(wide->user->found)
45     return __lookfor;
46   else
47     return NULL;
48 }
49 
50 
51 //  ------------------------------------------------------------------
52 
renumber()53 int EzycomArea::renumber() {
54 
55   return false;
56 }
57 
58 
59 //  ------------------------------------------------------------------
60 
make_dump_msg(Line * & lin,gmsg * msg,char * lng_head)61 Line* EzycomArea::make_dump_msg(Line*& lin, gmsg* msg, char* lng_head) {
62 
63   GFTRK("EzycomMakeDump");
64 
65   EzycHdr _hdr;
66   load_message(GMSG_HDRTXT, msg, _hdr);
67 
68   char buf[100];
69   Line* line = lin =
70   AddLine (NULL, "Hexdump of Ezycom-style message header and text");
71   AddLineF(line, "------------------------------------------------------------------------------");
72   line = AddLine(line, "");
73   AddLineF(line, "Msgbase  : %s", wide->msgbasepath);
74   AddLineF(line, "BoardNo  : %u", board());
75   AddLineF(line, "From     : %-35.35s", msg->by);
76   AddLineF(line, "To       : %-35.35s", msg->to);
77   AddLineF(line, "Subject  : %-72.72s", msg->re);
78   AddLineF(line, "Orig     : %u:%u/%u.%u", _hdr.orignet.zone, _hdr.orignet.net, _hdr.orignet.node, _hdr.orignet.point);
79   AddLineF(line, "Dest     : %u:%u/%u.%u", _hdr.destnet.zone, _hdr.destnet.net, _hdr.destnet.node, _hdr.destnet.point);
80   AddLineF(line, "Reply    : %u  See : %u", _hdr.replyto, _hdr.reply1st);
81   AddLineF(line, "Cost     : %u", _hdr.cost);
82   AddLineF(line, "MsgAttr  : %02Xh (%sb)", _hdr.msgattr, ltob(buf, _hdr.msgattr, 8));
83   AddLineF(line, "NetAttr  : %02Xh (%sb)", _hdr.netattr, ltob(buf, _hdr.netattr, 8));
84   AddLineF(line, "ExtAttr  : %02Xh (%sb)", _hdr.extattr, ltob(buf, _hdr.extattr, 8));
85   AddLineF(line, "PostDate : %s (%08Xh)", FTimeToStr(buf, _hdr.posttimedate), *(dword*)&_hdr.posttimedate);
86   AddLineF(line, "RecvDate : %s (%08Xh)", FTimeToStr(buf, _hdr.recvtimedate), *(dword*)&_hdr.recvtimedate);
87   AddLineF(line, "StartPos : %u", _hdr.startposition);
88   AddLineF(line, "MsgLength: %u", _hdr.messagelength);
89   AddLineF(line, "UserRecno: %u (%s)", wide->userno, WideUsername[0]);
90   line = AddLine(line, "");
91   AddLineF(line, lng_head);
92   line = AddLine(line, "");
93 
94   uint _count = 0;
95   char* _ptr = (char*)&_hdr;
96   while(_count < sizeof(EzycHdr)) {
97     sprintf(buf, "%04X   ", _count);
98     HexDump16(buf+7, _ptr, 16, HEX_DUMP2);
99     line = AddLine(line, buf);
100     _count += 16;
101     _ptr += 16;
102   }
103   sprintf(buf, "%04X   ", _count);
104   HexDump16(buf+7, _ptr, sizeof(EzycHdr)%16, HEX_DUMP2);
105   line = AddLine(line, buf);
106 
107   GFTRK(0);
108 
109   return line;
110 }
111 
112 
113 //  ------------------------------------------------------------------
114