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 //  Copyright (C) 1999-2000 Alex. S. Aganichev
7 //  ------------------------------------------------------------------
8 //  This library is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU Library General Public
10 //  License as published by the Free Software Foundation; either
11 //  version 2 of the License, or (at your option) any later version.
12 //
13 //  This library is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 //  Library General Public License for more details.
17 //
18 //  You should have received a copy of the GNU Library General Public
19 //  License along with this program; if not, write to the Free
20 //  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 //  MA 02111-1307, USA
22 //  ------------------------------------------------------------------
23 //  $Id: gmohuds5.cpp,v 1.5 2006/05/14 17:17:32 ssianky Exp $
24 //  ------------------------------------------------------------------
25 //  Hudson / Goldbase msgbase handling
26 //  ------------------------------------------------------------------
27 
28 
29 //  ------------------------------------------------------------------
30 
31 template <class msgn_t, class rec_t, class attr_t, class board_t, class last_t, bool __HUDSON>
user_lookup(char * __lookfor)32 char* _HudsArea<msgn_t, rec_t, attr_t, board_t, last_t, __HUDSON>::user_lookup(char* __lookfor)
33 {
34   wide->user->gufh = wide->fhusr.fh;
35   wide->user->findwild(__lookfor, __lookfor);
36 
37   if(wide->user->found)
38     return __lookfor;
39   else
40     return NULL;
41 }
42 
43 
44 //  ------------------------------------------------------------------
45 
46 template <class msgn_t, class rec_t, class attr_t, class board_t, class last_t, bool __HUDSON>
renumber()47 int _HudsArea<msgn_t, rec_t, attr_t, board_t, last_t, __HUDSON>::renumber() {
48 
49   return false;
50 }
51 
52 
53 //  ------------------------------------------------------------------
54 
55 template <class msgn_t, class rec_t, class attr_t, class board_t, class last_t, bool __HUDSON>
make_dump_msg(Line * & lin,gmsg * msg,char * lng_head)56 Line* _HudsArea<msgn_t, rec_t, attr_t, board_t, last_t, __HUDSON>::make_dump_msg(Line*& lin, gmsg* msg, char* lng_head) {
57 
58   GFTRK("HudsMakeDump");
59 
60   HudsHdr _hdr;
61   load_message(GMSG_HDRTXT, msg, _hdr);
62 
63   strnp2c(_hdr.date,9);
64   strnp2c(_hdr.time,5);
65 
66   char buf[100];
67   Line* line = lin =
68   AddLine (NULL, __HUDSON ? "Hexdump of " HUDS_NAME " message header and text" : "Hexdump of " GOLD_NAME " message header and text");
69   AddLineF(line, "------------------------------------------------------------------------------");
70   line = AddLine(line, "");
71   AddLineF(line, "Msgbase   : %s", wide->path);
72   AddLineF(line, "BoardNo   : %u", board());
73   AddLineF(line, "From      : %-35.35s", msg->by);
74   AddLineF(line, "To        : %-35.35s", msg->to);
75   AddLineF(line, "Subject   : %-72.72s", msg->re);
76   AddLineF(line, "DateTime  : %8.8s %5.5s", _hdr.date, _hdr.time);
77   AddLineF(line, "OrigAddr  : %u:%u/%u", _hdr.origzone, _hdr.orignet, _hdr.orignode);
78   AddLineF(line, "DestAddr  : %u:%u/%u", _hdr.destzone, _hdr.destnet, _hdr.destnode);
79   AddLineF(line, "Reply     : %u", (uint32_t)_hdr.replyto);
80   AddLineF(line, "See       : %u", (uint32_t)_hdr.reply1st);
81   AddLineF(line, "TimesRead : %u", _hdr.timesread);
82   AddLineF(line, "Cost      : %u", _hdr.cost);
83   AddLineF(line, "MsgAttr   : %02Xh (%sb)", _hdr.msgattr, ltob(buf, _hdr.msgattr, 8));
84   AddLineF(line, "NetAttr   : %02Xh (%sb)", _hdr.netattr, ltob(buf, _hdr.netattr, 8));
85   AddLineF(line, "Msgno     : %u", (int32_t)_hdr.msgno);
86   AddLineF(line, "Board     : %u", _hdr.board);
87   AddLineF(line, "StartRec  : %u", (int32_t)_hdr.startrec);
88   AddLineF(line, "NumRecs   : %u", (int32_t)_hdr.numrecs);
89   AddLineF(line, "UserRecno : %u (%s)", wide->userno, WideUsername[0]);
90   line = AddLine(line, "");
91   AddLineF(line, "Dump of msginfo%s:", __HUDSON ? HUDS_EXT : GOLD_EXT);
92   line = AddLine(line, "");
93   AddLineF(line, "Total Active  : %u (%Xh)", (uint32_t)wide->msginfo.total, (uint32_t)wide->msginfo.total);
94   AddLineF(line, "Low/High Msgno: %u (%Xh)  %u (%Xh)",
95     (uint32_t)wide->msginfo.low,   (uint32_t)wide->msginfo.low,
96     (uint32_t)wide->msginfo.high,  (uint32_t)wide->msginfo.high
97   );
98   for(int brd=0; brd<(__HUDSON ? HUDS_MAXBOARD : GOLD_MAXBOARD); brd+=10) {
99     AddLineF(line, "Board %03u-%03u : %5u %5u %5u %5u %5u %5u %5u %5u %5u %5u",
100       brd+1,  brd+10,  wide->msginfo.active[brd+0],
101       wide->msginfo.active[brd+1],  wide->msginfo.active[brd+2],  wide->msginfo.active[brd+3],
102       wide->msginfo.active[brd+4],  wide->msginfo.active[brd+5],  wide->msginfo.active[brd+6],
103       wide->msginfo.active[brd+7],  wide->msginfo.active[brd+8],  wide->msginfo.active[brd+9]
104     );
105   }
106   line = AddLine(line, "");
107   AddLineF(line, "Dump of lastread%s:", __HUDSON ? HUDS_EXT : GOLD_EXT);
108   line = AddLine(line, "");
109   for(int lrd=0; lrd<(__HUDSON ? HUDS_MAXBOARD : GOLD_MAXBOARD); lrd+=5) {
110     AddLineF(line, "Board %03u-%03u : %10u %10u %10u %10u %10u",
111       lrd+1,  lrd+5,  (uint32_t)wide->lastrec[lrd+0],
112       (uint32_t)wide->lastrec[lrd+1],  (uint32_t)wide->lastrec[lrd+2],
113       (uint32_t)wide->lastrec[lrd+3],  (uint32_t)wide->lastrec[lrd+4]
114     );
115   }
116   line = AddLine(line, "");
117   AddLineF(line, lng_head);
118   line = AddLine(line, "");
119 
120   int _count = 0;
121   char* _ptr = (char*)&_hdr;
122   for (;_count < sizeof(HudsHdr); _ptr+=16,_count+=16)
123   {
124     gsprintf(PRINTF_DECLARE_BUFFER(buf), "%04X   ", _count);
125     HexDump16(buf+7, _ptr, 16, HEX_DUMP2);
126     line = AddLine(line, buf);
127   }
128   gsprintf(PRINTF_DECLARE_BUFFER(buf), "%04X   ", _count);
129   HexDump16(buf+7, _ptr, sizeof(HudsHdr)%16, HEX_DUMP2);
130   line = AddLine(line, buf);
131 
132   GFTRK(0);
133 
134   return line;
135 }
136 
137 
138 //  ------------------------------------------------------------------
139