int line_length;
char buf[512];
char cmd[256];
- char email[256];
+ char email[256] = "";
char subtype[128];
int success = 0;
- char address_to_unsubscribe[256];
+ char address_to_unsubscribe[256] = "";
char scancmd[256];
char scanemail[256];
char *holdbuf = NULL;
int linelen = 0;
int buflen = 0;
- strcpy(address_to_unsubscribe, "");
-
if (CtdlGetRoom(&qrbuf, room) != 0) {
cprintf("%d There is no list called '%s'\n",
ERROR + ROOM_NOT_FOUND, room);
struct dirent *d;
struct dirent *filedir_entry;
long RoomNR;
- long Count;
+ long Count = 0;
filedir = opendir (DirName);
if (filedir == NULL) {
ptr->namelen = ROOMNAMELEN - 1;
memcpy (ptr->name, qrbuf->QRname, ptr->namelen);
- ptr->name[ptr->namelen] = 0;
+ ptr->name[ptr->namelen] = '\0';
ptr->QRNum = qrbuf->QRnumber;
for (i = 0; i < ptr->namelen; i++)
ptr->lcname[i] = tolower(ptr->name[i]);
}
+ ptr->lcname[ptr->namelen] = '\0';
ptr->key = hashlittle(ptr->lcname, ptr->namelen, 9872345);
ptr->next = RP->rplist;
RP->rplist = ptr;
ptr->namelen = ROOMNAMELEN - 1;
memcpy (ptr->name, qrbuf->QRname, ptr->namelen);
- ptr->name[ptr->namelen] = 0;
+ ptr->name[ptr->namelen] = '\0';
ptr->QRNum = qrbuf->QRnumber;
for (i = 0; i < ptr->namelen; i++)
{
ptr->lcname[i] = tolower(ptr->name[i]);
}
-
+ ptr->lcname[ptr->namelen] = '\0';
ptr->key = hashlittle(ptr->lcname, ptr->namelen, 9872345);
+
begin_critical_section(S_RPLIST);
ptr->next = rplist;
rplist = ptr;
end_critical_section(S_RPLIST);
RL.RoomsInterestedIn = NewHash(1, lFlathash);
- if (!GetNetworkedRoomNumbers(ctdl_netcfg_dir, RL.RoomsInterestedIn))
+ if (full_processing &&
+ (GetNetworkedRoomNumbers(ctdl_netcfg_dir, RL.RoomsInterestedIn)==0))
{
doing_queue = 0;
DeleteHash(&RL.RoomsInterestedIn);
NW->State = eQUIT;
rc = NWC_SendQUIT(NW);
NWC_DBG_SEND();
+ return rc;
}
if (fstat(fd, &statbuf) == -1) {
{
SmtpOutMsg *pMsg = IO->Data;
+ pMsg->MyQEntry->Status = 4;
EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
StrBufPlain(IO->ErrMsg, CKEY(ReadErrors[pMsg->State]));
return FailOneAttempt(IO);
{
SmtpOutMsg *pMsg = IO->Data;
+ pMsg->MyQEntry->Status = 4;
EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
StrBufPlain(IO->ErrMsg, CKEY(ReadErrors[pMsg->State]));
return FailOneAttempt(IO);
}
eNextState SMTP_C_DNSFail(AsyncIO *IO)
{
+ SmtpOutMsg *pMsg = IO->Data;
+ pMsg->MyQEntry->Status = 4;
EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
return FailOneAttempt(IO);
}
HashList *ActiveQItems = NULL;
HashList *QItemHandlers = NULL;
+static const long MaxRetry = SMTP_RETRY_INTERVAL * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2;
int MsgCount = 0;
int run_queue_now = 0; /* Set to 1 to ignore SMTP send retry times */
Item = (OneQueItem*)malloc(sizeof(OneQueItem));
memset(Item, 0, sizeof(OneQueItem));
- Item->LastAttempt.retry = SMTP_RETRY_INTERVAL;
+ Item->Retry = SMTP_RETRY_INTERVAL;
Item->MessageID = -1;
Item->QueMsgID = QueMsgID;
FreeStrBuf(&Line);
FreeStrBuf(&Token);
+ if (Item->Retry >= MaxRetry)
+ Item->FailNow = 1;
+
pthread_mutex_lock(&ActiveQItemsLock);
if (GetHash(ActiveQItems,
LKEY(Item->MessageID),
StrBufAppendBuf(QMessage, MyQItem->EnvelopeFrom, 0);
}
+ StrBufAppendBufPlain(QMessage, HKEY("\nretry|"), 0);
+ StrBufAppendPrintf(QMessage, "%ld",
+ MyQItem->Retry);
+
+ StrBufAppendBufPlain(QMessage, HKEY("\nattempted|"), 0);
+ StrBufAppendPrintf(QMessage, "%ld",
+ MyQItem->ReattemptWhen);
+
It = GetNewHashPos(MyQItem->MailQEntries, 0);
while (GetNextHashPos(MyQItem->MailQEntries, It, &len, &Key, &vQE))
{
MailQEntry *ThisItem = vQE;
- int i;
if (!ThisItem->Active)
{
/* skip already sent ones from the spoolfile. */
continue;
}
-
- for (i=0; i < ThisItem->nAttempts; i++) {
- /* TODO: most probably
- * there is just one retry/attempted per message!
- */
- StrBufAppendBufPlain(QMessage, HKEY("\nretry|"), 0);
- StrBufAppendPrintf(QMessage, "%ld",
- ThisItem->Attempts[i].retry);
-
- StrBufAppendBufPlain(QMessage, HKEY("\nattempted|"), 0);
- StrBufAppendPrintf(QMessage, "%ld",
- ThisItem->Attempts[i].when);
- }
StrBufAppendBufPlain(QMessage, HKEY("\nremote|"), 0);
StrBufAppendBuf(QMessage, ThisItem->Recipient, 0);
StrBufAppendBufPlain(QMessage, HKEY("|"), 0);
void QItem_Handle_retry(OneQueItem *Item, StrBuf *Line, const char **Pos)
{
- if (Item->Current == NULL)
- NewMailQEntry(Item);
- if (Item->Current->Attempts[Item->Current->nAttempts].retry != 0)
- Item->Current->nAttempts++;
- if (Item->Current->nAttempts > MaxAttempts) {
- Item->FailNow = 1;
- return;
- }
- Item->Current->Attempts[Item->Current->nAttempts].retry =
+ Item->Retry =
StrBufExtractNext_int(Line, Pos, '|');
+ Item->Retry *= 2;
}
void QItem_Handle_Attempted(OneQueItem *Item, StrBuf *Line, const char **Pos)
{
- if (Item->Current == NULL)
- NewMailQEntry(Item);
- if (Item->Current->Attempts[Item->Current->nAttempts].when != 0)
- Item->Current->nAttempts++;
- if (Item->Current->nAttempts > MaxAttempts) {
- Item->FailNow = 1;
- return;
- }
-
- Item->Current->Attempts[Item->Current->nAttempts].when =
- StrBufExtractNext_int(Line, Pos, '|');
- if (Item->Current->Attempts[Item->Current->nAttempts].when >
- Item->LastAttempt.when)
- {
- Item->LastAttempt.when =
- Item->Current->Attempts[Item->Current->nAttempts].when;
-
- Item->LastAttempt.retry =
- Item->Current->Attempts[
- Item->Current->nAttempts
- ].retry * 2;
-
- if (Item->LastAttempt.retry > SMTP_RETRY_MAX)
- Item->LastAttempt.retry = SMTP_RETRY_MAX;
- }
+ Item->ReattemptWhen = StrBufExtractNext_int(Line, Pos, '|');
}
/*
* Postpone delivery if we've already tried recently.
*/
- if (((time(NULL) - MyQItem->LastAttempt.when) <
- MyQItem->LastAttempt.retry) &&
+ if (((time(NULL) - MyQItem->ReattemptWhen) > 0) &&
(run_queue_now == 0))
{
syslog(LOG_DEBUG, "SMTP client: Retry time not yet reached.\n");
/* SMTP CLIENT (Queue Management) STUFF */
/*****************************************************************************/
-
-
#define MaxAttempts 15
-typedef struct _delivery_attempt {
- time_t when;
- time_t retry;
-}DeliveryAttempt;
typedef struct _mailq_entry {
- DeliveryAttempt Attempts[MaxAttempts];
- int nAttempts;
StrBuf *Recipient;
StrBuf *StatusMessage;
int Status;
* if null add a new one.
*/
MailQEntry *Current;
- DeliveryAttempt LastAttempt;
+ time_t ReattemptWhen;
+ time_t Retry;
+
long ActiveDeliveries;
StrBuf *EnvelopeFrom;
StrBuf *BounceTo;
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
cp -f /usr/share/misc/config.guess config.guess
endif
- CC=$(COMPILER); exportCFLAGS=" -Wformat -Werror=format-security $(CFLAGS)" ./configure \
+ export CC=$(COMPILER); export CFLAGS=" -Wformat -Werror=format-security $(CFLAGS)"; ./configure \
--host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr/sbin/ \
}
-int GetCurrentRoomFlags(folder *Room)
+int GetCurrentRoomFlags(folder *Room, int CareForStatusMessage)
{
StrBuf *Buf;
FlushStrBuf(Room->XAPass);
FlushStrBuf(Room->Directory);
StrBufCutLeft(Buf, 4);
- AppendImportantMessage (SKEY(Buf));
+ if (CareForStatusMessage)
+ AppendImportantMessage (SKEY(Buf));
FreeStrBuf(&Buf);
+ Room->XALoaded = 2;
return 0;
} else {
const char *Pos;
{
wcsession *WCC = WC;
- if (WCC->CurRoom.XALoaded)
+ if (WCC->CurRoom.XALoaded > 0)
return;
- GetCurrentRoomFlags(&WCC->CurRoom);
+ GetCurrentRoomFlags(&WCC->CurRoom, 0);
}
void toggle_self_service(void) {
wcsession *WCC = WC;
- if (GetCurrentRoomFlags (&WCC->CurRoom) == 0)
+ if (GetCurrentRoomFlags (&WCC->CurRoom, 1) == 0)
return;
if (yesbstr("QR2_SelfList"))
http_transmit_thing(ChrPtr(do_template("room_edit")), 0);
return;
}
- if (GetCurrentRoomFlags (&WCC->CurRoom) == 0)
+ if (GetCurrentRoomFlags (&WCC->CurRoom, 1) == 0) {
+ http_transmit_thing(ChrPtr(do_template("room_edit")), 0);
return;
+ }
LoadRoomAide();
wcsession *WCC = WC;
- if (GetCurrentRoomFlags(&WCC->CurRoom) == 1)
+ if (GetCurrentRoomFlags(&WCC->CurRoom, 1) == 1)
{
const char *Pos;
UserNames = sbstr("username");
/****** Properties ******/
+int ConditionalRoom_MayEdit(StrBuf *Target, WCTemplputParams *TP)
+{
+ wcsession *WCC = WC;
+
+ LoadRoomXA ();
+
+ return WCC->CurRoom.XALoaded == 1;
+}
+
int ConditionalThisRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
{
long QR_CheckFlag;
/****** Properties ******/
RegisterNamespace("ROOM:INFO:QRFLAGS", 0, 1, tmplput_ROOM_QRFLAGS, NULL, CTX_ROOMS);
RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalThisRoomHas_QRFlag, CTX_NONE);
+ RegisterConditional(HKEY("COND:THISROOM:EDIT"), 0, ConditionalRoom_MayEdit, CTX_NONE);
RegisterConditional(HKEY("COND:ROOM:FLAG:QR"), 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
RegisterConditional(HKEY("COND:THISROOM:FLAG:QR2"), 0, ConditionalThisRoomHas_QRFlag2, CTX_NONE);
WCC->serv_sock = tcp_connectsock(ctdlhost, ctdlport);
if (WCC->serv_sock < 0) {
+ WCC->connected = 0;
FreeStrBuf(&WCC->ReadBuf);
return 1;
}
-<div class="tabcontent">
+<?!("COND:THISROOM:EDIT", 1)><div class="tabcontent">
<table border="0" cellspacing="10">
<tr valign="top">
<td>
</tr>
</table>
</div>
+<?!("X", 1)><??("COND:THISROOM:EDIT", 20)><div class="tabcontent"><?_("Higher access is required to access this function.")></div><??("X", 20)>
-<div class="tabcontent">
+<?!("COND:THISROOM:EDIT", 1)><div class="tabcontent">
<form method="post" action="editroom">
<input type="hidden" name="nonce" value="<?NONCE>" />
<ul>
</center>
</form>
</div>
+<?!("X", 1)><??("COND:THISROOM:EDIT", 20)><div class="tabcontent"><?_("Higher access is required to access this function.")></div><??("X", 20)>
-<div class="tabcontent">
+<?!("COND:THISROOM:EDIT", 1)><div class="tabcontent">
<br />
<form method="post" action="set_room_policy">
<input type="hidden" name="nonce" value="<?NONCE>" />
<input type="hidden" name="last_tabsel" value="<?TAB:N>" />
</form>
</div>
+<?!("X", 1)><??("COND:THISROOM:EDIT", 20)><div class="tabcontent"><?_("Higher access is required to access this function.")></div><??("X", 20)>
{
FreeStrBuf(&sess->CLineBuf);
FreeStrBuf(&sess->ReadBuf);
+ sess->connected = 0;
sess->ReadPos = NULL;
FreeStrBuf(&sess->MigrateReadLineBuf);
if (sess->serv_sock > 0) {
syslog(LOG_DEBUG, "Closing socket %d", sess->serv_sock);
close(sess->serv_sock);
}
+ sess->serv_sock = -1;
}
HashList *HandlerHash = NULL;
void stuff_to_cookie(int unset_cookie);
-int GetConnected(void);
+extern int GetConnected(void);
void PutRequestLocalMem(void *Data, DeleteHashDataFunc DeleteIt)