2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// GoldED+
|
|
|
|
// Copyright (C) 1990-1999 Odinn Sorensen
|
|
|
|
// Copyright (C) 1999-2000 Alexander S. Aganichev
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
// MA 02111-1307 USA
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// $Id$
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Reader secondary functions
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <algorithm>
|
2000-02-25 11:04:07 +00:00
|
|
|
#include <golded.h>
|
|
|
|
#include <gwinput.h>
|
|
|
|
#include <gftnall.h>
|
|
|
|
#define PROTOTYPES
|
|
|
|
#include <uudeview.h>
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Global data from GEREAD
|
|
|
|
|
|
|
|
extern GMsg* reader_msg;
|
2001-09-07 04:15:16 +00:00
|
|
|
extern bool reader_msglistfirst;
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ChangeAttributes() {
|
|
|
|
|
|
|
|
if(reader_msg->msgno) {
|
|
|
|
|
|
|
|
// Reload if hexdumped
|
|
|
|
if(AA->attr().hex()) {
|
|
|
|
AA->attr().hex0();
|
|
|
|
AA->LoadMsg(reader_msg, reader_msg->msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar));
|
|
|
|
}
|
|
|
|
|
|
|
|
GMsg* msg = (GMsg*)throw_malloc(sizeof(GMsg));
|
|
|
|
memcpy(msg, reader_msg, sizeof(GMsg));
|
|
|
|
AskAttributes(reader_msg);
|
|
|
|
if(memcmp(msg, reader_msg, sizeof(GMsg))) {
|
|
|
|
msg->charsetlevel = LoadCharset(CFG->xlatlocalset, msg->charset);
|
2001-11-17 21:28:10 +00:00
|
|
|
DoKludges(MODE_CHANGE, reader_msg, GKLUD_FLAGS);
|
2000-02-25 11:04:07 +00:00
|
|
|
reader_msg->LinesToText();
|
|
|
|
AA->SaveMsg(GMSG_UPDATE, reader_msg);
|
|
|
|
}
|
|
|
|
throw_free(msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DecMargin() {
|
2005-10-27 20:10:32 +00:00
|
|
|
|
2000-02-25 11:04:07 +00:00
|
|
|
if(CFG->dispmargin > (MAXCOL/3))
|
|
|
|
CFG->dispmargin--;
|
|
|
|
else {
|
|
|
|
SayBibi();
|
|
|
|
reader_keyok = YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void IncMargin() {
|
|
|
|
|
|
|
|
if(CFG->dispmargin < MAXCOL)
|
|
|
|
CFG->dispmargin++;
|
|
|
|
else {
|
|
|
|
SayBibi();
|
|
|
|
reader_keyok = YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleMark() {
|
|
|
|
|
|
|
|
uint tmp = AA->Mark.Find(reader_msg->msgno);
|
|
|
|
if(tmp)
|
|
|
|
AA->Mark.DelReln(tmp);
|
|
|
|
else
|
|
|
|
AA->Mark.Add(reader_msg->msgno);
|
|
|
|
HeaderView->Use(AA, reader_msg);
|
|
|
|
HeaderView->Paint();
|
|
|
|
reader_keyok = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleBookMark() {
|
|
|
|
|
|
|
|
if(AA->bookmark == reader_msg->msgno)
|
|
|
|
AA->bookmark = 0;
|
|
|
|
else
|
|
|
|
AA->bookmark = reader_msg->msgno;
|
|
|
|
HeaderView->Use(AA, reader_msg);
|
|
|
|
HeaderView->Paint();
|
|
|
|
reader_keyok = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleHiddKlud() {
|
|
|
|
|
|
|
|
AA->ToggleViewhidden();
|
|
|
|
AA->ToggleViewkludge();
|
|
|
|
MsgLineReIndex(reader_msg);
|
|
|
|
reader_topline = 0;
|
|
|
|
reader_keyok = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleKludge() {
|
|
|
|
|
|
|
|
AA->ToggleViewkludge();
|
|
|
|
MsgLineReIndex(reader_msg);
|
|
|
|
reader_topline = 0;
|
|
|
|
reader_keyok = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleHidden() {
|
|
|
|
|
|
|
|
AA->ToggleViewhidden();
|
|
|
|
MsgLineReIndex(reader_msg);
|
|
|
|
reader_topline = 0;
|
|
|
|
reader_keyok = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-09 05:47:39 +00:00
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleStripHTML() {
|
|
|
|
|
|
|
|
AA->ToggleStripHTML();
|
|
|
|
MsgLineReIndex(reader_msg);
|
|
|
|
reader_topline = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-25 11:04:07 +00:00
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleQuote() {
|
|
|
|
|
|
|
|
AA->ToggleViewquote();
|
|
|
|
MsgLineReIndex(reader_msg);
|
|
|
|
reader_topline = 0;
|
|
|
|
reader_keyok = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleROT13() {
|
|
|
|
|
|
|
|
if(AA->Msgn.Count()) {
|
|
|
|
reader_msg->attr.rotX();
|
|
|
|
Rot13(reader_msg);
|
|
|
|
reader_keyok = YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void TogglePageBar() {
|
|
|
|
|
|
|
|
CFG->switches.set(disppagebar, not CFG->switches.get(disppagebar));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleRealMsgno() {
|
|
|
|
|
|
|
|
CFG->switches.set(disprealmsgno, not CFG->switches.get(disprealmsgno));
|
|
|
|
HeaderView->Use(AA, reader_msg);
|
|
|
|
HeaderView->Paint();
|
|
|
|
reader_keyok = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleTwits() {
|
|
|
|
|
|
|
|
gkey k;
|
|
|
|
|
|
|
|
do {
|
|
|
|
switch(AA->Twitmode()) {
|
|
|
|
case TWIT_SHOW:
|
|
|
|
AA->SetTwitmode(TWIT_BLANK);
|
|
|
|
w_info(LNG->TwitBlanked);
|
|
|
|
break;
|
|
|
|
case TWIT_BLANK:
|
|
|
|
AA->SetTwitmode(TWIT_SKIP);
|
|
|
|
w_info(LNG->TwitSkipped);
|
|
|
|
break;
|
|
|
|
case TWIT_SKIP:
|
|
|
|
AA->SetTwitmode(TWIT_IGNORE);
|
|
|
|
w_info(LNG->TwitIgnoreSkip);
|
|
|
|
break;
|
|
|
|
case TWIT_IGNORE:
|
|
|
|
AA->SetTwitmode(TWIT_KILL);
|
|
|
|
w_info(LNG->TwitKilled);
|
|
|
|
break;
|
|
|
|
case TWIT_KILL:
|
|
|
|
AA->SetTwitmode(TWIT_SHOW);
|
|
|
|
w_info(LNG->TwitDisplayed);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = waitkeyt(3000);
|
|
|
|
|
|
|
|
} while(k and k != Key_Ent and k != Key_Esc);
|
|
|
|
|
|
|
|
w_info(NULL);
|
|
|
|
|
|
|
|
if(k == Key_Esc)
|
|
|
|
AA->SetTwitmode(CFG->twitmode);
|
|
|
|
else
|
|
|
|
CFG->twitmode = AA->Twitmode();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ToggleStyles() {
|
|
|
|
|
|
|
|
gkey k;
|
2005-10-03 16:55:00 +00:00
|
|
|
int setting = AA->adat->usestylies + AA->adat->hidestylies*2;
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
do {
|
|
|
|
switch(setting) {
|
|
|
|
case 2:
|
|
|
|
case 0: w_info(LNG->StylecodesYes); setting = 1; break;
|
|
|
|
case 1: w_info(LNG->StylecodesHide); setting = 3; break;
|
|
|
|
case 3: w_info(LNG->StylecodesNo); setting = 0; break;
|
|
|
|
}
|
|
|
|
k = waitkeyt(3000);
|
|
|
|
} while (k and k != Key_Ent and k != Key_Esc);
|
|
|
|
w_info(NULL);
|
|
|
|
|
|
|
|
if(k != Key_Esc) {
|
2005-10-25 06:11:09 +00:00
|
|
|
AA->adat->usestylies = make_bool(setting & 1);
|
|
|
|
AA->adat->hidestylies = make_bool(setting & 2);
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void GotoMsgno() {
|
|
|
|
|
|
|
|
if(AA->Msgn.Count()) {
|
|
|
|
|
|
|
|
// Set the active window
|
|
|
|
int lastwh = whandle();
|
|
|
|
int inhdr = AA->Msglistheader() or not _in_msglist;
|
|
|
|
|
|
|
|
if(reader_keycode < KK_Macro)
|
|
|
|
if(gkbd.kbuf == NULL)
|
|
|
|
kbput(reader_keycode); // Put back the key
|
|
|
|
|
|
|
|
char buf[150];
|
|
|
|
char* ptr = buf;
|
|
|
|
int list_max = reader_msg->link.list_max();
|
2005-10-20 21:41:32 +00:00
|
|
|
uint32_t* replies = (uint32_t*)throw_calloc(list_max+1, sizeof(uint32_t));
|
|
|
|
uint32_t replyto, replynext;
|
2000-02-25 11:04:07 +00:00
|
|
|
if(CFG->switches.get(disprealmsgno)) {
|
|
|
|
ptr += sprintf(ptr, " %-5.5s: %s %u", LNG->MsgReal, LNG->of, AA->Msgn.Count());
|
|
|
|
replyto = reader_msg->link.to();
|
|
|
|
replies[0] = reader_msg->link.first();
|
|
|
|
replynext = reader_msg->link.next();
|
|
|
|
for(int replyn=1; replyn<list_max+1; replyn++)
|
|
|
|
replies[replyn] = reader_msg->link.list(replyn-1);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ptr += sprintf(ptr, " %-5.5s: %s %u", LNG->Msg, LNG->of, AA->Msgn.Count());
|
|
|
|
replyto = AA->Msgn.ToReln(reader_msg->link.to());
|
|
|
|
replies[0] = AA->Msgn.ToReln(reader_msg->link.first());
|
|
|
|
replynext = AA->Msgn.ToReln(reader_msg->link.next());
|
|
|
|
for(int replyn=1; replyn<list_max+1; replyn++)
|
|
|
|
replies[replyn] = AA->Msgn.ToReln(reader_msg->link.list(replyn-1));
|
|
|
|
}
|
|
|
|
if(replyto)
|
2005-11-02 00:45:47 +00:00
|
|
|
ptr += sprintf(ptr, " -%u", replyto);
|
2000-02-25 11:04:07 +00:00
|
|
|
for(int replyn=0,plus=0; replyn<list_max+1; replyn++)
|
|
|
|
if(replies[replyn])
|
2005-11-02 00:45:47 +00:00
|
|
|
ptr += sprintf(ptr, " %s%u", (plus++?"":"+"), replies[replyn]);
|
2000-02-25 11:04:07 +00:00
|
|
|
if(replynext)
|
2005-11-02 00:45:47 +00:00
|
|
|
sprintf(ptr, " *%u", replynext);
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
if(inhdr) {
|
|
|
|
HeaderView->window.activate_quick();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
wopen_(0, 0, 3, strlen(buf)+3, W_BHEAD, C_HEADB, C_HEADW);
|
|
|
|
w_shadow();
|
|
|
|
wtitle(LNG->EnterMsgno, TCENTER, C_HEADT);
|
|
|
|
}
|
|
|
|
|
|
|
|
int wrow = inhdr ? 1 : 0;
|
|
|
|
wprints(wrow, 0, C_HEADW, buf);
|
|
|
|
*buf = NUL;
|
|
|
|
|
|
|
|
gwindow iwindow(whandle());
|
|
|
|
|
2001-07-16 20:35:42 +00:00
|
|
|
std::string fbuf = buf;
|
2000-02-25 11:04:07 +00:00
|
|
|
gwinput2 iform(iwindow);
|
2005-10-27 20:10:32 +00:00
|
|
|
iform.setup(C_HEADW, C_HEADW, C_HEADI, _box_table(W_BHEAD, 13), true);
|
2000-02-25 11:04:07 +00:00
|
|
|
iform.add_field(0, wrow, 8, 5, fbuf, 20, gwinput::cvt_none, gwinput::entry_new);
|
|
|
|
vcurshow();
|
|
|
|
iform.run(H_InputMsgno);
|
|
|
|
vcurhide();
|
|
|
|
if(iform.dropped)
|
|
|
|
fbuf = "";
|
|
|
|
|
|
|
|
long active = AA->Msgn.Count();
|
|
|
|
long msgno = atol(fbuf.c_str());
|
|
|
|
|
|
|
|
if(CFG->switches.get(disprealmsgno))
|
|
|
|
if(msgno > 0)
|
|
|
|
msgno = AA->Msgn.ToReln(msgno);
|
|
|
|
|
|
|
|
if((msgno < 0) and ((active+msgno) > 0))
|
|
|
|
msgno = active + msgno;
|
|
|
|
|
|
|
|
if(RngV(msgno, 1L, active))
|
|
|
|
AA->set_lastread((uint)msgno);
|
|
|
|
|
|
|
|
if(inhdr)
|
|
|
|
wactiv_(lastwh);
|
|
|
|
else
|
|
|
|
wclose();
|
|
|
|
|
|
|
|
throw_free(replies);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void PrevArea() {
|
|
|
|
|
|
|
|
AA->attr().hex0();
|
|
|
|
AA->Close();
|
|
|
|
int currarea = AL.AreaIdToNo(CurrArea);
|
|
|
|
int testarea = currarea;
|
|
|
|
while(testarea > 0) {
|
|
|
|
testarea--;
|
|
|
|
if(not AL[testarea]->isseparator()) {
|
|
|
|
currarea = testarea;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(currarea == testarea) {
|
|
|
|
AL.SetActiveAreaNo(currarea);
|
|
|
|
OrigArea = CurrArea;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
HandleGEvent(EVTT_ENDOFMSGS);
|
|
|
|
AA->Open();
|
|
|
|
AA->RandomizeData();
|
|
|
|
AA->SetBookmark(AA->lastread());
|
2005-10-04 20:58:47 +00:00
|
|
|
if (CFG->disppmfirst && AA->PMrk.Tags())
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
AA->isreadpm = false;
|
|
|
|
ToggleMarkRead();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void NextArea() {
|
|
|
|
|
|
|
|
AA->attr().hex0();
|
|
|
|
AA->Close();
|
|
|
|
uint currarea = AL.AreaIdToNo(CurrArea);
|
|
|
|
uint testarea = currarea;
|
|
|
|
while(testarea < (AL.size()-1)) {
|
|
|
|
testarea++;
|
|
|
|
if(not AL[testarea]->isseparator()) {
|
|
|
|
currarea = testarea;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(currarea == testarea) {
|
|
|
|
AL.SetActiveAreaNo(currarea);
|
|
|
|
OrigArea = CurrArea;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
HandleGEvent(EVTT_ENDOFMSGS);
|
|
|
|
AA->Open();
|
|
|
|
AA->RandomizeData();
|
|
|
|
AA->SetBookmark(AA->lastread());
|
2005-10-04 20:58:47 +00:00
|
|
|
if (CFG->disppmfirst && AA->PMrk.Tags())
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
AA->isreadpm = false;
|
|
|
|
ToggleMarkRead();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void QuitNow() {
|
|
|
|
|
|
|
|
AA->attr().hex0();
|
|
|
|
reader_finished = YES;
|
|
|
|
reader_done = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ExitAsk() {
|
|
|
|
|
|
|
|
AA->attr().hex0();
|
|
|
|
GMenuQuit MenuQuit;
|
|
|
|
reader_done = reader_finished = MenuQuit.Run();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void NewArea(bool jumpnext) {
|
2005-10-27 20:10:32 +00:00
|
|
|
|
2000-02-25 11:04:07 +00:00
|
|
|
AA->attr().hex0();
|
|
|
|
if(AA->isopen())
|
|
|
|
AA->Close();
|
|
|
|
|
|
|
|
int newarea = CurrArea;
|
|
|
|
|
|
|
|
if(jumpnext) {
|
|
|
|
uint idx = AL.AreaIdToNo(CurrArea);
|
|
|
|
uint oidx = idx;
|
|
|
|
|
|
|
|
do {
|
|
|
|
idx++;
|
|
|
|
|
|
|
|
// Wrap around
|
|
|
|
if(idx >= AL.size())
|
|
|
|
idx = 0;
|
|
|
|
|
|
|
|
// Exit loop if no area with new mail found
|
|
|
|
if(idx == oidx) {
|
|
|
|
newarea = AreaPick(LNG->NewArea, 0, &newarea);
|
|
|
|
if(newarea != -1)
|
|
|
|
idx = AL.AreaIdToNo(newarea);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
} while(AL.AreaNoToPtr(idx)->unread == 0);
|
|
|
|
|
|
|
|
CurrArea = AL.AreaNoToId(idx);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
newarea = AreaPick(LNG->NewArea, 0, &newarea);
|
|
|
|
if(newarea != -1)
|
|
|
|
CurrArea = newarea;
|
|
|
|
}
|
|
|
|
|
|
|
|
AL.Sort();
|
|
|
|
reader_done = YES;
|
|
|
|
|
|
|
|
if(gkbd.quitall)
|
|
|
|
QuitNow();
|
|
|
|
else {
|
|
|
|
AL.SetActiveAreaId(CurrArea);
|
|
|
|
OrigArea = CurrArea;
|
|
|
|
strcpy(stecho, AA->echoid());
|
|
|
|
AA->RandomizeData();
|
2005-11-27 20:13:48 +00:00
|
|
|
|
|
|
|
if (AA->Msglistfirst() && (kbput(KK_ReadMessageList) != -1))
|
2001-09-07 04:15:16 +00:00
|
|
|
reader_msglistfirst = true;
|
2005-11-27 20:13:48 +00:00
|
|
|
else
|
|
|
|
reader_msglistfirst = false;
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DosShell() {
|
|
|
|
|
2011-02-22 16:18:21 +00:00
|
|
|
char * shell = getenv(GOLD_SHELL_ENV);
|
|
|
|
if( shell && *shell )
|
|
|
|
ShellToDos(shell, LNG->DOS_Shell, LGREY_|_BLACK, YES);
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
2006-04-26 17:06:23 +00:00
|
|
|
void TouchNetscan(int popup)
|
|
|
|
{
|
|
|
|
gfile fp(AddPath(CFG->areapath, CFG->semaphore.netscan), "wb", CFG->sharemode);
|
|
|
|
if (fp.isopen())
|
|
|
|
{
|
|
|
|
if (popup)
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
w_infof(" %s ", CFG->semaphore.netscan);
|
|
|
|
HandleGEvent(EVTT_JOBDONE);
|
|
|
|
waitkeyt(10000);
|
|
|
|
w_info(NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
int ExternUtil(GMsg *msg, const ExtUtil &extutil)
|
|
|
|
{
|
2001-11-06 08:27:18 +00:00
|
|
|
Path editorfile, tmpfile, buf;
|
2007-01-08 09:48:18 +00:00
|
|
|
std::string cmdline = extutil.cmdline;
|
|
|
|
int mode = (extutil.options & EXTUTIL_KEEPCTRL) ? MODE_SAVE : MODE_SAVENOCTRL;
|
2010-03-11 16:04:08 +00:00
|
|
|
|
2006-02-24 08:53:21 +00:00
|
|
|
if(striinc("@tmpfile", cmdline.c_str()))
|
2006-02-20 21:44:10 +00:00
|
|
|
{
|
2010-03-11 16:04:08 +00:00
|
|
|
if( (*CFG->temppath == NUL ) or is_dir(CFG->temppath) )
|
|
|
|
{
|
|
|
|
mktemp(strcpy(tmpfile, AddPath(CFG->temppath, "GDXXXXXX")));
|
|
|
|
SaveLines(mode, tmpfile, msg, 79);
|
|
|
|
strcpy(buf, tmpfile);
|
|
|
|
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
|
|
|
strischg(cmdline, "@tmpfile", buf);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
w_info(LNG->TMPinvalidpath);
|
|
|
|
SayBibi();
|
|
|
|
waitkeyt(10000);
|
|
|
|
w_info("");
|
|
|
|
return NO;
|
|
|
|
}
|
2001-11-06 08:27:18 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
tmpfile[0] = NUL;
|
2010-03-11 16:04:08 +00:00
|
|
|
|
|
|
|
strxcpy(editorfile, AddPath(CFG->goldpath, EDIT->File()), sizeof(Path));
|
|
|
|
|
|
|
|
SaveLines(mode, editorfile, msg, 79);
|
|
|
|
strcpy(buf, editorfile);
|
|
|
|
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
|
|
|
strischg(cmdline, "@file", buf);
|
|
|
|
|
2001-11-06 08:27:18 +00:00
|
|
|
strcpy(buf, CFG->goldpath);
|
|
|
|
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
|
|
|
strischg(cmdline, "@path", buf);
|
|
|
|
TokenXlat(MODE_NEW, cmdline, msg, msg, CurrArea);
|
|
|
|
|
|
|
|
int pauseval = 0;
|
2007-01-08 09:48:18 +00:00
|
|
|
if(extutil.options & EXTUTIL_PAUSEONERROR)
|
2001-11-06 08:27:18 +00:00
|
|
|
pauseval = -1;
|
2007-01-08 09:48:18 +00:00
|
|
|
if(extutil.options & EXTUTIL_PAUSE)
|
2001-11-06 08:27:18 +00:00
|
|
|
pauseval = 1;
|
|
|
|
|
2006-02-20 21:44:10 +00:00
|
|
|
ShellToDos(cmdline.c_str(), "",
|
2007-01-08 09:48:18 +00:00
|
|
|
extutil.options & EXTUTIL_CLS ? LGREY_|_BLACK : BLACK_|_BLACK,
|
|
|
|
extutil.options & EXTUTIL_CURSOR,
|
2001-11-06 08:27:18 +00:00
|
|
|
pauseval
|
|
|
|
);
|
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
if(extutil.options & EXTUTIL_RELOAD) {
|
2001-11-06 08:27:18 +00:00
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
if(not (extutil.options & EXTUTIL_KEEPCTRL)) {
|
2006-04-24 16:38:44 +00:00
|
|
|
if (*msg->tearline or *msg->origin)
|
|
|
|
{
|
|
|
|
gfile fp(editorfile, "at");
|
|
|
|
if (fp.isopen())
|
|
|
|
{
|
|
|
|
if (*msg->tearline)
|
|
|
|
fp.Printf("--- %s\n", msg->tearline);
|
|
|
|
if (*msg->origin)
|
|
|
|
fp.Printf(" * Origin: %s\n", msg->origin);
|
2001-11-06 08:27:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-02-25 11:04:07 +00:00
|
|
|
|
2005-10-22 02:45:18 +00:00
|
|
|
bool hardlines = EDIT->HardLines();
|
2001-11-06 08:27:18 +00:00
|
|
|
EDIT->HardLines(false);
|
|
|
|
LoadText(msg, editorfile);
|
|
|
|
EDIT->HardLines(hardlines);
|
2002-05-10 05:06:56 +00:00
|
|
|
|
2002-09-07 13:29:30 +00:00
|
|
|
if(not strstr(msg->txt, "\001CHRS:") and not strstr(msg->txt, "\001CHARSET:")) {
|
|
|
|
// Prepend "@CHRS: XLATLOCALSET 2\n" to force proper encoding
|
|
|
|
const char *charset = AA->Viewkludge() ? msg->charset : CFG->xlatlocalset;
|
|
|
|
char *msg_txt_chrs = (char *)throw_malloc(strlen(msg->txt)+strlen(charset)+sizeof("\001CHRS: 2\r")+16);
|
|
|
|
sprintf(msg_txt_chrs, "\001CHRS: %s 2\r%s", charset, msg->txt);
|
2002-05-10 05:06:56 +00:00
|
|
|
throw_free(msg->txt);
|
|
|
|
msg->txt = msg_txt_chrs;
|
|
|
|
}
|
|
|
|
|
2001-11-13 11:35:21 +00:00
|
|
|
// Ignore any kludge address found
|
|
|
|
msg->TextToLines(CFG->dispmargin-(int)CFG->switches.get(disppagebar), false);
|
2002-09-07 13:29:30 +00:00
|
|
|
|
|
|
|
if(AA->Viewkludge()) {
|
|
|
|
// Try to convert to the original codepage
|
|
|
|
char *inpcharset = msg->charset;
|
|
|
|
int level = LoadCharset(CFG->xlatlocalset, IsQuotedPrintable(inpcharset) ? ExtractPlainCharset(inpcharset) : inpcharset);
|
|
|
|
if(level) {
|
|
|
|
// do recode
|
|
|
|
char *msg_txt_chrs = (char *)throw_malloc(strlen(msg->txt)*3+16);
|
|
|
|
XlatStr(msg_txt_chrs, msg->txt, level, CharTable);
|
|
|
|
throw_free(msg->txt);
|
|
|
|
msg->txt = (char *)throw_realloc(msg_txt_chrs, strlen(msg_txt_chrs)+16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
msg->charsetlevel = LoadCharset(msg->charset, CFG->xlatlocalset);
|
2001-11-06 08:27:18 +00:00
|
|
|
}
|
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
if(extutil.options & EXTUTIL_WIPE)
|
2002-04-21 12:01:13 +00:00
|
|
|
WipeFile(editorfile, 0);
|
|
|
|
if(tmpfile[0] != NUL)
|
|
|
|
WipeFile(tmpfile, 0);
|
|
|
|
|
2001-11-06 08:27:18 +00:00
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
int ExternUtil(GMsg *msg, uint32_t utilno)
|
|
|
|
{
|
|
|
|
std::vector<ExtUtil>::iterator it = CFG->externutil.begin();
|
|
|
|
std::vector<ExtUtil>::iterator end = CFG->externutil.end();
|
|
|
|
|
2007-01-08 14:07:01 +00:00
|
|
|
for (; it != end; it++)
|
2007-01-08 09:48:18 +00:00
|
|
|
{
|
2007-01-08 14:07:01 +00:00
|
|
|
if (it->utilno != utilno) continue;
|
2007-01-08 09:48:18 +00:00
|
|
|
return ExternUtil(msg, *it);
|
2001-11-06 08:27:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SayBibi();
|
|
|
|
return YES;
|
|
|
|
}
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
|
2001-11-06 08:27:18 +00:00
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
void ExternUtilMenu(GMsg* msg)
|
|
|
|
{
|
2001-11-06 08:27:18 +00:00
|
|
|
static int startat = 0;
|
|
|
|
static char cmdline[1024] = "";
|
2007-01-08 09:48:18 +00:00
|
|
|
gstrarray Listi;
|
2001-11-06 08:27:18 +00:00
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
Listi.push_back(LNG->EnterCmdLine);
|
|
|
|
|
|
|
|
std::vector<ExtUtil>::iterator it = CFG->externutil.begin();
|
|
|
|
std::vector<ExtUtil>::iterator end = CFG->externutil.end();
|
|
|
|
for (; it != end; it++)
|
|
|
|
{
|
|
|
|
char buf[100];
|
2007-01-14 00:52:46 +00:00
|
|
|
sprintf(buf, " %02d %.59s%s ", it->utilno, it->cmdline.c_str(), (it->cmdline.length() > 59) ? ">" : "" );
|
2007-01-08 09:48:18 +00:00
|
|
|
Listi.push_back(buf);
|
2001-11-06 08:27:18 +00:00
|
|
|
}
|
2007-01-08 09:48:18 +00:00
|
|
|
|
|
|
|
size_t n = MinV(Listi.size(), (MAXROW-10));
|
2001-11-06 08:27:18 +00:00
|
|
|
set_title(LNG->ExternUtil, TCENTER, C_ASKT);
|
|
|
|
update_statusline(LNG->SelectExternUtil);
|
|
|
|
whelppcat(H_ReadExternUtil);
|
|
|
|
n = wpickstr(6, 0, 6+n+1, -1, W_BASK, C_ASKB, C_ASKW, C_ASKS, Listi, startat, title_shadow);
|
|
|
|
whelpop();
|
2007-01-08 09:48:18 +00:00
|
|
|
|
|
|
|
if (n != -1)
|
|
|
|
{
|
|
|
|
if (n == 0)
|
|
|
|
{
|
|
|
|
if (edit_string(cmdline, sizeof(cmdline), LNG->ExecCmdLine, H_ReadExternUtil))
|
|
|
|
{
|
2001-11-06 08:27:18 +00:00
|
|
|
ExtUtil extutil;
|
|
|
|
extutil.utilno = 0;
|
2007-01-08 09:48:18 +00:00
|
|
|
extutil.cmdline = cmdline;
|
2001-11-06 08:27:18 +00:00
|
|
|
extutil.options = CFG->externoptions;
|
2007-01-08 09:48:18 +00:00
|
|
|
reader_keyok = ExternUtil(msg, extutil);
|
2001-11-02 10:09:23 +00:00
|
|
|
}
|
2001-11-06 08:27:18 +00:00
|
|
|
}
|
2007-01-08 09:48:18 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
reader_keyok = ExternUtil(msg, CFG->externutil[n-1]);
|
2001-11-06 08:27:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
|
2001-11-06 08:27:18 +00:00
|
|
|
// ------------------------------------------------------------------
|
2000-02-25 11:04:07 +00:00
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
static bool PeekURLCmp(const std::string &a, const std::string b)
|
|
|
|
{
|
2007-01-10 20:22:24 +00:00
|
|
|
return stricmp(a.c_str(), b.c_str()) < 0;
|
2001-11-06 08:27:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
2000-02-25 11:04:07 +00:00
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
void ReadPeekURLs(GMsg* msg)
|
|
|
|
{
|
2010-03-26 22:17:07 +00:00
|
|
|
if( CFG->urlhandler.empty() )
|
|
|
|
{
|
|
|
|
w_info(LNG->PeekInfoNoHandler);
|
|
|
|
waitkeyt(10000);
|
|
|
|
w_info(NULL);
|
|
|
|
return;
|
|
|
|
}
|
2001-11-06 08:27:18 +00:00
|
|
|
w_info(LNG->Wait);
|
|
|
|
|
|
|
|
// Scan the current msg for urls
|
|
|
|
int tline = reader_topline;
|
2007-01-08 09:48:18 +00:00
|
|
|
if (CFG->peekurloptions & PEEK_FROMTOP)
|
2001-11-06 08:27:18 +00:00
|
|
|
tline = 0;
|
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
Line **lin = msg->line;
|
|
|
|
std::vector<char *> urls;
|
|
|
|
|
|
|
|
for (int n = tline; n < msg->lines; n++)
|
|
|
|
{
|
|
|
|
const char *ptr = lin[n]->txt.c_str();
|
|
|
|
|
|
|
|
while (*ptr)
|
|
|
|
{
|
|
|
|
const char *urlBegin = url_begin(ptr);
|
|
|
|
if (urlBegin and not strneql(ptr, "mailto:", 7))
|
|
|
|
{
|
|
|
|
const char *urlEnd = urlBegin + strcspn(urlBegin, " \t\"\'<>()[]");
|
|
|
|
if (ispunct(urlEnd[-1]) and (urlEnd[-1] != '/'))
|
|
|
|
--urlEnd;
|
2001-11-06 08:27:18 +00:00
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
if (urlBegin < urlEnd)
|
|
|
|
{
|
|
|
|
char* bufurl=(char*)throw_malloc(urlEnd - ptr + 3);
|
2006-11-25 12:08:48 +00:00
|
|
|
bufurl[0] = ' ';
|
2007-01-08 09:48:18 +00:00
|
|
|
strxcpy(bufurl + 1, ptr, (urlEnd - ptr) + 1);
|
2006-11-25 12:08:48 +00:00
|
|
|
strcat(bufurl, " ");
|
2007-01-08 09:48:18 +00:00
|
|
|
|
|
|
|
std::vector<char *>::iterator it = urls.begin();
|
|
|
|
std::vector<char *>::iterator end = urls.end();
|
|
|
|
for (; it != end; it++)
|
|
|
|
{
|
|
|
|
if (strieql(*it, bufurl))
|
2001-11-06 08:27:18 +00:00
|
|
|
break;
|
2007-01-08 09:48:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (it == end)
|
2006-11-25 12:08:48 +00:00
|
|
|
urls.push_back(bufurl);
|
|
|
|
else
|
|
|
|
throw_free(bufurl);
|
2007-01-08 09:48:18 +00:00
|
|
|
|
|
|
|
ptr = urlEnd - 1;
|
2001-11-06 08:27:18 +00:00
|
|
|
}
|
|
|
|
}
|
2007-01-08 09:48:18 +00:00
|
|
|
|
2001-11-06 08:27:18 +00:00
|
|
|
ptr++;
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-06 08:27:18 +00:00
|
|
|
w_info(NULL);
|
2000-02-25 11:04:07 +00:00
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
if (not urls.empty())
|
|
|
|
{
|
|
|
|
gstrarray Listi;
|
2001-11-06 08:27:18 +00:00
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
std::vector<char *>::iterator it = urls.begin();
|
|
|
|
std::vector<char *>::iterator end = urls.end();
|
|
|
|
for (; it != end; it++)
|
|
|
|
{
|
|
|
|
Listi.push_back(*it);
|
|
|
|
}
|
2000-02-25 11:04:07 +00:00
|
|
|
|
2001-11-06 08:27:18 +00:00
|
|
|
// Sort list if requested
|
2007-01-11 19:12:35 +00:00
|
|
|
if (CFG->peekurloptions & FREQ_SORT)
|
|
|
|
std::sort(Listi.begin(), Listi.end(), PeekURLCmp);
|
2000-02-25 11:04:07 +00:00
|
|
|
|
2001-11-06 08:27:18 +00:00
|
|
|
// Run the picker
|
2007-01-08 09:48:18 +00:00
|
|
|
size_t n = MinV(urls.size(), (MAXROW-10));
|
2001-11-06 08:27:18 +00:00
|
|
|
set_title(LNG->PeekURLMenuTitle, TCENTER, C_ASKT);
|
|
|
|
update_statusline(LNG->PeekURLStat);
|
|
|
|
whelppcat(H_PeekURL);
|
2007-01-08 09:48:18 +00:00
|
|
|
n = wpickstr(6, 0, 6 + n + 1, -1, W_BASK, C_ASKB, C_ASKW, C_ASKS, Listi, 0, title_shadow);
|
2001-11-06 08:27:18 +00:00
|
|
|
whelpop();
|
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
if(n != -1)
|
|
|
|
{
|
|
|
|
std::vector<UrlHandler>::iterator it = CFG->urlhandler.begin();
|
|
|
|
std::vector<UrlHandler>::iterator end = CFG->urlhandler.end();
|
|
|
|
#if 0 // will be implemented later
|
|
|
|
for (; it != end; it++)
|
|
|
|
{
|
|
|
|
if (it->scheme.match(Listi[n].c_str(), gregex::extended | gregex::icase))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
it = end;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (it == end) it = CFG->urlhandler.begin();
|
|
|
|
|
|
|
|
std::string cmdline = it->handler.cmdline;
|
|
|
|
std::string buf = "\"" + strtrim(strltrim(Listi[n])) + "\"";
|
|
|
|
strischg(cmdline, "@url", buf.c_str());
|
2010-03-11 16:04:08 +00:00
|
|
|
|
2007-01-08 09:48:18 +00:00
|
|
|
buf = CFG->goldpath;
|
2001-11-06 08:27:18 +00:00
|
|
|
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
2007-01-08 09:48:18 +00:00
|
|
|
strischg(cmdline, "@path", buf.c_str());
|
|
|
|
|
2001-11-06 08:27:18 +00:00
|
|
|
TokenXlat(MODE_NEW, cmdline, msg, msg, CurrArea);
|
|
|
|
|
|
|
|
int pauseval = 0;
|
2007-01-08 09:48:18 +00:00
|
|
|
if (it->handler.options & EXTUTIL_PAUSEONERROR)
|
2001-11-06 08:27:18 +00:00
|
|
|
pauseval = -1;
|
2007-01-08 09:48:18 +00:00
|
|
|
|
|
|
|
if (it->handler.options & EXTUTIL_PAUSE)
|
2001-11-06 08:27:18 +00:00
|
|
|
pauseval = 1;
|
|
|
|
|
2006-02-20 21:44:10 +00:00
|
|
|
ShellToDos(cmdline.c_str(), "",
|
2007-01-08 09:48:18 +00:00
|
|
|
it->handler.options & EXTUTIL_CLS ? LGREY_|_BLACK : BLACK_|_BLACK,
|
|
|
|
it->handler.options & EXTUTIL_CURSOR,
|
2001-11-06 08:27:18 +00:00
|
|
|
pauseval
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2007-01-08 09:48:18 +00:00
|
|
|
else
|
|
|
|
{
|
2001-11-06 08:27:18 +00:00
|
|
|
w_info(LNG->PeekInfoNoURLs);
|
|
|
|
waitkeyt(10000);
|
|
|
|
w_info(NULL);
|
|
|
|
}
|
2010-03-26 22:44:36 +00:00
|
|
|
while( !urls.empty() )
|
|
|
|
{
|
|
|
|
throw_free(urls.back());
|
|
|
|
urls.pop_back();
|
|
|
|
}
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void UUDecode(GMsg* msg) {
|
|
|
|
|
|
|
|
Path infile, outfile;
|
|
|
|
bool ok = false;
|
|
|
|
|
2010-03-11 16:04:08 +00:00
|
|
|
if( not ((*CFG->temppath == NUL ) or is_dir(CFG->temppath)) )
|
|
|
|
{
|
|
|
|
w_info(LNG->TMPinvalidpath);
|
|
|
|
SayBibi();
|
|
|
|
waitkeyt(10000);
|
|
|
|
w_info("");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-02-25 11:04:07 +00:00
|
|
|
if((*CFG->uudecodepath == NUL) or is_dir(CFG->uudecodepath)) {
|
|
|
|
|
2001-12-15 23:56:43 +00:00
|
|
|
mktemp(strcpy(infile, AddPath(CFG->temppath, "GDXXXXXX")));
|
2000-02-25 11:04:07 +00:00
|
|
|
strcpy(outfile, CFG->uudecodepath);
|
|
|
|
|
|
|
|
GMenuDomarks MenuDomarks;
|
|
|
|
|
|
|
|
int source = AA->Mark.Count() ? MenuDomarks.Run(LNG->Decode) : WRITE_CURRENT;
|
|
|
|
bool overwrite = true;
|
|
|
|
|
|
|
|
if(source == WRITE_QUIT)
|
|
|
|
return;
|
|
|
|
|
2001-10-27 06:31:02 +00:00
|
|
|
bool old_quotespacing = CFG->switches.get(quotespacing);
|
|
|
|
CFG->switches.set(quotespacing, false);
|
|
|
|
|
2000-02-25 11:04:07 +00:00
|
|
|
if(source == WRITE_MARKED) {
|
|
|
|
for(uint n=0; n<AA->Mark.Count(); n++) {
|
|
|
|
if(overwrite and n)
|
|
|
|
overwrite = false; // Overwrite only the first time
|
|
|
|
w_progress(MODE_UPDATE, C_INFOW, n+1, AA->Mark.Count(), LNG->Preparing);
|
|
|
|
AA->LoadMsg(msg, AA->Mark[n], 79);
|
2001-03-03 13:16:14 +00:00
|
|
|
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, infile, msg, 79);
|
2000-11-27 06:15:29 +00:00
|
|
|
}
|
2000-02-25 11:04:07 +00:00
|
|
|
if(AA->Mark.Count())
|
2006-01-20 00:15:05 +00:00
|
|
|
w_progress(MODE_QUIT, BLACK_|_BLACK, 0, 0, NULL);
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
2001-10-27 06:31:02 +00:00
|
|
|
else if(source == WRITE_CURRENT) {
|
|
|
|
AA->LoadMsg(msg, msg->msgno, 79);
|
2001-03-03 13:16:14 +00:00
|
|
|
SaveLines(MODE_WRITE, infile, msg, 79);
|
2001-10-27 06:31:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CFG->switches.set(quotespacing, old_quotespacing);
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
uulist* item;
|
|
|
|
int i, res;
|
|
|
|
|
|
|
|
w_info(LNG->WaitUUdecoding);
|
|
|
|
|
|
|
|
UUInitialize();
|
|
|
|
UUSetOption(UUOPT_SAVEPATH, 0, outfile);
|
|
|
|
if((res = UULoadFile(infile, NULL, 0)) == UURET_OK) {
|
|
|
|
|
|
|
|
for (i=0; (item=UUGetFileListItem(i)) != NULL; i++) {
|
|
|
|
if ((item->state & UUFILE_OK) == 0)
|
|
|
|
continue;
|
|
|
|
if ((res = UUDecodeFile(item, NULL)) == UURET_OK) {
|
|
|
|
ok = true;
|
|
|
|
w_infof(LNG->CompletedUUdecode, item->filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
UUCleanUp ();
|
|
|
|
|
|
|
|
remove(infile);
|
|
|
|
|
|
|
|
if(not ok)
|
|
|
|
w_info(LNG->NotUUencoded);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
w_info(LNG->UUEinvalidpath);
|
|
|
|
|
|
|
|
if(not ok)
|
|
|
|
waitkeyt(10000);
|
|
|
|
|
|
|
|
w_info(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
2006-04-26 17:06:23 +00:00
|
|
|
void Make_Userlist(const char* userlist)
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
word* crclist;
|
|
|
|
word crc, crcs=0;
|
|
|
|
uint n, x;
|
|
|
|
char userline[80], adrs[40];
|
|
|
|
|
|
|
|
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
|
|
|
|
|
|
|
|
crclist = (word*)throw_calloc(AA->Msgn.Count()+1, sizeof(word));
|
2006-04-26 17:06:23 +00:00
|
|
|
gfile fp(userlist, "ab", CFG->sharemode);
|
|
|
|
if (fp.isopen())
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
w_progress(MODE_NEW, C_INFOW, 0, AA->Msgn.Count(), LNG->GenUserlist);
|
|
|
|
for(n=AA->Msgn.Count(); n; n--) {
|
2006-01-10 23:53:52 +00:00
|
|
|
update_statuslinef(LNG->ReadingMsg, "ST_READINGMSG", n, AA->Msgn.Count());
|
2000-02-25 11:04:07 +00:00
|
|
|
w_progress(MODE_UPDATE, C_INFOW, (AA->Msgn.Count()-n)+1, AA->Msgn.Count(), NULL);
|
|
|
|
AA->LoadMsg(msg, AA->Msgn.CvtReln(n), CFG->dispmargin);
|
|
|
|
crc = strCrc16(msg->by, false);
|
|
|
|
for(x=0; x<crcs; x++)
|
|
|
|
if(crclist[x] == crc)
|
|
|
|
break; // We have already used it
|
2006-04-26 17:06:23 +00:00
|
|
|
if (x >= crcs)
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
crclist[crcs++] = crc;
|
|
|
|
strrevname(userline, msg->by);
|
|
|
|
msg->orig.make_string(adrs);
|
2006-04-26 17:06:23 +00:00
|
|
|
fp.Printf("%-36.36s%24.24s\r\n", userline, adrs);
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
throw_free(crclist);
|
2006-01-20 00:15:05 +00:00
|
|
|
w_progress(MODE_QUIT, BLACK_|_BLACK, 0, 0, NULL);
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ResetMsg(msg);
|
|
|
|
throw_free(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void MakeUserList() {
|
|
|
|
|
|
|
|
if(AA->Msgn.Count()) {
|
|
|
|
uint temp = AA->lastread();
|
|
|
|
if(not edit_pathname(CFG->userlistfile, sizeof(Path), LNG->UserlistName, 0))
|
|
|
|
return;
|
|
|
|
Make_Userlist(AddPath(CFG->goldpath, CFG->userlistfile));
|
|
|
|
AA->set_lastread(temp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void TouchSemaphore() {
|
|
|
|
|
|
|
|
Path file;
|
|
|
|
*file = NUL;
|
|
|
|
if(edit_string(file, sizeof(Path), LNG->TouchSemaphore, 0))
|
|
|
|
TouchFile(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
2006-04-24 16:38:44 +00:00
|
|
|
void make_pathreport(const char* reportfile)
|
|
|
|
{
|
|
|
|
gfile fp(reportfile, "wt");
|
|
|
|
if (fp.isopen())
|
|
|
|
{
|
2001-07-16 20:35:42 +00:00
|
|
|
std::string path;
|
2000-02-25 11:04:07 +00:00
|
|
|
ftn_addr address;
|
2001-07-16 20:35:42 +00:00
|
|
|
std::vector<ftn_addr> alist;
|
2000-02-25 11:04:07 +00:00
|
|
|
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
|
|
|
|
w_progress(MODE_NEW, C_INFOW, 0, AA->Msgn.Count(), "Generating PATH report");
|
|
|
|
for(int n=AA->Msgn.Count(); n>=AA->lastread(); n--) {
|
2006-01-10 23:53:52 +00:00
|
|
|
update_statuslinef(LNG->ReadingMsg, "ST_READINGMSG", n, AA->Msgn.Count());
|
2000-02-25 11:04:07 +00:00
|
|
|
w_progress(MODE_UPDATE, C_INFOW, n, AA->Msgn.Count(), NULL);
|
|
|
|
AA->LoadMsg(msg, AA->Msgn.CvtReln(n), CFG->dispmargin-(int)CFG->switches.get(disppagebar));
|
|
|
|
address = msg->orig;
|
|
|
|
int x;
|
|
|
|
for(x=0; x<alist.size(); x++) {
|
|
|
|
if(alist[x] == address)
|
|
|
|
break; // We have already used it
|
|
|
|
}
|
|
|
|
if(x >= alist.size()) {
|
|
|
|
alist.push_back(address);
|
|
|
|
INam buf;
|
|
|
|
strcpy(buf, msg->By());
|
|
|
|
strchg(buf, ' ', '_');
|
2001-07-16 20:35:42 +00:00
|
|
|
std::string temp;
|
2006-04-24 16:38:44 +00:00
|
|
|
fp.Printf("%s %s ", buf, address.make_string(temp).c_str());
|
2000-02-25 11:04:07 +00:00
|
|
|
path = "";
|
|
|
|
Line* line = msg->lin;
|
|
|
|
while(line) {
|
|
|
|
if(line->kludge == GKLUD_PATH)
|
2000-03-22 17:59:18 +00:00
|
|
|
path += line->txt.c_str() + 6;
|
2000-02-25 11:04:07 +00:00
|
|
|
line = line->next;
|
|
|
|
}
|
|
|
|
if(path.length()) {
|
|
|
|
gstrarray links;
|
|
|
|
tokenize(links, path.c_str(), " ");
|
|
|
|
for(int i=0; i<links.size(); i++)
|
|
|
|
address = links[i];
|
|
|
|
}
|
2006-04-24 16:38:44 +00:00
|
|
|
fp.Printf("%s\n", path.c_str());
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
}
|
2006-01-20 00:15:05 +00:00
|
|
|
w_progress(MODE_QUIT, BLACK_|_BLACK, 0, 0, NULL);
|
2000-02-25 11:04:07 +00:00
|
|
|
ResetMsg(msg);
|
|
|
|
throw_free(msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void MakePathreport() {
|
|
|
|
|
|
|
|
if(AA->Msgn.Count()) {
|
|
|
|
uint temp = AA->lastread();
|
|
|
|
if(not edit_pathname(CFG->pathreportfile, sizeof(Path), LNG->Pathreport, 0))
|
|
|
|
return;
|
|
|
|
make_pathreport(AddPath(CFG->goldpath, CFG->pathreportfile));
|
|
|
|
AA->set_lastread(temp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|