Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,35 @@ jobs:
build:
runs-on: windows-latest

env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_DEFAULT_TRIPLET: ${{ matrix.arch == 'Win32' && 'x86-windows' || 'x64-windows' }}

steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v4

- name: Configure CMake (Win32 / Release)
- name: Install Ninja and Git
shell: pwsh
run: |
choco install ninja -y --no-progress

- name: Clone vcpkg
shell: pwsh
run: |
git clone https://github.com/microsoft/vcpkg.git $env:VCPKG_ROOT
& "$env:VCPKG_ROOT\bootstrap-vcpkg.bat"

- name: Configure CMake
shell: pwsh
run: >
cmake -S . -B build `
-G "Visual Studio 17 2022" `
-A Win32 `
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_DEFAULT_TRIPLET }}

- name: Build
shell: pwsh
run: |
cmake --build build --config Release --target PDW

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PDW-Win32-Release
path: build\Release\PDW.exe
if-no-files-found: error
run: cmake --build build --config Release
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# Base build script for building with cmake (http://www.cmake.org)

cmake_minimum_required( VERSION 3.5 )
project( PDW )
project(PDW LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Enforce Win32 (x86)
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
Expand Down Expand Up @@ -61,17 +64,21 @@ set( PDW_SRCS
sound_in.cpp
)

find_package(nlohmann_json CONFIG REQUIRED)

# Create executable
add_executable( PDW WIN32
${PDW_INCLUDES}
${PDW_SRCS}
)

# Required libraries
target_link_libraries( PDW
target_link_libraries( PDW PRIVATE
nlohmann_json::nlohmann_json
Comctl32.lib
Winmm.lib
Ws2_32.lib
Winhttp.lib
libssl_static.lib
libcrypto_static.lib
legacy_stdio_definitions.lib
Expand Down
10 changes: 10 additions & 0 deletions Headers/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define CLEARSCREENDLGBOX 123
#define MAIL_DLGBOX 124
#define SCREENOPTIONSDLGBOX 125
#define HTTPPOST_DLGBOX 126

#define IDM_LOGFILE 201
#define IDM_EXIT 202
Expand All @@ -43,6 +44,7 @@
#define IDM_OPTIONS 230
#define IDM_GENERAL 231
#define IDM_MAIL 232
#define IDM_HTTPPOST 233

#define IDM_FILTERS 240
#define IDM_FILTEROPTIONS 241
Expand Down Expand Up @@ -439,3 +441,11 @@
#define IDT_FILTERCHECKDUPLICATE 1306

#define IDT_MENU_RESTORE 1310

#define IDC_HTTPPOST_ENABLE 1320
#define IDC_HTTPPOST_URL 1321
#define IDC_HTTPPOST_AUTH 1322
#define IDC_HTTPPOST_USER 1323
#define IDC_HTTPPOST_PASSWORD 1324
#define IDC_HTTPPOST_QUEUE_MAX 1325
#define IDC_HTTPPOST_QUEUE_TTL 1326
10 changes: 10 additions & 0 deletions Headers/pdw.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define FILTER_FILE_LEN 128 // PH: was 256

#define MAX_STR_LEN 5120
#define HTTP_POST_URL_LEN 512

enum FILTER_TYPE { UNUSED_FILTER = 0,
FLEX_FILTER = 1,
Expand Down Expand Up @@ -188,6 +189,14 @@ typedef struct
int iMailPort ;
int nMailOptions ;

int http_post_enabled;
int http_post_auth;
char http_post_url[HTTP_POST_URL_LEN];
char http_post_user[MAIL_TEXT_LEN];
char http_post_password[MAIL_TEXT_LEN];
int http_post_queue_max;
int http_post_queue_ttl;

COLORREF color_background;
COLORREF color_address;
COLORREF color_timestamp;
Expand Down Expand Up @@ -420,6 +429,7 @@ BOOL FAR PASCAL FilterFindDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
BOOL FAR PASCAL FilterCheckDuplicateDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL FAR PASCAL MonStatDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL FAR PASCAL MailDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL FAR PASCAL HttpPostDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL NEAR SetTitle(HWND hWnd, TCHAR *cTitle);

BOOL ErrorMessageBox(LPCTSTR lpszText, LPCTSTR lpszTitle, LPCTSTR lpszFile, INT Line);
Expand Down
30 changes: 22 additions & 8 deletions Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "headers\helper_funcs.h"
#include "utils\binary.h"
#include "utils\smtp.h"
#include "utils\http_post.h"

#define FILTER_PARAM_LEN 500
#define MAXIMUM_GROUPSIZE 1000
Expand Down Expand Up @@ -188,15 +189,15 @@ void display_show_char(PaneStruct *pane, char cin)
{
if (cin == 0)
{
message_buffer[iMessageIndex] = '·';
mobitex_buffer[iMessageIndex] = '·';
message_buffer[iMessageIndex] = '�';
mobitex_buffer[iMessageIndex] = '�';
}
else if ((cin > 0) && (cin < 32))
{
message_buffer[iMessageIndex] = cin+32;
mobitex_buffer[iMessageIndex] = cin; // Keep original characters
}
else if ((cin > 126) && (cin != '»'))
else if ((cin > 126) && (cin != '�'))
{
message_buffer[iMessageIndex] = ' ';
mobitex_buffer[iMessageIndex] = cin; // Keep original characters
Expand All @@ -211,7 +212,7 @@ void display_show_char(PaneStruct *pane, char cin)
{
if (cin == '\n')
{
cin = '»'; // PH: Convert 'new line' to '»'
cin = '�'; // PH: Convert 'new line' to '�'
}
else if (cin > 127)
{
Expand Down Expand Up @@ -956,7 +957,7 @@ void ShowMessage()
}
}
}
else if (ch == '»') // Check for linefeed character '»'
else if (ch == '�') // Check for linefeed character '�'
{
if (Profile.Linefeed)
{
Expand Down Expand Up @@ -1328,6 +1329,19 @@ void ShowMessage()
szCurrentLabel[0]);
}

if (Profile.http_post_enabled)
{
HttpPostQueueMessage(bMATCH, bMONITOR_ONLY,
Current_MSG[MSG_CAPCODE],
Current_MSG[MSG_TIME],
Current_MSG[MSG_DATE],
Current_MSG[MSG_MODE],
Current_MSG[MSG_TYPE],
Current_MSG[MSG_BITRATE],
iMOBITEX ? Current_MSG[MSG_MOBITEX] : Current_MSG[MSG_MESSAGE],
szCurrentLabel[0]);
}

if (Current_MSG[MSG_MOBITEX][0]) Current_MSG[MSG_MOBITEX][0] = '\0';

} // end of ShowMessage()
Expand Down Expand Up @@ -2119,7 +2133,7 @@ void CollectLogfileLine(char *string, bool bFilter)
{
for (int pos=0; Current_MSG[MSG_MOBITEX][pos]!=0; pos++)
{
if (Current_MSG[MSG_MOBITEX][pos] == '»')
if (Current_MSG[MSG_MOBITEX][pos] == '�')
{
strcat(szLogFileLine, "\n");
for (int i=0; i<spacing+1; i++) strcat(szLogFileLine, " ");
Expand All @@ -2132,11 +2146,11 @@ void CollectLogfileLine(char *string, bool bFilter)
strcat(szLogFileLine, Current_MSG[MSG_MESSAGE]);
}
}
else if ((strstr(Current_MSG[MSG_MESSAGE], "»") != 0) && Profile.Linefeed)
else if ((strstr(Current_MSG[MSG_MESSAGE], "�") != 0) && Profile.Linefeed)
{
for (int pos=0; Current_MSG[MSG_MESSAGE][pos]!=0; pos++)
{
if (Current_MSG[MSG_MESSAGE][pos] == '»')
if (Current_MSG[MSG_MESSAGE][pos] == '�')
{
strcat(szLogFileLine, "\n");
for (int i=0; i<spacing+1; i++) strcat(szLogFileLine, " ");
Expand Down
84 changes: 84 additions & 0 deletions PDW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@
#include "utils\debug.h"
#include "utils\ostype.h"
#include "utils\smtp.h"
#include "utils\http_post.h"

#include "headers\helper_funcs.h" // Extra functies van Andreas

Expand Down Expand Up @@ -507,6 +508,14 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi
Profile.SystemTrayRestore = 0; // Flag for enabeling auto restore from tray
Profile.SMTP = 0; // Flag for SMTP-email

Profile.http_post_enabled = 0;
Profile.http_post_auth = 0;
Profile.http_post_url[0] = '\0';
Profile.http_post_user[0] = '\0';
Profile.http_post_password[0] = '\0';
Profile.http_post_queue_max = 100;
Profile.http_post_queue_ttl = 300;

Profile.FlexTIME = 0; // Flag for FlexTIME as systemtime
Profile.FlexGroupMode = 0;

Expand Down Expand Up @@ -1471,6 +1480,11 @@ LRESULT FAR PASCAL PDWWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
hWnd, (DLGPROC) MailDlgProc, 0L);
break;

case IDM_HTTPPOST:
GoModalDialogBoxParam(ghInstance, MAKEINTRESOURCE(HTTPPOST_DLGBOX),
hWnd, HttpPostDlgProc, 0L);
break;

case IDM_RELOAD:

if (FileExists(szFilterPathName))
Expand Down Expand Up @@ -1817,6 +1831,7 @@ LRESULT FAR PASCAL PDWWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam

// HWi, stop Mail thread.....
MailInit(NULL, NULL, NULL, NULL, NULL, NULL, 0, 0);
HttpPostShutdown();

if (bCapturing) Stop_Capturing(); // Reset and close audio device.
if (bPlayback) Stop_Playback(); // RAH: stop playback
Expand Down Expand Up @@ -9117,6 +9132,55 @@ BOOL FAR PASCAL MailDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
return (FALSE);
} // end of MailDlgProc

BOOL FAR PASCAL HttpPostDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
if (!CenterWindow(hDlg)) return (FALSE);

SendDlgItemMessage(hDlg, IDC_HTTPPOST_URL, EM_LIMITTEXT, HTTP_POST_URL_LEN - 1, 0L);
SendDlgItemMessage(hDlg, IDC_HTTPPOST_USER, EM_LIMITTEXT, MAIL_TEXT_LEN - 1, 0L);
SendDlgItemMessage(hDlg, IDC_HTTPPOST_PASSWORD, EM_LIMITTEXT, MAIL_TEXT_LEN - 1, 0L);

CheckDlgButton(hDlg, IDC_HTTPPOST_ENABLE, Profile.http_post_enabled);
CheckDlgButton(hDlg, IDC_HTTPPOST_AUTH, Profile.http_post_auth);
SetDlgItemText(hDlg, IDC_HTTPPOST_URL, Profile.http_post_url);
SetDlgItemText(hDlg, IDC_HTTPPOST_USER, Profile.http_post_user);
SetDlgItemText(hDlg, IDC_HTTPPOST_PASSWORD, Profile.http_post_password);
SetDlgItemInt(hDlg, IDC_HTTPPOST_QUEUE_MAX, Profile.http_post_queue_max, FALSE);
SetDlgItemInt(hDlg, IDC_HTTPPOST_QUEUE_TTL, Profile.http_post_queue_ttl, FALSE);
return (TRUE);

case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
Profile.http_post_enabled = IsDlgButtonChecked(hDlg, IDC_HTTPPOST_ENABLE) ? 1 : 0;
Profile.http_post_auth = IsDlgButtonChecked(hDlg, IDC_HTTPPOST_AUTH) ? 1 : 0;
SendDlgItemMessage(hDlg, IDC_HTTPPOST_URL, WM_GETTEXT, HTTP_POST_URL_LEN, (LPARAM)(LPCTSTR)Profile.http_post_url);
SendDlgItemMessage(hDlg, IDC_HTTPPOST_USER, WM_GETTEXT, MAIL_TEXT_LEN, (LPARAM)(LPCTSTR)Profile.http_post_user);
SendDlgItemMessage(hDlg, IDC_HTTPPOST_PASSWORD, WM_GETTEXT, MAIL_TEXT_LEN, (LPARAM)(LPCTSTR)Profile.http_post_password);
Profile.http_post_queue_max = GetDlgItemInt(hDlg, IDC_HTTPPOST_QUEUE_MAX, NULL, FALSE);
Profile.http_post_queue_ttl = GetDlgItemInt(hDlg, IDC_HTTPPOST_QUEUE_TTL, NULL, FALSE);

if (!Profile.http_post_queue_max) Profile.http_post_queue_max = 100;
if (!Profile.http_post_queue_ttl) Profile.http_post_queue_ttl = 300;

HttpPostInit(Profile.http_post_enabled, Profile.http_post_url, Profile.http_post_auth, Profile.http_post_user, Profile.http_post_password, Profile.http_post_queue_max, Profile.http_post_queue_ttl);
WriteSettings();
EndDialog(hDlg, TRUE);
return (TRUE);

case IDCANCEL:
EndDialog(hDlg, TRUE);
return (TRUE);
}
break;
}
return (FALSE);
} // end of HttpPostDlgProc


BOOL FAR PASCAL MonStatDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
Expand Down Expand Up @@ -9659,6 +9723,17 @@ BOOL GetPrivateProfileSettings(LPCTSTR lpszAppTitle, LPCTSTR lpszIniPathName, PP

MailInit(Profile.szMailHost, Profile.szMailHeloDomain, Profile.szMailFrom, Profile.szMailTo, Profile.szMailUser, Profile.szMailPassword, Profile.iMailPort, Profile.nMailOptions);

/***** Get HTTP POST settings *****/
pProfile->http_post_enabled = static_cast<INT>(GetPrivateProfileInt("HTTPPost", TEXT("Enable"), 0, lpszIniPathName));
GetPrivateProfileString("HTTPPost", TEXT("Url"), "", pProfile->http_post_url, HTTP_POST_URL_LEN, lpszIniPathName);
pProfile->http_post_auth = static_cast<INT>(GetPrivateProfileInt("HTTPPost", TEXT("Auth"), 0, lpszIniPathName));
GetPrivateProfileString("HTTPPost", TEXT("User"), "", pProfile->http_post_user, MAIL_TEXT_LEN, lpszIniPathName);
GetPrivateProfileString("HTTPPost", TEXT("Password"), "", pProfile->http_post_password, MAIL_TEXT_LEN, lpszIniPathName);
pProfile->http_post_queue_max = static_cast<INT>(GetPrivateProfileInt("HTTPPost", TEXT("QueueMax"), 100, lpszIniPathName));
pProfile->http_post_queue_ttl = static_cast<INT>(GetPrivateProfileInt("HTTPPost", TEXT("QueueTTL"), 300, lpszIniPathName));

HttpPostInit(pProfile->http_post_enabled, pProfile->http_post_url, pProfile->http_post_auth, pProfile->http_post_user, pProfile->http_post_password, pProfile->http_post_queue_max, pProfile->http_post_queue_ttl);

/***** Get Filter settings *****/

pProfile->filterfile_enabled = (INT) GetPrivateProfileInt("Filter", TEXT("FilterFileEnabled"), pProfile->filterfile_enabled, lpszIniPathName);
Expand Down Expand Up @@ -10114,6 +10189,15 @@ void WriteSettings()
fprintf(pFile, "Options=%i\n", Profile.nMailOptions);
fprintf(pFile, "SSL=%i\n", Profile.ssl);

fprintf(pFile, "\n[HTTPPost]\n");
fprintf(pFile, "Enable=%i\n", Profile.http_post_enabled);
fprintf(pFile, "Url=%s\n", Profile.http_post_url);
fprintf(pFile, "Auth=%i\n", Profile.http_post_auth);
fprintf(pFile, "User=%s\n", Profile.http_post_user);
fprintf(pFile, "Password=%s\n", Profile.http_post_password);
fprintf(pFile, "QueueMax=%i\n", Profile.http_post_queue_max);
fprintf(pFile, "QueueTTL=%i\n", Profile.http_post_queue_ttl);

fprintf(pFile, "\n[Filter]\n");
fprintf(pFile, "FilterFileEnabled=%i\n", Profile.filterfile_enabled);
fprintf(pFile, "FilterFile=%s\n", Profile.filterfile);
Expand Down
22 changes: 22 additions & 0 deletions Rsrc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ BEGIN
MENUITEM "&Options...\tCtrl-O", IDM_OPTIONS
MENUITEM "&General...\tCtrl-G", IDM_GENERAL
MENUITEM "&SMTP/Email...\tCtrl-M", IDM_MAIL
MENUITEM "HTTP &POST...", IDM_HTTPPOST
END
POPUP "Filters"
BEGIN
Expand Down Expand Up @@ -833,6 +834,27 @@ BEGIN
CONTROL "SSL",IDC_SMTP_SSL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,253,23,25,10
END

HTTPPOST_DLGBOX DIALOGEX 0, 0, 300, 142
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "HTTP POST settings"
FONT 8, "Verdana", 0, 0, 0x0
BEGIN
CONTROL "HTTP POST enabled",IDC_HTTPPOST_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,8,90,10
LTEXT "Endpoint URL (http/https)",IDC_STATIC,10,23,109,8
EDITTEXT IDC_HTTPPOST_URL,10,33,280,13,ES_AUTOHSCROLL
CONTROL "Use Basic Authentication",IDC_HTTPPOST_AUTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,52,108,10
LTEXT "Username",IDC_STATIC,10,66,33,8
EDITTEXT IDC_HTTPPOST_USER,56,63,102,13,ES_AUTOHSCROLL
LTEXT "Password",IDC_STATIC,166,66,32,8
EDITTEXT IDC_HTTPPOST_PASSWORD,206,63,84,13,ES_PASSWORD | ES_AUTOHSCROLL
LTEXT "Queue max size",IDC_STATIC,10,88,49,8
EDITTEXT IDC_HTTPPOST_QUEUE_MAX,74,85,40,13,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Queue TTL (sec)",IDC_STATIC,130,88,52,8
EDITTEXT IDC_HTTPPOST_QUEUE_TTL,194,85,40,13,ES_AUTOHSCROLL | ES_NUMBER
DEFPUSHBUTTON "OK",IDOK,188,120,47,14
PUSHBUTTON "Cancel",IDCANCEL,243,120,47,14
END


#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
Expand Down
Loading
Loading