From 7a61c594e1bf9fd62e156d3d8db772fe7c4bfd03 Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Thu, 28 Dec 2023 10:31:09 +0000 Subject: New upstream version 6.0.24.25 --- WebMail.c | 92 ++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 28 deletions(-) (limited to 'WebMail.c') diff --git a/WebMail.c b/WebMail.c index f626975..157938b 100644 --- a/WebMail.c +++ b/WebMail.c @@ -76,6 +76,8 @@ VOID SendTemplateSelectScreen(struct HTTPConnectionInfo * Session, char *URLPara BOOL isAMPRMsg(char * Addr); char * doXMLTransparency(char * string); Dll BOOL APIENTRY APISendAPRSMessage(char * Text, char * ToCall); +void SendMessageReadEvent(char * Call, struct MsgInfo * Msg); +void SendNewMessageEvent(char * call, struct MsgInfo * Msg); extern char NodeTail[]; extern char BBSName[10]; @@ -719,26 +721,27 @@ VOID ProcessFormDir(char * FormSet, char * DirName, struct HtmlFormDir *** xxx, { if (entry->d_type == DT_DIR) { - if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) + char Dir[MAX_PATH]; + + if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) continue; - Debugprintf("Recurse %s/%s/%s", FormSet, DirName, entry->d_name); - continue; + // Recurse in subdir + + sprintf(Dir, "%s/%s", DirName, entry->d_name); + ProcessFormDir(FormSet, Dir, &FormDir->Dirs, &FormDir->DirCount); + continue; } - // see if initial html -// if (stristr(entry->d_name, "initial.html")) - { - // Add to list + // Add to list - Form = zalloc(sizeof (struct HtmlForm)); + Form = zalloc(sizeof (struct HtmlForm)); - Form->FileName = _strdup(entry->d_name); + Form->FileName = _strdup(entry->d_name); - FormDir->Forms=realloc(FormDir->Forms, (FormDir->FormCount + 1) * sizeof(void *)); - FormDir->Forms[FormDir->FormCount++] = Form; - } + FormDir->Forms=realloc(FormDir->Forms, (FormDir->FormCount + 1) * sizeof(void *)); + FormDir->Forms[FormDir->FormCount++] = Form; } closedir(dir); #endif @@ -808,22 +811,23 @@ int GetHTMLFormSet(char * FormSet) if (!(dir = opendir(name))) { Debugprintf("cant open forms dir %s %d %d", name, errno, dir); - return 0; } - - while ((entry = readdir(dir)) != NULL) + else { - if (entry->d_type == DT_DIR) + while ((entry = readdir(dir)) != NULL) { - if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) - continue; + if (entry->d_type == DT_DIR) + { + if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) + continue; - // Add to Directory List + // Add to Directory List - ProcessFormDir(FormSet, entry->d_name, &HtmlFormDirs, &FormDirCount); - } - } - closedir(dir); + ProcessFormDir(FormSet, entry->d_name, &HtmlFormDirs, &FormDirCount); + } + } + closedir(dir); + } #endif // List for testing @@ -1122,7 +1126,7 @@ int ViewWebMailMessage(struct HTTPConnectionInfo * Session, char * Reply, int Nu Msg->status = 'Y'; Msg->datechanged=time(NULL); SaveMessageDatabase(); - + SendMessageReadEvent(Session->Callsign, Msg); } } } @@ -1190,6 +1194,7 @@ int ViewWebMailMessage(struct HTTPConnectionInfo * Session, char * Reply, int Nu Msg->status = 'Y'; Msg->datechanged=time(NULL); SaveMessageDatabase(); + SendMessageReadEvent(Session->Callsign, Msg); } } } @@ -1303,6 +1308,7 @@ int ViewWebMailMessage(struct HTTPConnectionInfo * Session, char * Reply, int Nu Msg->status = 'Y'; Msg->datechanged=time(NULL); SaveMessageDatabase(); + SendMessageReadEvent(Session->Callsign, Msg); } } } @@ -2776,11 +2782,16 @@ VOID SaveNewMessage(struct HTTPConnectionInfo * Session, char * MsgPtr, char * R if (Msg->status != 'H' && Msg->type == 'B' && memcmp(Msg->fbbs, zeros, NBMASK) != 0) Msg->status = '$'; // Has forwarding + if (EnableUI) SendMsgUI(Msg); user = LookupCall(Msg->to); + // If Event Notifications enabled report a new message event + + SendNewMessageEvent(user->Call, Msg); + if (user && (user->flags & F_APRSMFOR)) { char APRS[128]; @@ -2838,13 +2849,26 @@ char * GetHTMLViewerTemplate(char * FN) { for (l = 0; l < Dir->DirCount; l++) { - for (k = 0; k < Dir->Dirs[l]->FormCount; k++) + struct HtmlFormDir * SDir = Dir->Dirs[l]; + + if (SDir->DirCount) { - if (strcmp(FN, Dir->Dirs[l]->Forms[k]->FileName) == 0) + struct HtmlFormDir * SSDir = SDir->Dirs[0]; + int x = 1; + } + + for (k = 0; k < SDir->FormCount; k++) + { + if (_stricmp(FN, SDir->Forms[k]->FileName) == 0) { - return CheckFile(Dir, Dir->Dirs[l]->Forms[k]->FileName); + return CheckFile(SDir, SDir->Forms[k]->FileName); } } + if (SDir->DirCount) + { + struct HtmlFormDir * SSDir = SDir->Dirs[0]; + int x = 1; + } } } } @@ -3224,7 +3248,7 @@ BOOL ParseXML(WebMailInfo * WebMail, char * XMLOrig) *ptr2++ = 0; - ptr3 = strchr(ptr2, '<'); // end of value string + ptr3 = strstr(ptr2, "