summaryrefslogtreecommitdiff
path: root/plugins/Non-IM Contact
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-02 12:32:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-02 12:32:55 +0300
commit931a7dc1ac0dbc7e6c1083583ced915e572f5b47 (patch)
tree9fe9a6448d44030e26aa7107ce16044ed413e0d0 /plugins/Non-IM Contact
parentdd7d9954042254e66e3bbbec7195c6be8b1a0663 (diff)
all protocols (even virtual ones) moved to the Protocols folder
Diffstat (limited to 'plugins/Non-IM Contact')
-rw-r--r--plugins/Non-IM Contact/nimcontact.vcxproj28
-rw-r--r--plugins/Non-IM Contact/nimcontact.vcxproj.filters4
-rw-r--r--plugins/Non-IM Contact/res/Version.rc9
-rw-r--r--plugins/Non-IM Contact/res/resource.rc321
-rw-r--r--plugins/Non-IM Contact/res/star8.icobin894 -> 0 bytes
-rw-r--r--plugins/Non-IM Contact/src/contactinfo.cpp675
-rw-r--r--plugins/Non-IM Contact/src/dialog.cpp332
-rw-r--r--plugins/Non-IM Contact/src/files.cpp328
-rw-r--r--plugins/Non-IM Contact/src/http.cpp100
-rw-r--r--plugins/Non-IM Contact/src/main.cpp194
-rw-r--r--plugins/Non-IM Contact/src/namereplacing.cpp633
-rw-r--r--plugins/Non-IM Contact/src/resource.h76
-rw-r--r--plugins/Non-IM Contact/src/services.cpp112
-rw-r--r--plugins/Non-IM Contact/src/stdafx.cxx18
-rw-r--r--plugins/Non-IM Contact/src/stdafx.h130
-rw-r--r--plugins/Non-IM Contact/src/timer.cpp85
-rw-r--r--plugins/Non-IM Contact/src/version.h13
17 files changed, 0 insertions, 3058 deletions
diff --git a/plugins/Non-IM Contact/nimcontact.vcxproj b/plugins/Non-IM Contact/nimcontact.vcxproj
deleted file mode 100644
index 8b56095de6..0000000000
--- a/plugins/Non-IM Contact/nimcontact.vcxproj
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>NimContact</ProjectName>
- <ProjectGuid>{A556E0B5-73A1-4676-BA1F-133820DE7D5A}</ProjectGuid>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/plugins/Non-IM Contact/nimcontact.vcxproj.filters b/plugins/Non-IM Contact/nimcontact.vcxproj.filters
deleted file mode 100644
index de5ad9f66c..0000000000
--- a/plugins/Non-IM Contact/nimcontact.vcxproj.filters
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(ProjectDir)..\..\build\vc.common\common.filters" />
-</Project> \ No newline at end of file
diff --git a/plugins/Non-IM Contact/res/Version.rc b/plugins/Non-IM Contact/res/Version.rc
deleted file mode 100644
index bd3c22d943..0000000000
--- a/plugins/Non-IM Contact/res/Version.rc
+++ /dev/null
@@ -1,9 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#ifdef APSTUDIO_INVOKED
-#error this file is not editable by Microsoft Visual C++
-#endif //APSTUDIO_INVOKED
-
-#include "..\src\version.h"
-
-#include "..\..\build\Version.rc"
diff --git a/plugins/Non-IM Contact/res/resource.rc b/plugins/Non-IM Contact/res/resource.rc
deleted file mode 100644
index a40db23254..0000000000
--- a/plugins/Non-IM Contact/res/resource.rc
+++ /dev/null
@@ -1,321 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "../src/resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (United States) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_ADD_FILE DIALOG 0, 0, 283, 190
-STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "View/Edit Files"
-FONT 8, "MS Sans Serif"
-BEGIN
- COMBOBOX IDC_FILE_LIST,54,4,222,99,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- EDITTEXT IDC_URL,54,20,222,12,ES_AUTOHSCROLL
- EDITTEXT IDC_WWW_TIMER,82,37,30,12,ES_NUMBER
- PUSHBUTTON "Add File",IDC_ADD_FILE,202,37,34,12
- PUSHBUTTON "Add URL",IDC_ADD_URL,238,37,38,12
- PUSHBUTTON "Remove Selected File",IDC_DEL_FILE,202,52,73,12
- LISTBOX IDC_FILE_CONTENTS,4,70,272,113,LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
- LTEXT "file(#)",IDC_STATIC,4,6,28,8
- EDITTEXT IDC_FN,33,4,16,12,ES_READONLY | ES_NUMBER
- LTEXT "URL",IDC_STATIC,4,22,41,8
- LTEXT "Update URL every",IDC_STATIC,4,39,75,8
- LTEXT "Intervals",IDC_STATIC,117,39,33,8
- LTEXT "If the protocol timer is disabled, web pages won't be updated",IDC_STATIC,4,52,188,8
-END
-
-IDD_CONTACT_INFO DIALOG 0, 0, 283, 190
-STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "contact display info"
-FONT 8, "MS Sans Serif"
-BEGIN
- EDITTEXT IDC_DISPLAY_NAME,88,6,188,12,ES_AUTOHSCROLL
- EDITTEXT IDC_TOOLTIP,7,40,269,143,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
- LTEXT "Contacts display name",IDC_STATIC,7,8,72,8
- LTEXT "Contacts Tooltip",IDC_STATIC,7,26,52,8
-END
-
-IDD_OTHER_STUFF DIALOGEX 0, 0, 283, 190
-STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "other settings"
-FONT 8, "MS Sans Serif", 0, 0, 0x0
-BEGIN
- LTEXT "Link",IDC_STATIC,12,18,27,8
- EDITTEXT IDC_LINK,42,16,230,12,ES_AUTOHSCROLL
- LTEXT "Program parameters:",IDC_STATIC,12,33,83,8
- EDITTEXT IDC_PARAMS,97,31,175,12,ES_AUTOHSCROLL
- PUSHBUTTON "O&pen File",IDC_OPEN_FILE,149,47,56,14
- PUSHBUTTON "O&pen Folder",IDC_OPEN_FOLDER,216,47,56,14
- GROUPBOX "Link Settings",IDC_STATIC,7,4,269,60
- GROUPBOX "Contact list settings",IDC_STATIC,7,68,269,64
- COMBOBOX IDC_GROUP,43,79,158,74,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
- CONTROL "",CHK_ONLINE,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | WS_TABSTOP,71,95,16,16
- CONTROL "",CHK_AWAY,"Button",BS_AUTORADIOBUTTON | BS_ICON | BS_PUSHLIKE | WS_TABSTOP,90,95,16,16
- CONTROL "",CHK_NA,"Button",BS_AUTORADIOBUTTON | BS_ICON | BS_PUSHLIKE | WS_TABSTOP,109,95,16,16
- CONTROL "",CHK_OCC,"Button",BS_AUTORADIOBUTTON | BS_ICON | BS_PUSHLIKE | WS_TABSTOP,128,95,16,16
- CONTROL "",CHK_DND,"Button",BS_AUTORADIOBUTTON | BS_ICON | BS_PUSHLIKE | WS_TABSTOP,147,95,16,16
- CONTROL "",CHK_FFC,"Button",BS_AUTORADIOBUTTON | BS_ICON | BS_PUSHLIKE | WS_TABSTOP,166,95,16,16
- CONTROL "",CHK_INVISIBLE,"Button",BS_AUTORADIOBUTTON | BS_ICON | BS_PUSHLIKE | WS_TABSTOP,185,95,16,16
- CONTROL "",CHK_PHONE,"Button",BS_AUTORADIOBUTTON | BS_ICON | BS_PUSHLIKE | WS_TABSTOP,204,95,16,16
- CONTROL "",CHK_LUNCH,"Button",BS_AUTORADIOBUTTON | BS_ICON | BS_PUSHLIKE | WS_TABSTOP,223,95,16,16
- LTEXT "Group:",IDC_STATIC,12,81,29,8
- LTEXT "Status Icon",IDC_STATIC,12,99,54,8
- LTEXT "Group\\Sub-Group",IDC_STATIC,205,81,67,8
- GROUPBOX "Timer Settings",IDC_STATIC,7,139,269,44
- CONTROL "Use Timer",CHK_USE_TIMER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,148,108,10
- EDITTEXT IDC_TIMER,22,162,35,12,ES_NUMBER | WS_DISABLED
- CONTROL "Contact is always visible",IDC_ALWAYS_VISIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,115,92,10
- CONTROL "Unless Non-IM Contacts protocol is OFFLINE",IDC_VISIBLE_UNLESS_OFFLINE,
- "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,112,115,158,10
- LTEXT "Timer Intervals. ",IDC_TIMER_INTERVAL_MSG,61,166,211,8
-END
-
-IDD_OPTIONS DIALOGEX 0, 0, 291, 180
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Away as another status",IDC_AWAYISNOTONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,42,169,10
- CONTROL "Disable timer",IDC_DISABLETIMER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,99,106,10
- LTEXT "Timer interval (in seconds)",IDC_TIMER_TEXT,13,111,83,8
- EDITTEXT IDC_TIMER_INT,102,109,20,12,ES_NUMBER
- LTEXT "This will take affect after Non-IM Contacts' status is changed",IDC_TIMER_MSG,13,123,215,8
- GROUPBOX "Timer Options",IDC_STATIC,7,87,277,49
-END
-
-IDD_TEST_LINE DIALOG 0, 0, 435, 119
-STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "String Maker"
-FONT 8, "MS Sans Serif"
-BEGIN
- EDITTEXT IDC_STRING,15,17,409,14,ES_AUTOHSCROLL
- DEFPUSHBUTTON "&Test String",IDOK,385,56,43,14
- PUSHBUTTON "&Exit",IDCANCEL,385,92,43,14
- GROUPBOX "String to test",IDC_STATIC,7,7,421,41
- GROUPBOX "Returns....",IDC_STATIC,7,51,371,61
- EDITTEXT IDC_ANSWER,15,62,353,43,ES_MULTILINE | ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
- LTEXT "line()",IDC_LINE,73,36,16,8,WS_DISABLED
- LTEXT "start()",IDC_START,32,36,18,8,WS_DISABLED
- LTEXT "end()",IDC_END,53,36,17,8,WS_DISABLED
- LTEXT "wholeline()",IDC_WHOLELINE,111,36,34,8,WS_DISABLED
- LTEXT "csv()",IDC_CSV,92,36,16,8,WS_DISABLED
- LTEXT "file()",IDC_FILE,15,36,14,8,WS_DISABLED
- LTEXT "filename()",IDC_FILENAME,148,36,31,8,WS_DISABLED
- PUSHBUTTON "Help",IDC_HELPMSG,385,73,43,14
-END
-
-IDD_HELP DIALOGEX 0, 0, 267, 218
-STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION
-CAPTION "Help"
-FONT 9, "MS Sans Serif", 0, 0, 0x0
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,210,197,50,14
- EDITTEXT IDC_HELPTEXT,7,7,253,187,ES_MULTILINE | ES_READONLY | WS_VSCROLL
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_ADD_FILE, DIALOG
- BEGIN
- LEFTMARGIN, 4
- RIGHTMARGIN, 276
- VERTGUIDE, 26
- TOPMARGIN, 4
- BOTTOMMARGIN, 183
- HORZGUIDE, 4
- HORZGUIDE, 26
- HORZGUIDE, 37
- HORZGUIDE, 43
- HORZGUIDE, 52
- END
-
- IDD_CONTACT_INFO, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 276
- TOPMARGIN, 4
- BOTTOMMARGIN, 183
- HORZGUIDE, 12
- HORZGUIDE, 34
- END
-
- IDD_OTHER_STUFF, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 276
- VERTGUIDE, 12
- VERTGUIDE, 39
- VERTGUIDE, 272
- TOPMARGIN, 4
- BOTTOMMARGIN, 183
- HORZGUIDE, 22
- HORZGUIDE, 37
- HORZGUIDE, 47
- HORZGUIDE, 85
- HORZGUIDE, 103
- HORZGUIDE, 120
- HORZGUIDE, 149
- HORZGUIDE, 174
- END
-
- IDD_OPTIONS, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 284
- VERTGUIDE, 13
- TOPMARGIN, 7
- BOTTOMMARGIN, 173
- HORZGUIDE, 99
- HORZGUIDE, 115
- END
-
- IDD_TEST_LINE, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 428
- VERTGUIDE, 15
- VERTGUIDE, 385
- VERTGUIDE, 424
- TOPMARGIN, 7
- BOTTOMMARGIN, 112
- HORZGUIDE, 36
- END
-
- IDD_HELP, DIALOG
- BEGIN
- LEFTMARGIN, 7
- TOPMARGIN, 7
- BOTTOMMARGIN, 154
- END
-END
-#endif // APSTUDIO_INVOKED
-
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_MAIN ICON "star8.ico"
-#endif // English (United States) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (Australia) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
-#pragma code_page(1252)
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_CONTACT_COPYEXPORT DIALOGEX 0, 0, 283, 190
-STYLE DS_SETFONT | DS_MODALFRAME | WS_CHILD | WS_CAPTION | WS_SYSMENU
-CAPTION "Copy / Export contact"
-FONT 8, "MS Sans Serif", 0, 0, 0x0
-BEGIN
- EDITTEXT IDC_STRING_REPLACE,13,43,254,108,ES_MULTILINE | ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL
- PUSHBUTTON "&Export Non-IM Contact",IDC_EXPORT,13,159,94,14
- PUSHBUTTON "Co&py Non-IM Contact",IDC_DOIT,173,159,94,14
- GROUPBOX "",IDC_STATIC,7,7,269,176
- CONTROL "Type one replace string per line in the format ""original text,new text""",IDC_STATIC,
- "Static",SS_LEFTNOWORDWRAP | WS_GROUP,13,18,254,10
- LTEXT "EXAMPLE: %fn1,%fn2",IDC_STATIC,13,31,254,8
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_CONTACT_COPYEXPORT, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 276
- VERTGUIDE, 13
- VERTGUIDE, 267
- TOPMARGIN, 7
- BOTTOMMARGIN, 183
- HORZGUIDE, 159
- END
-END
-#endif // APSTUDIO_INVOKED
-
-#endif // English (Australia) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/plugins/Non-IM Contact/res/star8.ico b/plugins/Non-IM Contact/res/star8.ico
deleted file mode 100644
index a4953cd753..0000000000
--- a/plugins/Non-IM Contact/res/star8.ico
+++ /dev/null
Binary files differ
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp
deleted file mode 100644
index e60f82bd40..0000000000
--- a/plugins/Non-IM Contact/src/contactinfo.cpp
+++ /dev/null
@@ -1,675 +0,0 @@
-#include "stdafx.h"
-
-INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwnd);
- {
- MCONTACT hContact = (MCONTACT)((PROPSHEETPAGE*)lParam)->lParam;
- char name[2048];
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)hContact);
-
- if (db_get_static(hContact, MODNAME, "Name", name, _countof(name)))
- break;
- SetDlgItemTextA(hwnd, IDC_DISPLAY_NAME, name);
- if (db_get_static(hContact, MODNAME, "ToolTip", name, _countof(name)))
- break;
- SetDlgItemTextA(hwnd, IDC_TOOLTIP, name);
- }
- return TRUE;
-
- case WM_COMMAND:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- return TRUE;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_DISPLAY_NAME))) {
- char text[512];
- GetDlgItemTextA(hwnd, IDC_DISPLAY_NAME, text, _countof(text));
- g_plugin.setString(hContact, "Name", text);
- WriteSetting(hContact, MODNAME, "Name", MODNAME, "Nick");
- }
- else {
- g_plugin.delSetting(hContact, "Name");
- g_plugin.delSetting(hContact, "Nick");
- }
-
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_TOOLTIP))) {
- char text[2048];
- GetDlgItemTextA(hwnd, IDC_TOOLTIP, text, _countof(text));
- g_plugin.setString(hContact, "ToolTip", text);
- WriteSetting(hContact, MODNAME, "ToolTip", "UserInfo", "MyNotes");
- }
- else {
- g_plugin.delSetting(hContact, "ToolTip");
- db_unset(hContact, "UserInfo", "MyNotes");
- }
- }
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-static WNDPROC g_PrevBtnWndProc = nullptr;
-
-LRESULT CALLBACK ButtWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- LRESULT res = CallWindowProc(g_PrevBtnWndProc, hWnd, message, wParam, lParam);
- if (WM_PAINT == message) {
- RECT rc;
- HDC dc = GetDC(hWnd);
- BOOL isPressed = BST_CHECKED == SendMessage(hWnd, BM_GETCHECK, 0, 0);
-
- GetClientRect(hWnd, &rc);
- rc.left += (rc.right - rc.left - 16) / 2;
- rc.top += (rc.bottom - rc.top - 16) / 2;
- if (isPressed)
- OffsetRect(&rc, 1, 1);
- DrawIconEx(dc, rc.left, rc.top, (HICON)GetWindowLongPtr(hWnd, GWLP_USERDATA), 16, 16, 0, nullptr, DI_NORMAL);
- ReleaseDC(hWnd, dc);
- }
-
- return res;
-}
-
-int BrowseForFolder(HWND hwnd, char *szPath)
-{
- int result = 0;
- LPMALLOC pMalloc;
-
- if (SUCCEEDED(CoGetMalloc(1, &pMalloc))) {
- ptrW tszPath(mir_a2u(szPath));
- BROWSEINFO bi = {};
- bi.hwndOwner = hwnd;
- bi.pszDisplayName = tszPath;
- bi.lpszTitle = TranslateT("Select Folder");
- bi.ulFlags = BIF_EDITBOX | BIF_RETURNONLYFSDIRS; // Use this combo instead of BIF_USENEWUI
- bi.lParam = (LPARAM)szPath;
-
- ITEMIDLIST *pidlResult = SHBrowseForFolder(&bi);
- if (pidlResult) {
- SHGetPathFromIDListA(pidlResult, szPath);
- mir_strcat(szPath, "\\");
- result = 1;
- }
- pMalloc->Free(pidlResult);
- pMalloc->Release();
- }
-
- return result;
-}
-
-INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwnd);
- {
- MCONTACT hContact = (MCONTACT)((PROPSHEETPAGE*)lParam)->lParam;
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)hContact);
- if (!hContact)
- break;
-
- /* link*/
- DBVARIANT dbv;
- if (!g_plugin.getWString(hContact, "ProgramString", &dbv)) {
- SetDlgItemText(hwnd, IDC_LINK, dbv.pwszVal);
- db_free(&dbv);
- }
-
- if (!g_plugin.getWString(hContact, "ProgramParamsString", &dbv)) {
- SetDlgItemText(hwnd, IDC_PARAMS, dbv.pwszVal);
- db_free(&dbv);
- }
-
- /* group*/
- wchar_t *szGroup;
- for (int i = 1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++)
- SendDlgItemMessage(hwnd, IDC_GROUP, CB_INSERTSTRING, 0, LPARAM(szGroup));
-
- if (!db_get_ws(hContact, "CList", "Group", &dbv)) {
- SetDlgItemText(hwnd, IDC_GROUP, dbv.pwszVal);
- db_free(&dbv);
- }
-
- /* icons */
- CheckRadioButton(hwnd, 40072, 40080, g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE));
- SetWindowLongPtr(GetDlgItem(hwnd, CHK_ONLINE), GWLP_USERDATA, (LONG_PTR)Skin_LoadProtoIcon(MODNAME, ID_STATUS_ONLINE));
- g_PrevBtnWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwnd, CHK_ONLINE), GWLP_WNDPROC, (LONG_PTR)ButtWndProc);
- for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
- SetWindowLongPtr(GetDlgItem(hwnd, i), GWLP_USERDATA, (LONG_PTR)Skin_LoadProtoIcon(MODNAME, i));
- SetWindowLongPtr(GetDlgItem(hwnd, i), GWLP_WNDPROC, (LONG_PTR)ButtWndProc);
- }
- db_free(&dbv);
- /* timer */
- CheckDlgButton(hwnd, CHK_USE_TIMER, g_plugin.getByte(hContact, "UseTimer", 0) ? BST_CHECKED : BST_UNCHECKED);
- if (g_plugin.getWord(hContact, "Timer", 15)) {
- CheckDlgButton(hwnd, CHK_USE_TIMER, BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 1);
- wchar_t string[512];
- SetDlgItemText(hwnd, IDC_TIMER, _itow(g_plugin.getWord(hContact, "Timer", 15), string, 10));
- if (!g_plugin.getWord("Timer", 1))
- SetDlgItemText(hwnd, IDC_TIMER_INTERVAL_MSG, TranslateT("Non-IM Contact protocol timer is Disabled"));
- else {
- mir_snwprintf(string, TranslateT("Timer intervals... Non-IM Contact Protocol timer is %d seconds"), g_plugin.getWord("Timer", 1));
- SetDlgItemText(hwnd, IDC_TIMER_INTERVAL_MSG, string);
- }
- }
- /* always visible */
- if (g_plugin.getByte(hContact, "AlwaysVisible", 0)) {
- CheckDlgButton(hwnd, IDC_ALWAYS_VISIBLE, BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd, IDC_VISIBLE_UNLESS_OFFLINE), 1);
- CheckDlgButton(hwnd, IDC_VISIBLE_UNLESS_OFFLINE, g_plugin.getByte(hContact, "VisibleUnlessOffline", 1) ? BST_CHECKED : BST_UNCHECKED);
- }
- }
- return TRUE;
-
- case WM_COMMAND:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- switch (LOWORD(wParam)) {
- case IDC_ALWAYS_VISIBLE:
- if (IsDlgButtonChecked(hwnd, IDC_ALWAYS_VISIBLE)) {
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- EnableWindow(GetDlgItem(hwnd, IDC_VISIBLE_UNLESS_OFFLINE), 1);
- CheckDlgButton(hwnd, IDC_VISIBLE_UNLESS_OFFLINE, g_plugin.getByte(hContact, "VisibleUnlessOffline", 1) ? BST_CHECKED : BST_UNCHECKED);
- }
- else EnableWindow(GetDlgItem(hwnd, IDC_VISIBLE_UNLESS_OFFLINE), 0);
- break;
-
- case CHK_USE_TIMER:
- if (IsDlgButtonChecked(hwnd, CHK_USE_TIMER)) {
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- char string[4];
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 1);
- SetDlgItemTextA(hwnd, IDC_TIMER, _itoa(g_plugin.getWord(hContact, "Timer", 15), string, 10));
- }
- else EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 0);
- break;
-
- case IDC_OPEN_FILE:
- char szFileName[512];
- if (Openfile(szFileName, 1))
- SetDlgItemTextA(hwnd, IDC_LINK, szFileName);
- break;
-
- case IDC_OPEN_FOLDER:
- if (BrowseForFolder(hwnd, szFileName)) {
- mir_snprintf(szFileName, "%s ,/e", szFileName);
- SetDlgItemTextA(hwnd, IDC_LINK, "explorer.exe");
- SetDlgItemTextA(hwnd, IDC_PARAMS, szFileName);
- }
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- int status = GetLCStatus(0, 0);
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_LINK))) {
- char text[512];
- GetDlgItemTextA(hwnd, IDC_LINK, text, _countof(text));
- g_plugin.setString(hContact, "ProgramString", text);
- WriteSetting(hContact, MODNAME, "ProgramString", MODNAME, "Program");
- }
- else g_plugin.delSetting(hContact, "ProgramString");
-
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_PARAMS))) {
- char text[512];
- GetDlgItemTextA(hwnd, IDC_PARAMS, text, _countof(text));
- g_plugin.setString(hContact, "ProgramParamsString", text);
- WriteSetting(hContact, MODNAME, "ProgramParamsString", MODNAME, "ProgramParams");
- }
- else g_plugin.delSetting(hContact, "ProgramParamsString");
-
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_GROUP))) {
- wchar_t text[512];
- GetDlgItemText(hwnd, IDC_GROUP, text, _countof(text));
- Clist_GroupCreate(NULL, text);
- db_set_ws(hContact, "CList", "Group", text);
- }
- else db_unset(hContact, "CList", "Group");
-
- for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
- if (IsDlgButtonChecked(hwnd, i))
- g_plugin.setWord(hContact, "Icon", (WORD)i);
-
- /* set correct status */
- if (status == ID_STATUS_ONLINE || status == ID_STATUS_AWAY || (status == g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE)))
- g_plugin.setWord(hContact, "Status", (WORD)g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE));
- else
- g_plugin.setWord(hContact, "Status", ID_STATUS_OFFLINE);
-
- if (IsDlgButtonChecked(hwnd, CHK_USE_TIMER)) {
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER))) {
- wchar_t text[512];
- GetDlgItemText(hwnd, IDC_TIMER, text, _countof(text));
- g_plugin.setWord(hContact, "Timer", (WORD)_wtoi(text));
- }
- else g_plugin.setWord(hContact, "Timer", 15);
- }
- else g_plugin.setWord(hContact, "Timer", 0);
-
- // always visible
- g_plugin.setByte(hContact, "AlwaysVisible", (BYTE)IsDlgButtonChecked(hwnd, IDC_ALWAYS_VISIBLE));
- g_plugin.setByte(hContact, "VisibleUnlessOffline", (BYTE)IsDlgButtonChecked(hwnd, IDC_VISIBLE_UNLESS_OFFLINE));
- }
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-char* copyReplaceString(char* oldStr, char* newStr, char* findStr, char* replaceWithStr)
-{
- int i = 0;
- while (oldStr[i] != '\0') {
- // msg(&oldStr[i],"");
- if (!strncmp(&oldStr[i], findStr, mir_strlen(findStr))) {
- mir_strcat(newStr, replaceWithStr);
- i += (int)mir_strlen(findStr);
- }
- else {
- strncat(newStr, &oldStr[i], 1);
- i++;
- }
- }
- return newStr;
-}
-
-#define MAX_REPLACES 15
-
-INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwnd);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, ((PROPSHEETPAGE*)lParam)->lParam);
- return TRUE;
-
- case WM_COMMAND:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- switch (LOWORD(wParam)) {
- case IDC_EXPORT:
- ExportContact((MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA));
- break;
-
- case IDC_DOIT:
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE))) {
- char newString[MAX_REPLACES][512], oldString[MAX_REPLACES][512];
- char dbVar1[2000], dbVar2[2000];
- int i = 0, j = 0, k = 0;
- char *string = oldString[k];
- MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (!db_get_static(hContact1, MODNAME, "Name", dbVar1, _countof(dbVar1))) {
- char *replace = (char*)malloc(GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) + 1);
- GetDlgItemTextA(hwnd, IDC_STRING_REPLACE, replace, GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) + 1);
- // get the list of replace strings
- while (replace[i] != '\0') {
- if (replace[i] == ',') {
- string = newString[k];
- j = 0;
- }
- else if (!strncmp(replace + i, "\r\n", 2)) {
- if (string == newString[k])
- k--;
- if (k == MAX_REPLACES)
- break;
- string = oldString[++k];
- i += 2;
- continue;
- }
- else {
- string[j] = replace[i];
- string[++j] = '\0';
- }
- i++;
- }
- free(replace);
- MCONTACT hContact2 = db_add_contact();
- Proto_AddToContact(hContact2, MODNAME);
- CallService(MS_IGNORE_IGNORE, (WPARAM)hContact2, IGNOREEVENT_USERONLINE);
- g_plugin.setString(hContact2, "Nick", Translate("New Non-IM Contact"));
- // blank dbVar2 so the replaceing doesnt crash..
- mir_strcpy(dbVar2, "");
- // copy the name (dbVar1 is the name)
- for (i = 0; i < k; i++)
- copyReplaceString(dbVar1, dbVar2, oldString[i], newString[i]);
-
- g_plugin.setString(hContact2, "Name", dbVar2);
- // copy the ProgramString
- if (!db_get_static(hContact1, MODNAME, "ProgramString", dbVar1, _countof(dbVar1))) {
- mir_strcpy(dbVar2, "");
- for (i = 0; i <= k; i++)
- copyReplaceString(dbVar1, dbVar2, oldString[i], newString[i]);
-
- g_plugin.setString(hContact2, "ProgramString", dbVar2);
- }
- // copy the ProgramParamString
- if (!db_get_static(hContact1, MODNAME, "ProgramParamString", dbVar1, _countof(dbVar1))) {
- mir_strcpy(dbVar2, "");
- for (i = 0; i <= k; i++)
- copyReplaceString(dbVar1, dbVar2, oldString[i], newString[i]);
-
- g_plugin.setString(hContact2, "ProgramParamString", dbVar2);
- }
- // copy the group
- if (!db_get_static(hContact1, "CList", "Group", dbVar1, _countof(dbVar1))) {
- mir_strcpy(dbVar2, "");
- for (i = 0; i <= k; i++)
- copyReplaceString(dbVar1, dbVar2, oldString[i], newString[i]);
-
- db_set_s(hContact2, "CList", "Group", dbVar2);
- }
- // copy the ToolTip
- if (!db_get_static(hContact1, MODNAME, "ToolTip", dbVar1, _countof(dbVar1))) {
- mir_strcpy(dbVar2, "");
- for (i = 0; i <= k; i++)
- copyReplaceString(dbVar1, dbVar2, oldString[i], newString[i]);
-
- g_plugin.setString(hContact2, "ToolTip", dbVar2);
- }
- // timer
- g_plugin.setByte(hContact2, "UseTimer", g_plugin.getByte(hContact1, "UseTimer"));
- g_plugin.setByte(hContact2, "Minutes", g_plugin.getByte(hContact1, "Minutes"));
- g_plugin.setWord(hContact2, "Timer", g_plugin.getWord(hContact1, "Timer"));
- //icon
- g_plugin.setWord(hContact2, "Icon", g_plugin.getWord(hContact1, "Icon", 40072));
- replaceAllStrings(hContact2);
- }
- }
- else {
- char dbVar1[2000];
- MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (!db_get_static(hContact1, MODNAME, "Name", dbVar1, _countof(dbVar1))) {
- MCONTACT hContact2 = db_add_contact();
- if (!hContact2) {
- msg("contact did not get created", "");
- return 0;
- }
- Proto_AddToContact(hContact2, MODNAME);
- CallService(MS_IGNORE_IGNORE, (WPARAM)hContact2, IGNOREEVENT_USERONLINE);
- g_plugin.setString(hContact2, "Nick", Translate("New Non-IM Contact"));
- g_plugin.setString(hContact2, "Name", dbVar1);
- if (!db_get_static(hContact1, MODNAME, "ProgramString", dbVar1, _countof(dbVar1)))
- g_plugin.setString(hContact2, "ProgramString", dbVar1);
-
- // copy the ProgramParamString
- if (!db_get_static(hContact1, MODNAME, "ProgramParamString", dbVar1, _countof(dbVar1)))
- g_plugin.setString(hContact2, "ProgramParamString", dbVar1);
-
- // copy the group
- if (!db_get_static(hContact1, "CList", "Group", dbVar1, _countof(dbVar1)))
- db_set_s(hContact2, "CList", "Group", dbVar1);
-
- // copy the ToolTip
- if (!db_get_static(hContact1, MODNAME, "ToolTip", dbVar1, _countof(dbVar1)))
- g_plugin.setString(hContact2, "ToolTip", dbVar1);
-
- // timer
- g_plugin.setByte(hContact2, "UseTimer", g_plugin.getByte(hContact1, "UseTimer"));
- g_plugin.setByte(hContact2, "Minutes", g_plugin.getByte(hContact1, "Minutes"));
- g_plugin.setWord(hContact2, "Timer", g_plugin.getWord(hContact1, "Timer"));
-
- //icon
- g_plugin.setWord(hContact2, "Icon", g_plugin.getWord(hContact1, "Icon", 40072));
- replaceAllStrings(hContact2);
- }
- }
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- return TRUE;
- }
- }
- break;
- }
- return FALSE;
-}
-
-void ExportContact(MCONTACT hContact)
-{
- char szFileName[MAX_PATH];
- char DBVar[1024];
- int tmp;
-
- if (Openfile(szFileName, 0)) {
- // if (tmp = MessageBox(0, "Do you want to overwrite the contents of the file?\r\n\r\nPressing No will append this contact to the end of the file.",modFullname, MB_YESNO) == IDYES)
- // file = fopen(szFileName, "w");
- // else
- FILE *file = fopen(szFileName, "a");
- if (file) {
- if (!db_get_static(hContact, MODNAME, "Name", DBVar, _countof(DBVar))) {
- fprintf(file, "\r\n[Non-IM Contact]\r\nName=%s\r\n", DBVar);
- if (!db_get_static(hContact, MODNAME, "ProgramString", DBVar, _countof(DBVar)))
- fprintf(file, "ProgramString=%s\r\n", DBVar);
- if (!db_get_static(hContact, MODNAME, "ProgramParamString", DBVar, _countof(DBVar)))
- fprintf(file, "ProgramParamString=%s\r\n", DBVar);
- if (!db_get_static(hContact, MODNAME, "ToolTip", DBVar, _countof(DBVar)))
- fprintf(file, "ToolTip=%s</tooltip>\r\n", DBVar);
- if (!db_get_static(hContact, "CList", "Group", DBVar, _countof(DBVar)))
- fprintf(file, "Group=%s\r\n", DBVar);
- if (tmp = g_plugin.getWord(hContact, "Icon", 40072))
- fprintf(file, "Icon=%d\r\n", tmp);
- if (tmp = g_plugin.getByte(hContact, "UseTimer", 0))
- fprintf(file, "UseTimer=%d\r\n", tmp);
- if (tmp = g_plugin.getByte(hContact, "Minutes", 1))
- fprintf(file, "Minutes=%d\r\n", tmp);
- if (tmp = g_plugin.getWord(hContact, "Timer", 0))
- fprintf(file, "Timer=%d\r\n", tmp);
- fprintf(file, "[/Non-IM Contact]\r\n");
- }
- else ("Contact is invalid", modFullname);
- fclose(file);
- }
- }
-}
-
-INT_PTR ImportContacts(WPARAM, LPARAM)
-{
- MCONTACT hContact;
- char name[256] = "", program[256] = "", programparam[256] = "", group[256] = "", line[2001] = "";
- int icon = 40072, usetimer = 0, minutes = 1, timer = 0;
- char fn[MAX_PATH];
- int i, j, contactDone = 0;
- if (!Openfile(fn, 1))
- return 1;
-
- FILE *file = fopen(fn, "r");
- if (!file)
- return 1;
-
- CMStringA tooltip;
-
- while (fgets(line, 2000, file)) {
- if (!mir_strcmp(line, "\r\n\0"))
- continue;
- if (!mir_strcmp(line, "[Non-IM Contact]\r\n"))
- contactDone = 0;
- else if (!strncmp(line, "Name=", mir_strlen("Name="))) {
- i = (int)mir_strlen("Name="); j = 0;
- while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') {
- name[j] = line[i++];
- name[++j] = '\0';
- }
- contactDone = 1;
- }
- else if (!strncmp(line, "ProgramString=", mir_strlen("ProgramString="))) {
- i = (int)mir_strlen("ProgramString="); j = 0;
- while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') {
- program[j] = line[i++];
- program[++j] = '\0';
- }
- }
- else if (!strncmp(line, "ProgramParamString=", mir_strlen("ProgramParamString="))) {
- i = (int)mir_strlen("ProgramParamString="); j = 0;
- while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') {
- programparam[j] = line[i++];
- programparam[++j] = '\0';
- }
- }
- else if (!strncmp(line, "Group=", mir_strlen("Group="))) {
- i = (int)mir_strlen("Group="); j = 0;
- while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') {
- group[j] = line[i++];
- group[++j] = '\0';
- }
- }
- else if (!strncmp(line, "ToolTip=", mir_strlen("ToolTip="))) {
- i = (int)mir_strlen("ToolTip=");
- tooltip = &line[i];
- fgets(line, 2000, file);
- while (!strstr(line, "</tooltip>\r\n")) {
- tooltip.Append(line);
- fgets(line, 2000, file);
- }
- // the line that has the </tooltip>
- tooltip.Append(line);
- }
- else if (!strncmp(line, "Icon=", mir_strlen("Icon="))) {
- i = (int)mir_strlen("Icon=");
- sscanf(&line[i], "%d", &icon);
- }
- else if (!strncmp(line, "UseTimer=", mir_strlen("UseTimer="))) {
- i = (int)mir_strlen("UseTimer=");
- sscanf(&line[i], "%d", &usetimer);
- }
- else if (!strncmp(line, "Timer=", mir_strlen("Timer="))) {
- i = (int)mir_strlen("Timer=");
- sscanf(&line[i], "%d", &timer);
- }
- else if (!strncmp(line, "Minutes=", mir_strlen("Minutes="))) {
- i = (int)mir_strlen("Minutes=");
- sscanf(&line[i], "%d", &minutes);
- }
- else if (contactDone && !mir_strcmp(line, "[/Non-IM Contact]\r\n")) {
- if (!name) continue;
- size_t size = mir_strlen(name) + mir_strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1;
- char *msg = (char*)malloc(size);
- mir_snprintf(msg, size, "Do you want to import this Non-IM Contact?\r\n\r\nName: %s\r\n", name);
- if (program[0] != '\0') {
- msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(program) + mir_strlen("Program: \r\n") + 1);
- mir_strcat(msg, "Program: ");
- mir_strcat(msg, program);
- mir_strcat(msg, "\r\n");
- }
- if (programparam[0] != '\0') {
- msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(programparam) + mir_strlen("Program Parameters: \r\n") + 1);
- mir_strcat(msg, "Program Parameters: ");
- mir_strcat(msg, programparam);
- mir_strcat(msg, "\r\n");
- }
- if (tooltip) {
- msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(tooltip) + mir_strlen("ToolTip: \r\n") + 1);
- mir_strcat(msg, "ToolTip: ");
- mir_strcat(msg, tooltip);
- mir_strcat(msg, "\r\n");
- }
- if (group[0] != '\0') {
- msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(group) + mir_strlen("Group: \r\n") + 1);
- mir_strcat(msg, "Group: ");
- mir_strcat(msg, group);
- mir_strcat(msg, "\r\n");
- }
- if (icon) {
- char tmp[64];
- if (icon == ID_STATUS_ONLINE)
- mir_snprintf(tmp, "Icon: Online\r\n");
- else if (icon == ID_STATUS_AWAY)
- mir_snprintf(tmp, "Icon: Away\r\n");
- else if (icon == ID_STATUS_NA)
- mir_snprintf(tmp, "Icon: N/A\r\n");
- else if (icon == ID_STATUS_DND)
- mir_snprintf(tmp, "Icon: DND\r\n");
- else if (icon == ID_STATUS_OCCUPIED)
- mir_snprintf(tmp, "Icon: Occupied\r\n");
- else if (icon == ID_STATUS_FREECHAT)
- mir_snprintf(tmp, "Icon: Free for chat\r\n");
- else if (icon == ID_STATUS_INVISIBLE)
- mir_snprintf(tmp, "Icon: Invisible\r\n");
- else if (icon == ID_STATUS_ONTHEPHONE)
- mir_snprintf(tmp, "Icon: On the phone\r\n");
- else if (icon == ID_STATUS_OUTTOLUNCH)
- mir_snprintf(tmp, "Icon: Out to lunch\r\n");
- else {
- free(msg);
- continue;
- }
- char *msgtemp = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(tmp) + 1);
- if (msgtemp) {
- msg = msgtemp;
- mir_strcat(msg, tmp);
- }
- }
- if (usetimer && timer) {
- char tmp[64], tmp2[8];
- if (minutes)
- mir_strcpy(tmp2, "Minutes");
- else mir_strcpy(tmp2, "Seconds");
- mir_snprintf(tmp, "UseTimer: Yes\r\nTimer: %d %s", timer, tmp2);
- char *msgtemp = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(tmp) + 1);
- if (msgtemp) {
- msg = msgtemp;
- mir_strcat(msg, tmp);
- }
- }
-
- if (MessageBoxA(nullptr, msg, modFullname, MB_YESNO) == IDYES) {
- if (!(hContact = db_add_contact())) {
- msg("contact did get created", "");
- continue;
- }
- Proto_AddToContact(hContact, MODNAME);
- CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
- g_plugin.setString(hContact, "Nick", Translate("New Non-IM Contact"));
- g_plugin.setString(hContact, "Name", name);
- g_plugin.setString(hContact, "ProgramString", program);
- // copy the ProgramParamString
- g_plugin.setString(hContact, "ProgramParamString", programparam);
- // copy the group
- db_set_s(hContact, "CList", "Group", group);
- // copy the ToolTip
- g_plugin.setString(hContact, "ToolTip", tooltip);
- // timer
- g_plugin.setByte(hContact, "UseTimer", (BYTE)usetimer);
- g_plugin.setByte(hContact, "Minutes", (BYTE)minutes);
- g_plugin.setWord(hContact, "Timer", (WORD)timer);
- //icon
- g_plugin.setWord(hContact, "Icon", (WORD)icon);
- replaceAllStrings(hContact);
- }
- free(msg);
- contactDone = 0;
- name[0] = '\0';
- program[0] = '\0';
- programparam[0] = '\0';
- group[0] = '\0';
- line[0] = '\0';
- tooltip.Empty();
- icon = 40072;
- usetimer = 0;
- minutes = 1;
- timer = 0;
- }
- }
- fclose(file);
-
- return 1;
-}
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp
deleted file mode 100644
index 53f1db6781..0000000000
--- a/plugins/Non-IM Contact/src/dialog.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-#include "stdafx.h"
-
-#define NIM_HELP_TEXT TranslateT("String replacing variables...\r\nThe following are all the valid variables that can be used. Refer to the wiki.miranda-ng.org for a proper explanation.\r\n\r\n\
-file(X)\t\t<- specifies the file to read from. MUST be followed by either start() or end() or wholeline()\r\n\
-filename(X)\t<- copies the filename of file X.\r\n\
-start(...)\t\t<- specifies where to start copying from.\r\n\
-end(...)\t\t<- specifies where to stop copying.\r\n\
-wholeline(line(...))\t<- specifies a whole line to copy\r\n\r\n\
-start() and end() explained\r\n.........................\r\n\
-MUST start with line() followed by a number or a string inside \" marks, OR csv(separatorX) variable. The number specifies which character in the line to start/end copying. The string specifies a string in the line to start/end copying.\r\n\r\n\
-csv(seperatorX) explained...\r\nSeperator is either \"tab\" or \"space\" or any SINGLE character. X is the Xth separator to pass before copying, (or to stop before).\r\n\r\n\
-Lastly the line(...) variable...\r\n\
-Inside the brackets must be either a number (to specify the line number), or a string inside \" marks (to use the line with that string), or lastline(X). The X in lastline is the Xth line above the last line, i.e., lastline(1) will use the 2nd last line of the file. If searching for a line with \"some words\" you may put a + or - X after the closing ), i.e., line(\"some words\")+3 to go 3 lines after the line with \"some words\".\r\n\r\n\
-Some examples...\r\n\
-filename(0) <- will display the filename of the 0th file\r\nfile(0)wholeline(line(0))) <- will display the whole first line of the 0th file\r\nfile(0)wholeline(line(\"hello\")-1))) <- the wholeline above the first occurrence of \"hello\" in the file\r\nfile(0)start(line(lastline(1))csv(tab2))end(line(lastline())csv(tab4))) <- starts at the 2nd last line of the file, from the 2nd tab variable, until the 4th tab variable in the last line (in the 0th file)\r\nfile(0)start(line(\"hello\")+1\"zzzz\")end(line(6)17)) <- starts from the first occurrence of zzzz in the line after the first occurrence of hello, until the 17th character in the 6th line (starting from line 0) of the 0th file.\r\n")
-
-
-INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- wchar_t tmp[5];
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwnd);
- CheckDlgButton(hwnd, IDC_AWAYISNOTONLINE, g_plugin.getByte("AwayAsStatus") ? BST_CHECKED : BST_UNCHECKED);
- if (g_plugin.getWord("Timer", 1)) {
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER_INT), 1);
- SetDlgItemText(hwnd, IDC_TIMER_INT, _itow(g_plugin.getWord("Timer", 1), tmp, 10));
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER_TEXT), 1);
- }
- else {
- CheckDlgButton(hwnd, IDC_DISABLETIMER, BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER_INT), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER_TEXT), 0);
- }
- return TRUE;
-
- case WM_COMMAND:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- switch (LOWORD(wParam)) {
- case IDC_DISABLETIMER:
- if (IsDlgButtonChecked(hwnd, IDC_DISABLETIMER)) {
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER_INT), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER_TEXT), 0);
- }
- else {
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER_TEXT), 1);
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER_INT), 1);
- if (!GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER_INT)))
- SetDlgItemText(hwnd, IDC_TIMER_INT, L"1");
- }
- break;
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- g_plugin.setByte("AwayAsStatus", (BYTE)IsDlgButtonChecked(hwnd, IDC_AWAYISNOTONLINE));
- if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_DISABLETIMER) && GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER_INT))) {
- GetDlgItemText(hwnd, IDC_TIMER_INT, tmp, _countof(tmp));
- g_plugin.setWord("Timer", (WORD)_wtoi(tmp));
- }
- else g_plugin.setWord("Timer", 0);
- return TRUE;
- }
- }
- break;
- }
- return FALSE;
-}
-
-// string replace test window thingamijig....
-
-// struct to keep track of ()'s in the test sring window
-#define MAX_BRACES 32
-#define VARS 7
-struct braces
-{
- char var[64];
- int idCtrl;
-}
-braceList[VARS] =
-{
- { "file(", IDC_FILE },
- { "start(", IDC_START },
- { "end(", IDC_END },
- { "csv(", IDC_CSV },
- { "wholeline(", IDC_WHOLELINE },
- { "filename(", IDC_FILENAME },
- { "line(", IDC_LINE }
-};
-int braceOrder[MAX_BRACES] = { 0 };
-
-INT_PTR CALLBACK HelpWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM)
-{
- switch (msg) {
- case WM_INITDIALOG:
- SetDlgItemText(hwnd, IDC_HELPTEXT, NIM_HELP_TEXT);
- TranslateDialogDefault(hwnd);
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- DestroyWindow(hwnd);
- break;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwnd);
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_HELPMSG:
- CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_HELP), nullptr, HelpWindowDlgProc);
- break;
-
- case IDCANCEL:
- DestroyWindow(hwnd);
- break;
-
- case IDC_STRING:
- if (HIWORD(wParam) == EN_CHANGE) {
- char tmp[MAX_STRING_LENGTH];
- int i = 0, j;
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING))) {
- GetDlgItemTextA(hwnd, IDC_STRING, tmp, _countof(tmp));
- if (tmp[mir_strlen(tmp) - 1] == '(') {
- for (i = 0; i < VARS; i++) {
- if (!mir_strcmp(braceList[i].var, &tmp[mir_strlen(tmp) - mir_strlen(braceList[i].var)])) {
- for (j = 0; j < MAX_BRACES; j++) {
- if (!braceOrder[j]) {
- braceOrder[j] = i;
- EnableWindow(GetDlgItem(hwnd, braceList[i].idCtrl), 1);
- if (j)
- EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j - 1]].idCtrl), 0);
- break;
- }
- }
- break;
- }
- }
- }
- else if (tmp[mir_strlen(tmp) - 1] == ')') {
- for (j = 0; j < MAX_BRACES; j++) {
- if (!braceOrder[j]) {
- EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j - 1]].idCtrl), 0);
- if (j > 1)
- EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j - 2]].idCtrl), 1);
- braceOrder[j - 1] = 0;
- break;
- }
- }
- }
- }
- else {
- for (j = 0; j < MAX_BRACES; j++) {
- if (!braceOrder[j]) break;
- EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j]].idCtrl), 0);
- }
- }
- }
- break;
-
- case IDOK:
- CMStringA replacedString;
- char str2replace[MAX_STRING_LENGTH];
- int error;
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING))) {
- GetDlgItemTextA(hwnd, IDC_STRING, str2replace, _countof(str2replace));
- switch (stringReplacer(str2replace, replacedString, NULL)) {
- case ERROR_NO_LINE_AFTER_VAR_F:
- replacedString.Format("ERROR: no %s", "%line or %wholeline or %lastline after %fn");
- error = 1;
- break;
- case ERROR_LINE_NOT_READ:
- replacedString.Format("ERROR: file couldnt be opened ");
- error = 1;
- break;
- case ERROR_NO_FILE:
- replacedString.Format("ERROR: no file specified in settings");
- error = 1;
- break;
- default:
- error = 0;
- }
- SetDlgItemTextA(hwnd, IDC_ANSWER, replacedString);
- }
- }
- break;
- }
- return FALSE;
-}
-
-INT_PTR testStringReplacer(WPARAM, LPARAM)
-{
- CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TEST_LINE), nullptr, TestWindowDlgProc);
- return 0;
-}
-
-INT_PTR LoadFilesDlg(WPARAM, LPARAM)
-{
- CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ADD_FILE), nullptr, DlgProcFiles);
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static int CALLBACK PropSheetProc(HWND, UINT uMsg, LPARAM lParam)
-{
- if (uMsg == PSCB_PRECREATE) {
- // Remove the DS_CONTEXTHELP style from the
- // dialog box template
- if (((DLGTEMPLATEEX*)lParam)->signature == 0xFFFF)
- ((DLGTEMPLATEEX*)lParam)->style &= ~DS_CONTEXTHELP;
- else
- ((LPDLGTEMPLATE)lParam)->style &= ~DS_CONTEXTHELP;
-
- return TRUE;
- }
-
- return 0;
-}
-
-void DoPropertySheet(MCONTACT hContact)
-{
- char nick[256];
- PROPSHEETPAGEA psp[4] = { 0 };
-
- /* contact info */
- psp[0].dwSize = sizeof(PROPSHEETPAGE);
- psp[0].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[0].hInstance = g_plugin.getInst();
- psp[0].pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_INFO);
- psp[0].pszIcon = nullptr;
- psp[0].pfnDlgProc = DlgProcContactInfo;
- psp[0].pszTitle = Translate("Contacts Display Info");
- psp[0].lParam = hContact;
- psp[0].pfnCallback = nullptr;
-
- /* other settings */
- psp[1].dwSize = sizeof(PROPSHEETPAGE);
- psp[1].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[1].hInstance = g_plugin.getInst();
- psp[1].pszTemplate = MAKEINTRESOURCEA(IDD_OTHER_STUFF);
- psp[1].pszIcon = nullptr;
- psp[1].pfnDlgProc = DlgProcOtherStuff;
- psp[1].pszTitle = Translate("Link and Contact list Settings");
- psp[1].lParam = hContact;
- psp[1].pfnCallback = nullptr;
-
- /* copy contact */
- psp[2].dwSize = sizeof(PROPSHEETPAGE);
- psp[2].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[2].hInstance = g_plugin.getInst();
- psp[2].pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COPYEXPORT);
- psp[2].pszIcon = nullptr;
- psp[2].pfnDlgProc = DlgProcCopy;
- psp[2].pszTitle = Translate("Copy Contact");
- psp[2].lParam = hContact;
- psp[2].pfnCallback = nullptr;
-
- /* files */
- psp[3].dwSize = sizeof(PROPSHEETPAGE);
- psp[3].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[3].hInstance = g_plugin.getInst();
- psp[3].pszTemplate = MAKEINTRESOURCEA(IDD_ADD_FILE);
- psp[3].pszIcon = nullptr;
- psp[3].pfnDlgProc = DlgProcFiles;
- psp[3].pszTitle = Translate("Files");
- psp[3].lParam = 0;
- psp[3].pfnCallback = nullptr;
-
- /* propery sheet header.. dont touch !!!! */
- PROPSHEETHEADERA psh = { sizeof(psh) };
- psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
- psh.hInstance = g_plugin.getInst();
- psh.pszIcon = MAKEINTRESOURCEA(IDI_MAIN);
- if (!db_get_static(hContact, MODNAME, "Nick", nick, _countof(nick))) {
- char title[256];
- mir_snprintf(title, Translate("Edit Non-IM Contact \"%s\""), nick);
- psh.pszCaption = title;
- }
- psh.nPages = _countof(psp);
- psh.ppsp = (LPCPROPSHEETPAGEA)&psp;
- psh.pfnCallback = PropSheetProc;
-
- // Now do it and return
- PropertySheetA(&psh);
-}
-
-INT_PTR addContact(WPARAM, LPARAM)
-{
- char tmp[256];
- MCONTACT hContact = db_add_contact();
- Proto_AddToContact(hContact, MODNAME);
- CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
- g_plugin.setWString(hContact, "Nick", TranslateT("New Non-IM Contact"));
- DoPropertySheet(hContact);
- if (db_get_static(hContact, MODNAME, "Name", tmp, _countof(tmp)))
- db_delete_contact(hContact);
- replaceAllStrings(hContact);
- return 0;
-}
-
-INT_PTR editContact(WPARAM wParam, LPARAM)
-{
- MCONTACT hContact = wParam;
- char tmp[256];
- if (!hContact) {
- hContact = db_add_contact();
- Proto_AddToContact(hContact, MODNAME);
- CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
- g_plugin.setString(hContact, "Nick", Translate("New Non-IM Contact"));
- }
- DoPropertySheet(hContact);
- if (db_get_static(hContact, MODNAME, "Name", tmp, _countof(tmp)))
- db_delete_contact(hContact);
- replaceAllStrings(hContact);
- return 0;
-}
diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp
deleted file mode 100644
index 6f90e5eb40..0000000000
--- a/plugins/Non-IM Contact/src/files.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-#include "stdafx.h"
-
-INT_PTR exportContacts(WPARAM, LPARAM)
-{
- char fn[MAX_PATH];
- if (!Openfile(fn, 0))
- return 0;
-
- FILE* file;
- if (MessageBox(nullptr, TranslateT("Do you want to overwrite the contents of the file?\r\n\r\nPressing No will append these contacts to the end of the file."), _A2W(modFullname), MB_YESNO) == IDYES)
- file = fopen(fn, "w");
- else
- file = fopen(fn, "a");
- if (!file)
- return 0;
-
- for (auto &hContact : Contacts(MODNAME)) {
- int tmp;
- char DBVar[1024];
- if (!db_get_static(hContact, MODNAME, "Name", DBVar, _countof(DBVar))) {
- fprintf(file, "\r\n[Non-IM Contact]\r\nName=%s\r\n", DBVar);
- if (!db_get_static(hContact, MODNAME, "ProgramString", DBVar, _countof(DBVar)))
- fprintf(file, "ProgramString=%s\r\n", DBVar);
- if (!db_get_static(hContact, MODNAME, "ProgramParamString", DBVar, _countof(DBVar)))
- fprintf(file, "ProgramParamString=%s\r\n", DBVar);
- if (!db_get_static(hContact, MODNAME, "ToolTip", DBVar, _countof(DBVar)))
- fprintf(file, "ToolTip=%s</tooltip>\r\n", DBVar);
- if (!db_get_static(hContact, "CList", "Group", DBVar, _countof(DBVar)))
- fprintf(file, "Group=%s\r\n", DBVar);
- if (tmp = g_plugin.getWord(hContact, "Icon", 40072))
- fprintf(file, "Icon=%d\r\n", tmp);
- if (tmp = g_plugin.getByte(hContact, "UseTimer", 0))
- fprintf(file, "UseTimer=%d\r\n", tmp);
- if (tmp = g_plugin.getByte(hContact, "Minutes", 1))
- fprintf(file, "Minutes=%d\r\n", tmp);
- if (tmp = g_plugin.getWord(hContact, "Timer", 0))
- fprintf(file, "Timer=%d\r\n", tmp);
- fprintf(file, "[/Non-IM Contact]\r\n");
- }
- }
- fclose(file);
- return 0;
-}
-
-int Openfile(char *outputFile, int saveOpen) //0=save, 1=open
-{
- char filename[MAX_PATH] = "";
- char *filter = "All Files\0*.*\0";
- int r;
- char title[16];
- if (saveOpen)
- mir_strcpy(title, "Open file");
- else mir_strcpy(title, "Save to file");
-
- OPENFILENAMEA ofn = { sizeof(ofn) };
- ofn.lpstrFile = filename;
- ofn.lpstrFilter = filter;
- ofn.Flags = saveOpen ? OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_SHAREAWARE | OFN_PATHMUSTEXIST : OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST;
- ofn.lpstrTitle = title;
- ofn.nMaxFile = MAX_PATH;
-
- if (saveOpen)
- r = GetOpenFileNameA(&ofn);
- else
- r = GetSaveFileNameA(&ofn);
- if (!r)
- return 0;
- mir_strcpy(outputFile, filename);
- return 1;
-}
-
-void reloadFiles(HWND fileList)
-{
- SendMessage(fileList, CB_RESETCONTENT, 0, 0);
- for (int i = 0;; i++) {
- char file[MAX_PATH], fn[6];
- mir_snprintf(fn, "fn%d", i);
- if (db_get_static(NULL, MODNAME, fn, file, _countof(file)))
- return;
-
- /* add the file contents to the edit box */
- int index = SendMessageA(fileList, CB_ADDSTRING, 0, (LPARAM)file);
- SendMessage(fileList, CB_SETITEMDATA, index, (LPARAM)i);
- SendMessage(fileList, CB_SETCURSEL, index, 0);
- SetDlgItemTextA(GetParent(fileList), IDC_FN, _itoa(i, fn, 10));
- }
-}
-
-int savehtml(char* outFile)
-{
- FILE* file = fopen(outFile, "w");
- if (!file) {
- return 0;
- }
- fprintf(file, "%s", szInfo);
- fclose(file);
- return 1;
-}
-
-void readFile(HWND hwnd)
-{
- int lineNumber, fileLength = 0;
- char temp[MAX_STRING_LENGTH], szFileName[512], temp1[MAX_STRING_LENGTH];
- int fileNumber = SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_GETCURSEL, 0, 0);
- {
- char fn[10];
- mir_snprintf(fn, "fn%d", fileNumber);
- if (db_get_static(NULL, MODNAME, fn, szFileName, _countof(szFileName))) {
- msg(Translate("File couldn't be opened"), fn);
- return;
- }
- }
-
- if (!strncmp("http://", szFileName, mir_strlen("http://")) || !strncmp("https://", szFileName, mir_strlen("https://")))
- mir_snprintf(szFileName, "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber);
-
- FILE *filen = fopen(szFileName, "r");
- if (!filen) {
- MessageBox(nullptr, TranslateT("File couldn't be opened,2"), _A2W(modFullname), MB_OK);
- return;
- }
- lineNumber = 0;
- SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_RESETCONTENT, 0, 0);
- while (lineNumber < (MAXLINES) && (fgets(temp, MAX_STRING_LENGTH, filen))) {
- if (temp[0] == '\t') temp[0] = ' ';
- if (temp[mir_strlen(temp) - 1] == '\n' && temp[mir_strlen(temp) - 2] == '\r')
- temp[mir_strlen(temp) - 2] = '\0';
- else if (temp[mir_strlen(temp) - 1] == '\n')
- temp[mir_strlen(temp) - 1] = '\0';
- else temp[mir_strlen(temp)] = '\0';
- mir_snprintf(temp1, Translate("line(%-3d) = | %s"), lineNumber, temp);
- SendDlgItemMessageA(hwnd, IDC_FILE_CONTENTS, LB_ADDSTRING, 0, (LPARAM)temp1);
- lineNumber++;
- fileLength++;
- if ((unsigned int)SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_GETHORIZONTALEXTENT, 0, 0) <= (mir_strlen(temp1)*g_plugin.getByte("WidthMultiplier", 5)))
- SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_SETHORIZONTALEXTENT, (mir_strlen(temp1)*g_plugin.getByte("WidthMultiplier", 5)), 0);
- }
- fclose(filen);
-}
-
-#define WM_RELOADWINDOW (WM_USER+11)
-
-INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char tmp[MAX_PATH], fn[MAX_PATH];
-
- switch (msg) {
- case WM_RELOADWINDOW:
- {
- char string[MAX_STRING_LENGTH];
- reloadFiles(GetDlgItem(hwnd, IDC_FILE_LIST));
-
- int i = SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_GETCURSEL, 0, 0);
- mir_snprintf(fn, "fn%d", i);
- SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_RESETCONTENT, 0, 0);
- if (!db_get_static(NULL, MODNAME, fn, string, _countof(string))) {
- if ((!strncmp("http://", string, mir_strlen("http://"))) || (!strncmp("https://", string, mir_strlen("https://")))) {
- SetDlgItemTextA(hwnd, IDC_URL, string);
- mir_snprintf(fn, "fn%d_timer", i);
- SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(g_plugin.getWord(fn, 60), tmp, 10));
- }
- readFile(hwnd);
- }
- }
- break;
-
- case WM_INITDIALOG:
- SendMessage(hwnd, WM_RELOADWINDOW, 0, 0);
- TranslateDialogDefault(hwnd);
- return TRUE;
-
- case WM_COMMAND:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- switch (LOWORD(wParam)) {
- case IDC_ADD_URL:
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_URL))) {
- char text[512], url[512], szFileName[MAX_PATH], temp[512];
- GetDlgItemTextA(hwnd, IDC_URL, text, _countof(text));
- mir_strcpy(url, text);
- if (!InternetDownloadFile(text)) {
- for (int i = 0;; i++) {
- mir_snprintf(fn, "fn%d", i);
- if (db_get_static(NULL, MODNAME, fn, text, _countof(text))) {
- mir_snprintf(szFileName, "%s\\plugins\\%s.html", getMimDir(temp), fn);
- if (savehtml(szFileName)) {
- mir_snprintf(fn, "fn%d", i);
- g_plugin.setString(fn, url);
- int timer;
- if (!GetWindowTextLength(GetDlgItem(hwnd, IDC_WWW_TIMER)))
- timer = 60;
- else {
- GetDlgItemTextA(hwnd, IDC_WWW_TIMER, text, _countof(text));
- timer = atoi(text);
- }
- mir_snprintf(fn, "fn%d_timer", i);
- g_plugin.setWord(fn, (WORD)timer);
- SendMessage(hwnd, WM_RELOADWINDOW, 0, 0);
- }
- break;
- }
- }
- }
- }
- break;
-
- case IDC_WWW_TIMER:
- if (HIWORD(wParam) == EN_CHANGE)
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_ADD_FILE:
- for (int i = 0;; i++) {
- char file[MAX_PATH];
- mir_snprintf(fn, "fn%d", i);
- if (db_get_static(NULL, MODNAME, fn, file, _countof(file))) {
- if (Openfile(file, 1)) {
- g_plugin.setString(fn, file);
- int index = SendDlgItemMessageA(hwnd, IDC_FILE_LIST, CB_ADDSTRING, 0, (LPARAM)file);
- SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_SETITEMDATA, index, (LPARAM)i);
- SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_SETCURSEL, index, 0);
- SetDlgItemTextA(hwnd, IDC_FN, _itoa(i, fn, 10));
- mir_snprintf(fn, "fn%d", index);
- readFile(hwnd);
- }
- break;
- }
- }
- break;
-
- case IDC_DEL_FILE:
- {
- int index = SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_GETCURSEL, 0, 0), i = (int)SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_GETITEMDATA, index, 0);
- int count = SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_GETCOUNT, 0, 0) - 1;
- if (index == count) {
- mir_snprintf(fn, "fn%d", index);
- g_plugin.delSetting(fn);
- SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_DELETESTRING, index, 0);
- SendMessage(hwnd, WM_RELOADWINDOW, 0, 0);
- if (!index) {
- SetDlgItemText(hwnd, IDC_FN, L"");
- SetDlgItemText(hwnd, IDC_FILE_CONTENTS, L"");
- }
-
- }
- else {
- mir_snprintf(fn, "fn%d", i);
- while (!db_get_static(NULL, MODNAME, fn, tmp, _countof(tmp))) {
- char fn1[4];
- mir_snprintf(fn1, "fn%d", i - 1);
- g_plugin.setString(fn1, tmp);
- mir_snprintf(fn, "fn%d", ++i);
- }
- mir_snprintf(fn, "fn%d", --i);
- g_plugin.delSetting(fn);
- SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_DELETESTRING, index, 0);
- SendMessage(hwnd, WM_RELOADWINDOW, 0, 0);
- }
- }
- break;
-
- case IDC_FILE_LIST:
- if (HIWORD(wParam) == CBN_SELCHANGE) {
- int index = SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_GETCURSEL, 0, 0);
- SetDlgItemTextA(hwnd, IDC_FN, _itoa(index, fn, 10));
- mir_snprintf(fn, "fn%d", index);
- if (!db_get_static(NULL, MODNAME, fn, tmp, _countof(tmp))) {
- if (!strncmp("http://", tmp, mir_strlen("http://")) || !strncmp("https://", tmp, mir_strlen("https://"))) {
- SetDlgItemTextA(hwnd, IDC_URL, tmp);
- mir_snprintf(fn, "fn%d_timer", index);
- SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(g_plugin.getWord(fn, 60), tmp, 10));
- }
- else {
- SetDlgItemText(hwnd, IDC_URL, L"");
- SetDlgItemText(hwnd, IDC_WWW_TIMER, L"");
- }
- readFile(hwnd);
- }
- }
- break;
- case IDCANCEL:
- DestroyWindow(hwnd);
- break;
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- int i = SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_GETCURSEL, 0, 0);
- int timer;
- char string[1000];
- mir_snprintf(fn, "fn%d", i);
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_WWW_TIMER))) {
- wchar_t text[5];
- GetDlgItemText(hwnd, IDC_WWW_TIMER, text, _countof(text));
- timer = _wtoi(text);
- }
- else timer = 60;
-
- if (!db_get_static(NULL, MODNAME, fn, string, _countof(string)))
- if (!strncmp("http://", string, mir_strlen("http://")) || !strncmp("https://", string, mir_strlen("https://"))) {
- mir_snprintf(fn, "fn%d_timer", i);
- g_plugin.setWord(fn, (WORD)timer);
- }
-
- return TRUE;
- }
- }
- break;
- }
- return FALSE;
-}
-
-char* getMimDir(char* file)
-{
- GetModuleFileNameA(nullptr, file, MAX_PATH);
-
- char *p1 = strrchr(file, '\\');
- if (p1)
- *p1 = '\0';
-
- if (file[0] == '\\')
- file[mir_strlen(file) - 1] = '\0';
-
- return file;
-}
diff --git a/plugins/Non-IM Contact/src/http.cpp b/plugins/Non-IM Contact/src/http.cpp
deleted file mode 100644
index 54e16954e4..0000000000
--- a/plugins/Non-IM Contact/src/http.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-Weather Protocol plugin for Miranda IM
-Copyright (C) 2002-2004 Calvin Che
-
-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.
-*/
-
-/* This file contain the source related to downloading weather info
- from the web using netlib
-*/
-
-#include "stdafx.h"
-
-char *szInfo;
-char *szData;
-HNETLIBUSER hNetlibUser;
-
-// function to download webpage from the internet
-// szUrl = URL of the webpage to be retrieved
-// return value = 0 for success, 1 or HTTP error code for failure
-// global var used: szData, szInfo = containing the retrieved data
-//
-int InternetDownloadFile(char *szUrl)
-{
- NETLIBHTTPREQUEST nlhr = { 0 };
-
- // initialize the netlib request
- nlhr.cbSize = sizeof(nlhr);
- nlhr.requestType = REQUEST_GET;
- nlhr.flags = NLHRF_DUMPASTEXT;
- nlhr.szUrl = szUrl;
- // change the header so the plugin is pretended to be IE 6 + WinXP
- nlhr.headersCount++;
- nlhr.headers = (NETLIBHTTPHEADER*)malloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
- nlhr.headers[nlhr.headersCount - 1].szName = "User-Agent";
- nlhr.headers[nlhr.headersCount - 1].szValue = NETLIB_USER_AGENT;
-
- // download the page
- NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr);
- if (nlhrReply) {
- // return error code if the recieved code is neither 200 OK or 302 Moved
- if (nlhrReply->resultCode != 200 && nlhrReply->resultCode != 302)
- return nlhrReply->resultCode;
- // if the recieved code is 200 OK
- else if (nlhrReply->resultCode == 200) {
- // allocate memory and save the retrieved data
- szData = (char *)malloc(mir_strlen(nlhrReply->pData) + 2);
- mir_strncpy(szData, nlhrReply->pData, mir_strlen(nlhrReply->pData));
- }
- // if the recieved code is 302 Moved, Found, etc
- else if (nlhrReply->resultCode == 302) { // page moved
- int i;
- // get the url for the new location and save it to szInfo
- // look for the reply header "Location"
- for (i = 0; i < nlhrReply->headersCount; i++) {
- if (!mir_strcmp(nlhrReply->headers[i].szName, "Location")) {
- szData = (char *)malloc(512);
- // add "Moved/Location:" in front of the new URL for identification
- mir_snprintf(szData, 512, "Moved/Location: %s\n", nlhrReply->headers[i].szValue);
- break;
- }
- }
- // log the new url into netlib log
- Netlib_Log(hNetlibUser, szData);
- }
- }
- // if the data does not downloaded successfully (ie. disconnected), then return 1 as error code
- else return 1;
-
- // make a copy of the retrieved data, then free the memory of the http reply
- szInfo = szData;
- Netlib_FreeHttpRequest(nlhrReply);
-
- // the recieved data is empty, data was not recieved, so return an error code of 1
- if (!mir_strcmp(szInfo, "")) return 1;
- return 0;
-}
-
-//============ NETLIB INITIALIZATION ============
-
-void NetlibInit()
-{
- NETLIBUSER nlu = {};
- nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
- nlu.szSettingsModule = MODNAME;
- nlu.szDescriptiveName.w = TranslateT("Non-IM Contacts");
- hNetlibUser = Netlib_RegisterUser(&nlu);
-}
diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp
deleted file mode 100644
index f2f7a15b28..0000000000
--- a/plugins/Non-IM Contact/src/main.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-//=====================================================
-// Includes
-//=====================================================
-
-#include "stdafx.h"
-
-#include "Version.h"
-
-CMPlugin g_plugin;
-
-INT_PTR doubleClick(WPARAM wParam, LPARAM)
-{
- char program[MAX_PATH], params[MAX_PATH];
- INT_PTR shellEXEerror = 0;
- char* proto = GetContactProto(wParam);
- if (proto && !mir_strcmp(proto, MODNAME)) {
- if (GetKeyState(VK_CONTROL) & 0x8000) // ctrl is pressed
- editContact(wParam, 0); // for later when i add a second double click setting
- else if (!db_get_static(wParam, MODNAME, "Program", program, _countof(program)) && mir_strcmp(program, "")) {
- if (db_get_static(wParam, MODNAME, "ProgramParams", params, _countof(params)))
- mir_strcpy(params, "");
- if (strstr(program, "http://") || strstr(program, "https://"))
- Utils_OpenUrl(program);
- else
- shellEXEerror = (INT_PTR)ShellExecuteA(nullptr, nullptr, program, params, nullptr, SW_SHOW); //ignore the warning, its M$'s backwards compatabilty screwup :)
- if (shellEXEerror == ERROR_FILE_NOT_FOUND || shellEXEerror == ERROR_PATH_NOT_FOUND)
- Utils_OpenUrl(program);
- }
- else editContact(wParam, 0);
- return 1;
- }
- return 0;
-}
-
-//=====================================================
-// Definitions
-//=====================================================
-int LCStatus = ID_STATUS_OFFLINE;
-//=====================================================
-
-//=====================================================
-// Name : MainInit
-// Parameters: wparam , lparam
-// Returns : int
-// Description : Called at very beginning of plugin
-//=====================================================
-//
-int NimcOptInit(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = {};
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
- odp.szGroup.a = LPGEN("Plugins");
- odp.szTitle.a = LPGEN("Non-IM Contacts");
- odp.pfnDlgProc = DlgProcNimcOpts;
- g_plugin.addOptions(wParam, &odp);
- return 0;
-}
-//=====================================================
-// Name : __declspec(dllexport) PLUGININFO* MirandaPluginInfo
-// Parameters: (DWORD mirandaVersion)
-// Returns :
-// Description : Sets plugin info
-//=====================================================
-
-PLUGININFOEX pluginInfoEx = {
- sizeof(pluginInfoEx),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- //2e0d2ae3-e123-4607-8539-d4448d675ddb
- { 0x2e0d2ae3, 0xe123, 0x4607, {0x85, 0x39, 0xd4, 0x44, 0x8d, 0x67, 0x5d, 0xdb} }
-};
-
-CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODNAME, pluginInfoEx)
-{
- RegisterProtocol(PROTOTYPE_VIRTUAL);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
-
-//=====================================================
-// Name : WINAPI DllMain
-// Parameters: HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved
-// Returns : BOOL
-// Description :
-//=====================================================
-
-int ModulesLoaded(WPARAM, LPARAM)
-{
- NetlibInit();
- return 0;
-}
-
-//=====================================================
-// Name : Load
-// Parameters: PLUGINLINK *link
-// Returns : int
-// Description : Called when plugin is loaded into Miranda
-//=====================================================
-
-IconItem iconList[] =
-{
- { LPGEN("Main Icon"), MODNAME, IDI_MAIN },
-};
-
-int CMPlugin::Load()
-{
- g_plugin.registerIcon(LPGEN("Non-IM Contact"), iconList);
-
- HookEvent(ME_CLIST_DOUBLECLICKED, (MIRANDAHOOK)doubleClick);
- HookEvent(ME_OPT_INITIALISE, NimcOptInit);
- HookEvent(ME_CLIST_STATUSMODECHANGE, SetLCStatus);
-
- // load services (the first 5 are the basic ones needed to make a new protocol)
- CreateProtoServiceFunction(MODNAME, PS_GETCAPS, GetLCCaps);
- CreateProtoServiceFunction(MODNAME, PS_GETNAME, GetLCName);
- CreateProtoServiceFunction(MODNAME, PS_LOADICON, LoadLCIcon);
- CreateProtoServiceFunction(MODNAME, PS_GETSTATUS, GetLCStatus);
-
- CreateServiceFunction("AddLCcontact", addContact);
- CreateServiceFunction("EditLCcontact", editContact);
- CreateServiceFunction("LoadFilesDlg", LoadFilesDlg);
- CreateServiceFunction("ExportLCcontacts", exportContacts);
- CreateServiceFunction("ImportLCcontacts", ImportContacts);
- CreateServiceFunction("TestStringReplaceLine", testStringReplacer);
- CreateServiceFunction("NIM_Contact/DoubleClick", doubleClick);
-
- CMenuItem mi(&g_plugin);
- mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("&Non-IM Contact"), 600090000);
- Menu_ConfigureItem(mi.root, MCI_OPT_UID, "D7CE61C5-1178-41BA-B2ED-5A711BB21AE9");
-
- SET_UID(mi, 0x73c11266, 0x153c, 0x4da4, 0x9b, 0x82, 0x5c, 0xce, 0xca, 0x86, 0xd, 0x41);
- mi.position = 600090000;
- mi.name.a = LPGEN("&Add Non-IM Contact");
- mi.pszService = "AddLCcontact";
- mi.hIcolibItem = iconList[0].hIcolib;
- Menu_AddMainMenuItem(&mi);
-
- SET_UID(mi, 0xa511c5e, 0x26d2, 0x41b1, 0xbd, 0xb7, 0x3e, 0x62, 0xc8, 0x44, 0x37, 0xc9);
- mi.position = 600090001;
- mi.name.a = LPGEN("&View/Edit Files");
- mi.pszService = "LoadFilesDlg";
- Menu_AddMainMenuItem(&mi);
-
- if (g_plugin.getByte("Beta", 0)) {
- SET_UID(mi, 0x23051356, 0xad45, 0x4101, 0x8e, 0x11, 0xf6, 0x3a, 0xe8, 0xa3, 0xa5, 0x25);
- mi.position = 600090002;
- mi.name.a = LPGEN("&Export all Non-IM Contacts");
- mi.pszService = "ExportLCcontacts";
- Menu_AddMainMenuItem(&mi);
-
- SET_UID(mi, 0xf3c4ebed, 0x789c, 0x4293, 0xaa, 0xcb, 0x22, 0xdc, 0xd4, 0xe0, 0x3c, 0x41);
- mi.position = 600090003;
- mi.name.a = LPGEN("&Import Non-IM Contacts");
- mi.pszService = "ImportLCcontacts";
- Menu_AddMainMenuItem(&mi);
- }
-
- SET_UID(mi, 0xb653d5e0, 0xb1e6, 0x46fc, 0xa7, 0x82, 0x35, 0x95, 0x74, 0xb1, 0xc, 0xdd);
- mi.position = 600090000;
- mi.name.a = LPGEN("&String Maker");
- mi.pszService = "TestStringReplaceLine";
- Menu_AddMainMenuItem(&mi);
-
- SET_UID(mi, 0x1033e16d, 0x8a7c, 0x43db, 0xa9, 0x83, 0x56, 0x2f, 0x8a, 0x16, 0x7c, 0xe9);
- mi.root = nullptr;
- mi.position = -2000080000;
- mi.name.a = LPGEN("E&dit Contact Settings");
- mi.pszService = "EditLCcontact";
- Menu_AddContactMenuItem(&mi, MODNAME);
-
- HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- return 0;
-}
-
-//=====================================================
-// Name : Unload
-// Parameters: void
-// Returns :
-// Description : Unloads plugin
-//=====================================================
-
-int CMPlugin::Unload()
-{
- killTimer();
- return 0;
-}
diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp
deleted file mode 100644
index 8c1800b166..0000000000
--- a/plugins/Non-IM Contact/src/namereplacing.cpp
+++ /dev/null
@@ -1,633 +0,0 @@
-#include "stdafx.h"
-
-int readFileIntoArray(int fileNumber, char *FileContents[])
-{
- char dbSetting[20], temp[MAX_STRING_LENGTH];
- mir_snprintf(dbSetting, "fn%d", fileNumber);
-
- char *szVar = db_get_sa(0, MODNAME, dbSetting);
- if (szVar == nullptr)
- return 0;
-
- char tszFileName[MAX_PATH];
- if (!strncmp("http://", szVar, 7) || !strncmp("https://", szVar, 7))
- mir_snprintf(tszFileName, "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber);
- else
- mir_strncpy(tszFileName, szVar, _countof(tszFileName));
- mir_free(szVar);
-
- FILE* file = fopen(tszFileName, "r");
- if (file == nullptr)
- return 0;
-
- // read the file into the FileContents array
- // free this array before stringReplacer() returns
- int i;
- for (i = 0; fgets(temp, MAX_STRING_LENGTH - 1, file); i++) {
- if (temp[mir_strlen(temp) - 1] == '\n')
- temp[mir_strlen(temp) - 1] = '\0';
- else temp[mir_strlen(temp)] = '\0';
-
- FileContents[i] = (char*)malloc(mir_strlen(temp) + 1);
- if (FileContents[i] == nullptr) break;
- mir_strcpy(FileContents[i], temp);
- }
- fclose(file);
- return i;
-}
-
-int getNumber(const char* line)
-{
- int i;
- return sscanf(line, "%d", &i) == 1 ? i : -1;
-}
-
-int findWordInString(const char* line, const char* string, int* lengthOfWord, int flag) /* flag = 0 %from, flag = 1 %until */
-{
- unsigned int i, j = 0;
- char word[64] = "", OpenDivider[8], CloseDivider[8];
- strncpy(OpenDivider, "(\"", sizeof(OpenDivider));
- strncpy(CloseDivider, "\")", sizeof(CloseDivider));
- /* get the word we r looking for */
- if (!strncmp(string, OpenDivider, mir_strlen(OpenDivider))) {
- for (i = 2; strncmp(&string[i], CloseDivider, mir_strlen(CloseDivider)); i++) {
- word[j] = string[i];
- word[++j] = '\0';
- }
- }
- i = 0;
- *lengthOfWord = (int)(mir_strlen(word) + mir_strlen(CloseDivider) + mir_strlen(OpenDivider));
- /* find the word in the line */
- while (i < (mir_strlen(line) - mir_strlen(word))) {
- if (!strncmp(&line[i], word, mir_strlen(word))) {
- if (!flag) return i + (int)mir_strlen(word); /* the next char after the word */
- else return i; /* the char before the word */
- }
- i++;
- }
- return -1;
-}
-
-int findLine(char* FileContents[], const char* string, int linesInFile, int startLine, int *positionInOldString)
-{
- char tmp[5];
- int i = getNumber(&string[*positionInOldString]);
-
- // check if blank
- if (string[*positionInOldString] == ')')
- return startLine;
-
- // check if its a number
- if (i != -1) {
- *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10)) - 1;
- return i;
- }
-
- // lastline
- if (!strncmp(&string[*positionInOldString], "lastline(", mir_strlen("lastline("))) {
- *positionInOldString += (int)mir_strlen("lastline(");
- i = getNumber(&string[*positionInOldString]);
- if (i != -1) {
- *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10));
- return linesInFile - (i + 1);
- }
-
- (*positionInOldString)++;
- return (linesInFile - 1);
- }
-
- // string
- if (string[*positionInOldString] == '\"') {
- char string2Find[256];
- int j = 0;
- // get the word to find
- for (i = (*positionInOldString + 1); strncmp(&string[i], "\")", 2); i++) {
- string2Find[j] = string[i];
- string2Find[++j] = '\0';
- }
-
- // find the word
- for (j = startLine; j < linesInFile; j++) {
- if (strstr(FileContents[j], string2Find)) {
- i = j;
- break;
- }
- i = -1;
- }
- *positionInOldString += (int)(mir_strlen(string2Find) + mir_strlen("\"\")"));
- if (i == -1) return i;
- // allow for a +- after the word to go up or down lines
- if (string[*positionInOldString] == '+') {
- *positionInOldString += 1;
- j = getNumber(&string[*positionInOldString]);
- if (j != -1) {
- *positionInOldString += (int)mir_strlen(_itoa(j, tmp, 10)) - 2;
- return i + j;
- }
- }
- else if (string[*positionInOldString] == '-') {
- *positionInOldString += 1;
- j = getNumber(&string[*positionInOldString]);
- if (j != -1) {
- *positionInOldString += (int)mir_strlen(_itoa(j, tmp, 10)) - 2;
- return i - j;
- }
- }
- else {
- *positionInOldString -= 2;
- return i;
- }
- }
- return -1;
-}
-
-int findChar(char* FileContents[], const char* string, int startLine, int *positionInOldString, int startChar, int startEnd) // 0=start, 1=end for startEnd
-{
- char tmp[5];
- int i = getNumber(&string[*positionInOldString]);
- // check if its a number
- if (i != -1) {
- *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10)) - 1;
- return i;
- }
-
- // string
- if (string[*positionInOldString] == '\"') {
- char string2Find[256];
- unsigned int j = 0;
- // get the word to find
- for (i = (*positionInOldString + 1); strncmp(&string[i], "\")", 2); i++) {
- string2Find[j] = string[i];
- string2Find[++j] = '\0';
- }
- // find the word
- for (j = 0; j < mir_strlen(FileContents[startLine]); j++)
- if (!strncmp(&FileContents[startLine][j], string2Find, mir_strlen(string2Find)))
- break;
-
- if (j == mir_strlen(FileContents[startLine]))
- return -1;
-
- *positionInOldString += (int)mir_strlen(string2Find) + 1;
- return (startEnd) ? j : j + (int)mir_strlen(string2Find);
- }
-
- // csv(
- if (!strncmp(&string[*positionInOldString], "csv(", mir_strlen("csv("))) {
- char seperator;
- int j = 0, k = startChar;
- *positionInOldString += (int)mir_strlen("csv(");
- if (!strncmp(&string[*positionInOldString], "tab", 3)) {
- *positionInOldString += 3;
- seperator = '\t';
- }
- else if (!strncmp(&string[*positionInOldString], "space", 5)) {
- *positionInOldString += 5;
- seperator = ' ';
- }
- else {
- seperator = string[*positionInOldString];
- *positionInOldString += 1;
- }
- i = getNumber(&string[*positionInOldString]);
- if (i == -1) return -1;
- *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10));
- while (j < i) {
- if (FileContents[startLine][k] == '\0') break;
- if (FileContents[startLine][k] == seperator)
- j++;
- k++;
- }
- return k;
- }
- return -1;
-}
-
-// do the compare("A","B","X","Y")
-void checkStringForcompare(CMStringA &str)
-{
- if (!strstr(str, "compare(\"")) return;
- char *A, *B, *X, *Y, *copyOfStr = NEWSTR_ALLOCA(str.c_str());
- CMStringA tmp;
- unsigned int i, j = 0, s = str.GetLength();
- for (i = 0; i < s; i++) {
- if (!strncmp(str.c_str()+i, "compare(\"", mir_strlen("compare(\""))) {
- i += (int)mir_strlen("compare(\"");
- A = strtok(&copyOfStr[i], "\",\"");
- B = strtok(nullptr, "\",\"");
- X = strtok(nullptr, "\",\"");
- Y = strtok(nullptr, ",\")");
- j = Y - &copyOfStr[i] + (int)mir_strlen(Y) + 1;
- if (A && B && X && Y) {
- if (!mir_strcmp(A, B))
- tmp.Append(X);
- else
- tmp.Append(Y);
- }
- else tmp.Append(str.c_str()+i, j);
- i += j;
- }
- else tmp.AppendChar(copyOfStr[i]);
- }
- str = tmp;
-}
-
-// do save("A","B") A is DBVar name, B is value
-void checkStringForSave(MCONTACT hContact, CMStringA &str)
-{
- if (!strstr(str, "save(\"")) return;
- char *A, *B, *copyOfStr = NEWSTR_ALLOCA(str.c_str());
- unsigned int i, j = 0, s = str.GetLength();
- CMStringA tmp;
- for (i = 0; i < s; i++) {
- if (!strncmp(str.c_str()+i, "save(\"", mir_strlen("save(\""))) {
- i += (int)mir_strlen("save(\"");
- A = strtok(&copyOfStr[i], "\",\"");
- B = strtok(nullptr, ",\")");
- j = B - &copyOfStr[i] + (int)mir_strlen(B) + 1;
- if (A && B)
- g_plugin.setString(hContact, A, B);
-
- else tmp.Append(str.c_str()+i, j);
- i += j;
- }
- else tmp.AppendChar(copyOfStr[i]);
- }
- str = tmp;
-}
-
-// do load("A") A is DBVar name
-void checkStringForLoad(MCONTACT hContact, CMStringA &str)
-{
- if (!strstr(str, "load(\"")) return;
- char *A, *copyOfStr = NEWSTR_ALLOCA(str.c_str());
- unsigned int i, j = 0, s = str.GetLength();
- CMStringA tmp;
- for (i = 0; i < s; i++) {
- if (!strncmp(str.c_str()+i, "load(\"", mir_strlen("load(\""))) {
- i += (int)mir_strlen("load(\"");
- A = strtok(&copyOfStr[i], "\")");
- j = A - &copyOfStr[i] + (int)mir_strlen(A) + 1;
- if (A) {
- DBVARIANT dbv;
- if (!db_get_s(hContact, MODNAME, A, &dbv)) {
- tmp.Append(dbv.pszVal);
- db_free(&dbv);
- }
- }
- else tmp.Append(str.c_str()+i, j);
- i += j;
- }
- else tmp.AppendChar(copyOfStr[i]);
- }
- str = tmp;
-}
-
-// do saveN("A","B","C","D") A is module, B is setting, c is value, D is type 0/b 1/w 2/d 3/s
-void checkStringForSaveN(CMStringA &str)
-{
- if (!strstr(str, "saveN(\"")) return;
- char *A, *B, *C, *D, *copyOfStr = NEWSTR_ALLOCA(str.c_str());
- unsigned int i, j = 0, s = str.GetLength();
- CMStringA tmp;
- for (i = 0; i < s; i++) {
- if (!strncmp(str.c_str()+i, "saveN(\"", mir_strlen("saveN(\""))) {
- i += (int)mir_strlen("saveN(\"");
- A = strtok(&copyOfStr[i], "\",\"");
- B = strtok(nullptr, ",\"");
- C = strtok(nullptr, ",\"");
- D = strtok(nullptr, ",\")");
- j = D - &copyOfStr[i] + (int)mir_strlen(D) + 1;
- if (A && B && C && D) {
- switch (D[0]) {
- case '0':
- case 'b':
- db_set_b(0, A, B, (BYTE)atoi(C));
- break;
- case '1':
- case 'w':
- db_set_w(0, A, B, (WORD)atoi(C));
- break;
- case '2':
- case 'd':
- db_set_dw(0, A, B, (DWORD)atoi(C));
- break;
- case '3':
- case 's':
- db_set_s(0, A, B, C);
- break;
- }
- }
- else tmp.Append(str.c_str()+i, j);
- i += j;
- }
- else tmp.AppendChar(copyOfStr[i]);
- }
- str = tmp;
-}
-
-// do loadN("A","B") A is module, B is setting
-void checkStringForLoadN(CMStringA &str)
-{
- if (!strstr(str, "loadN(\"")) return;
- char *copyOfStr = NEWSTR_ALLOCA(str.c_str()), temp[32];
- unsigned int i, j = 0, s = str.GetLength();
- CMStringA tmp;
- for (i = 0; i < s; i++) {
- if (!strncmp(str.c_str()+i, "loadN(\"", mir_strlen("loadN(\""))) {
- i += (int)mir_strlen("loadN(\"");
- char *A = strtok(&copyOfStr[i], "\",\"");
- char *B = strtok(nullptr, ",\")");
- if (A && B) {
- j = B - &copyOfStr[i] + (int)mir_strlen(B) + 1;
- DBVARIANT dbv;
- if (!db_get(NULL, A, B, &dbv)) {
- switch (dbv.type) {
- case DBVT_BYTE:
- tmp.Append(_itoa(dbv.bVal, temp, 10));
- break;
- case DBVT_WORD:
- tmp.Append(_itoa(dbv.wVal, temp, 10));
- break;
- case DBVT_DWORD:
- tmp.Append(_itoa(dbv.dVal, temp, 10));
- break;
- case DBVT_ASCIIZ:
- tmp.Append(dbv.pszVal);
- break;
- }
- db_free(&dbv);
- }
- }
- else tmp.Append(str.c_str()+i, i);
- i += j;
- }
- else tmp.AppendChar(copyOfStr[i]);
- }
- str = tmp;
-}
-
-BOOL GetLastWriteTime(HANDLE hFile, LPSTR lpszString)
-{
- FILETIME ftCreate, ftAccess, ftWrite;
- SYSTEMTIME stUTC, stLocal;
-
- // Retrieve the file times for the file.
- if (!GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite))
- return FALSE;
-
- // Convert the last-write time to local time.
- FileTimeToSystemTime(&ftWrite, &stUTC);
- SystemTimeToTzSpecificLocalTime(nullptr, &stUTC, &stLocal);
-
- // Build a string showing the date and time.
- wsprintfA(lpszString, "%02d/%02d/%d %02d:%02d",
- stLocal.wDay, stLocal.wMonth, stLocal.wYear,
- stLocal.wHour, stLocal.wMinute); //!!!!!!!!!!!!!!!
-
- return TRUE;
-}
-
-// do lastchecked(file(X)) returns amount of chars to add to str pointer
-int lastChecked(CMStringA &szNewStr, const char *str)
-{
- char *szPattern = "lastchecked(file(";
- size_t cbPattern = mir_strlen(szPattern);
-
- if (!strncmp(str, szPattern, cbPattern)) {
- int file;
- char tszFileName[MAX_PATH], temp[MAX_PATH], szSetting[20];
- sscanf(&str[cbPattern], "%d", &file);
- mir_snprintf(szSetting, "fn%d", file);
-
- char *szVar = db_get_sa(0, MODNAME, szSetting);
- if (szVar == nullptr)
- return 0;
-
- if (!strncmp("http://", szVar, 7) || !strncmp("https://", szVar, 8))
- mir_snprintf(tszFileName, "%s\\plugins\\fn%d.html", getMimDir(temp), file);
- else
- mir_strncpy(tszFileName, szVar, _countof(tszFileName));
- mir_free(szVar);
-
- HANDLE hFile = CreateFileA(tszFileName, 0, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
- if (hFile == INVALID_HANDLE_VALUE)
- return 0;
-
- if (GetLastWriteTime(hFile, tszFileName)) {
- CloseHandle(hFile);
- szNewStr.Append(tszFileName);
- mir_snprintf(tszFileName, "%s%d))", szPattern, file);
- return (int)mir_strlen(tszFileName);
- }
- CloseHandle(hFile);
- }
- return 0;
-}
-
-
-// do icon(x) 0=offline, 1=online, 10=lunch
-void checkIcon(MCONTACT hContact, char* string)
-{
- char* str = strstr(string, "icon(");
- if (str) {
- int icon = getNumber(str + 5);
- if (icon >= 0)
- g_plugin.setWord(hContact, "Status", (WORD)(ID_STATUS_OFFLINE + icon));
- }
-}
-
-int stringReplacer(const char *oldString, CMStringA &szNewString, MCONTACT hContact)
-{
- char var_file[8];
- int tempInt;
- int startLine = 0, endLine = 0, startChar = 0, endChar = 0, wholeLine = -1, linesInFile;
- int positionInOldString = 0;
- char *fileContents[MAXLINES] = {}, tempString[MAX_STRING_LENGTH];
-
- // setup the variable names
- szNewString.Empty();
- strncpy(var_file, "file(", sizeof(var_file));
-
- while ((positionInOldString < (int)mir_strlen(oldString)) && (oldString[positionInOldString] != '\0')) {
- // load the file... must be first
- if (!strncmp(&oldString[positionInOldString], var_file, mir_strlen(var_file))) {
- positionInOldString += (int)mir_strlen(var_file);
- // check if its a number
- tempInt = getNumber(&oldString[positionInOldString]);
- if (tempInt == -1) {
- // not a number so check vars..
- // there are none yet
- return ERROR_NO_FILE;
- }
- // read the file
- linesInFile = readFileIntoArray(tempInt, fileContents);
- if (linesInFile == 0)
- return ERROR_NO_FILE;
- positionInOldString += (int)mir_strlen(_itoa(tempInt, tempString, 10)) + 1; // +1 for the closing )
-
- // wholeline()
- if (!strncmp(&oldString[positionInOldString], "wholeline(line(", mir_strlen("wholeline(line("))) {
- positionInOldString += (int)mir_strlen("wholeline(line(");
- tempInt = findLine(fileContents, oldString, linesInFile, startLine, &positionInOldString);
- if (tempInt == -1 || !fileContents[tempInt])
- return ERROR_NO_LINE_AFTER_VAR_F;
- wholeLine = tempInt;
- positionInOldString += 3; // add 2 for the )) for wholeline(line())
- }
-
- if (!strncmp(&oldString[positionInOldString], "start(", mir_strlen("start("))) {
- positionInOldString += (int)mir_strlen("start(line(");
- tempInt = findLine(fileContents, oldString, linesInFile, startLine, &positionInOldString);
- if (tempInt == -1 || !fileContents[tempInt])
- return ERROR_NO_LINE_AFTER_VAR_F;
- else {
- positionInOldString += 2;
- startLine = tempInt;
- if (!endChar)
- endChar = (int)mir_strlen(fileContents[startLine]);
- tempInt = findChar(fileContents, oldString, startLine, &positionInOldString, startChar, 0);
- if (tempInt == -1)
- return ERROR_NO_LINE_AFTER_VAR_F;
- startChar = tempInt;
- }
- positionInOldString += 2; // add 2 for the )) for start(line())
- }
-
- if (!strncmp(&oldString[positionInOldString], "end(", mir_strlen("end("))) {
- positionInOldString += (int)mir_strlen("end(line(");
- tempInt = findLine(fileContents, oldString, linesInFile, startLine, &positionInOldString);
- if (tempInt == -1 || !fileContents[tempInt])
- return ERROR_NO_LINE_AFTER_VAR_F;
-
- positionInOldString += 2;
- endLine = tempInt;
- tempInt = findChar(fileContents, oldString, startLine, &positionInOldString, startChar, 1);
- if (tempInt == -1)
- return ERROR_NO_LINE_AFTER_VAR_F;
- endChar = tempInt;
- positionInOldString += 2; // add 2 for the )) for end(line())
- }
- // check for both start() and end() otherwise, only copying 1 line
- if (!strstr(oldString, "start(")) startLine = endLine;
- if (!strstr(oldString, "end(")) endLine = startLine;
-
- // after all the options copy the line across and add 2 to positionInOldString for the file(print(....))
- if (wholeLine >= 0)
- szNewString.Append(fileContents[wholeLine]);
- else {
- // only copying from 1 line
- if (startLine == endLine)
- szNewString.Append(&fileContents[startLine][startChar], endChar - startChar);
- else {
- // copy the whole first line from startChar
- szNewString.Append(&fileContents[startLine][startChar]);
-
- // copy the middle lines across
- for (int i = (startLine + 1); i < endLine; i++)
- szNewString.Append(fileContents[i]);
-
- // copy the last line untill endChar
- szNewString.Append(fileContents[endLine], endChar);
- }
- }
- }
- // filename()
- else if (!strncmp(&oldString[positionInOldString], "filename(", mir_strlen("filename("))) {
- positionInOldString += (int)mir_strlen("filename(");
- tempInt = getNumber(&oldString[positionInOldString]);
- if (tempInt == -1)
- return ERROR_NO_FILE;
-
- mir_snprintf(tempString, "fn%d", tempInt);
- if (db_get_static(NULL, MODNAME, tempString, tempString, _countof(tempString)))
- return ERROR_NO_FILE;
-
- szNewString.Append(tempString);
- positionInOldString += (int)mir_strlen(_itoa(tempInt, tempString, 10)) + 1;
- }
- // lastchecked(file(X))
- else if (!strncmp(&oldString[positionInOldString], "lastchecked(file(", mir_strlen("lastchecked(file("))) {
- positionInOldString += lastChecked(szNewString, &oldString[positionInOldString]);
- }
- else {
- szNewString.Append(&oldString[positionInOldString], 1);
- positionInOldString++;
- }
- }
- // free the file strings
- for (tempInt = 0; (tempInt < MAXLINES) && (fileContents[tempInt] != nullptr); tempInt++)
- free(fileContents[tempInt]);
-
- // check for load("A","B")
- checkStringForLoad(hContact, szNewString);
- // and loadN(...)
- checkStringForLoadN(szNewString);
- // check for compare("A","B","X","Y")
- checkStringForcompare(szNewString);
- // check for save("A","B")
- checkStringForSave(hContact, szNewString);
- // and saveN(...)
- checkStringForSaveN(szNewString);
- return 1;
-}
-
-void WriteSetting(MCONTACT hContact, char* module1, char* setting1, char* module2, char* setting2)
-{
- CMStringA newString;
- char text[MAX_STRING_LENGTH];
- int error = 0, status = GetLCStatus(0, 0);
- if (!db_get_static(hContact, module1, setting1, text, _countof(text))) {
- switch (stringReplacer(text, newString, hContact)) {
- case ERROR_NO_LINE_AFTER_VAR_F:
- newString.Format(Translate("%s - ERROR: no line specified or line not found (in %s)"), text, setting1);
- error = 1;
- break;
- case ERROR_LINE_NOT_READ:
- newString.Format(Translate("%s - ERROR: file couldn't be opened (in %s)"), text, setting1);
- error = 1;
- break;
- case ERROR_NO_FILE:
- newString.Format(Translate("%s - ERROR: no file specified in settings (in %s)"), text, setting1);
- error = 1;
- break;
- default:
- error = 0;
- break;
- }
- // strip the tab and new lines from all except the tooltip
- if (!error && mir_strcmp(setting1, "ToolTip"))
- newString.TrimRight();
- db_set_s(hContact, module2, setting2, newString);
- }
- else db_set_s(hContact, module2, setting2, "");
-
- if (!error) {
- if ((status == ID_STATUS_ONLINE) || (status == ID_STATUS_AWAY) ||
- (status == g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE)) ||
- g_plugin.getByte(hContact, "AlwaysVisible", 0))
- g_plugin.setWord(hContact, "Status", (WORD)g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE));
- else
- g_plugin.setWord(hContact, "Status", ID_STATUS_OFFLINE);
- }
- else g_plugin.setWord(hContact, "Status", ID_STATUS_OFFLINE);
-}
-
-void replaceAllStrings(MCONTACT hContact)
-{
- WriteSetting(hContact, MODNAME, "Name", MODNAME, "Nick");
- WriteSetting(hContact, MODNAME, "ProgramString", MODNAME, "Program");
- WriteSetting(hContact, MODNAME, "ProgramParamsString", MODNAME, "ProgramParams");
- /* tooltips*/
- WriteSetting(hContact, MODNAME, "ToolTip", "UserInfo", "MyNotes");
-
- char tmp1[256], tmp2[256], tmp3[256];
- if (db_get_static(hContact, MODNAME, "Program", tmp1, _countof(tmp1)))
- db_set_s(hContact, "UserInfo", "FirstName", "");
- else if (db_get_static(hContact, MODNAME, "ProgramParams", tmp2, _countof(tmp2)))
- db_set_s(hContact, "UserInfo", "FirstName", tmp1);
- else {
- mir_snprintf(tmp3, "%s %s", tmp1, tmp2);
- db_set_s(hContact, "UserInfo", "FirstName", tmp3);
- }
-}
diff --git a/plugins/Non-IM Contact/src/resource.h b/plugins/Non-IM Contact/src/resource.h
deleted file mode 100644
index c423077863..0000000000
--- a/plugins/Non-IM Contact/src/resource.h
+++ /dev/null
@@ -1,76 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by resource.rc
-//
-#define IDD_ADD_FILE 101
-#define IDI_MAIN 103
-#define IDD_CONTACT_INFO 104
-#define IDD_OTHER_STUFF 105
-#define IDI_ICON1 106
-#define IDD_CONTACT_COPYEXPORT 108
-#define IDD_OPTIONS 109
-#define IDD_TEST_LINE 110
-#define IDD_HELP 111
-#define IDC_FN 1000
-#define IDC_FILE_LIST 1001
-#define IDC_ADD_FILE 1002
-#define IDC_ADD_FILE2 1003
-#define IDC_DEL_FILE 1004
-#define IDC_FILE_CONTENTS 1005
-#define IDC_URL 1006
-#define IDC_ADD_URL 1007
-#define IDC_DISPLAY_NAME 1007
-#define IDC_TOOLTIP 1008
-#define IDC_GROUP 1008
-#define IDC_HELPMSG 1009
-#define IDC_LINK 1010
-#define IDC_PARAMS 1011
-#define IDC_OPEN_FILE 1012
-#define IDC_OPEN_FOLDER 1013
-#define CHK_USE_TIMER 1016
-#define IDC_TIMER 1017
-#define IDC_MINUTES 1018
-#define IDC_SECONDS 1019
-#define CHK_CTRL 1020
-#define IDC_WWW_TIMER 1022
-#define IDC_STRING_REPLACE 1025
-#define IDC_DOIT 1026
-#define IDC_EXPORT 1027
-#define IDC_ALWAYS_VISIBLE 1028
-#define IDC_VISIBLE_UNLESS_OFFLINE 1029
-#define IDC_DISABLETIMER 1031
-#define IDC_TIMER_INT 1036
-#define IDC_AWAYISNOTONLINE 1037
-#define IDC_TIMER_TEXT 1039
-#define IDC_TIMER_MSG 1040
-#define IDC_STRING 1041
-#define IDC_ANSWER 1042
-#define IDC_LINE 1043
-#define IDC_START 1045
-#define IDC_END 1046
-#define IDC_WHOLELINE 1047
-#define IDC_CSV 1048
-#define IDC_FILE 1049
-#define IDC_FILENAME 1050
-#define IDC_TIMER_INTERVAL_MSG 1053
-#define IDC_HELPTEXT 1055
-#define CHK_ONLINE 40072
-#define CHK_AWAY 40073
-#define CHK_DND 40074
-#define CHK_NA 40075
-#define CHK_OCC 40076
-#define CHK_FFC 40077
-#define CHK_INVISIBLE 40078
-#define CHK_PHONE 40079
-#define CHK_LUNCH 40080
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 112
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1057
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/plugins/Non-IM Contact/src/services.cpp b/plugins/Non-IM Contact/src/services.cpp
deleted file mode 100644
index 18ae0aa1b4..0000000000
--- a/plugins/Non-IM Contact/src/services.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-#include "stdafx.h"
-
-//=======================================================
-// GetCaps
-//=======================================================
-//
-INT_PTR GetLCCaps(WPARAM wParam, LPARAM)
-{
- if (wParam == PFLAGNUM_1)
- return 0;
- if (wParam == PFLAGNUM_2)
- return PF2_ONLINE | PF2_LONGAWAY | PF2_SHORTAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE | PF2_OUTTOLUNCH | PF2_ONTHEPHONE; // add the possible statuses here.
- if (wParam == PFLAGNUM_3)
- return 0;
- return 0;
-}
-
-//=======================================================
-// GetName
-//=======================================================
-//
-INT_PTR GetLCName(WPARAM wParam, LPARAM lParam)
-{
- mir_strncpy((char*)lParam, MODNAME, wParam);
- return 0;
-}
-
-//=======================================================
-// BPLoadIcon
-//=======================================================
-//
-INT_PTR LoadLCIcon(WPARAM wParam, LPARAM)
-{
- if (LOWORD(wParam) == PLI_PROTOCOL) {
- if (wParam & PLIF_ICOLIBHANDLE)
- return (INT_PTR)iconList[0].hIcolib;
-
- HICON hIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib, (wParam & PLIF_SMALL) == 0);
- if (wParam & PLIF_ICOLIB)
- return (INT_PTR)hIcon;
-
- HICON hIcon2 = CopyIcon(hIcon);
- IcoLib_ReleaseIcon(hIcon);
- return (INT_PTR)hIcon2;
- }
-
- return NULL;
-}
-
-//=======================================================
-// SetFStatus
-//=======================================================
-//
-int SetLCStatus(WPARAM wParam, LPARAM)
-{
- int oldStatus = LCStatus;
- LCStatus = wParam;
- g_plugin.setWord("Status", (WORD)wParam);
- g_plugin.setWord("timerCount", 0);
- if (LCStatus == ID_STATUS_OFFLINE || (LCStatus == ID_STATUS_AWAY && !g_plugin.getByte("AwayAsStatus", 0)) || !g_plugin.getWord("Timer", 1))
- killTimer();
- else if (g_plugin.getWord("Timer", 1))
- startTimer(TIMER);
-
- for (auto &hContact : Contacts(MODNAME)) {
- if (LCStatus != ID_STATUS_OFFLINE)
- replaceAllStrings(hContact);
-
- switch (LCStatus) {
- case ID_STATUS_OFFLINE:
- if (g_plugin.getByte(hContact, "AlwaysVisible", 0) && !g_plugin.getByte(hContact, "VisibleUnlessOffline", 1))
- g_plugin.setWord(hContact, "Status", (WORD)g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE));
- else
- g_plugin.setWord(hContact, "Status", ID_STATUS_OFFLINE);
- break;
-
- case ID_STATUS_ONLINE:
- g_plugin.setWord(hContact, "Status", (WORD)g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE));
- break;
-
- case ID_STATUS_AWAY:
- if (g_plugin.getByte("AwayAsStatus", 0) && (g_plugin.getByte(hContact, "AlwaysVisible", 0) || (g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE) == ID_STATUS_AWAY)))
- g_plugin.setWord(hContact, "Status", (WORD)g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE));
- else if (!g_plugin.getByte("AwayAsStatus", 0))
- g_plugin.setWord(hContact, "Status", (WORD)g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE));
- else
- g_plugin.setWord(hContact, "Status", ID_STATUS_OFFLINE);
- break;
-
- default:
- if (g_plugin.getByte(hContact, "AlwaysVisible", 0) || LCStatus == g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE))
- g_plugin.setWord(hContact, "Status", (WORD)g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE));
- break;
- }
- }
-
- ProtoBroadcastAck(MODNAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, wParam);
- return 0;
-}
-
-//=======================================================
-// GetStatus
-//=======================================================
-//
-INT_PTR GetLCStatus(WPARAM, LPARAM)
-{
- if ((LCStatus >= ID_STATUS_ONLINE) && (LCStatus <= ID_STATUS_OUTTOLUNCH))
- return LCStatus;
- else
- return ID_STATUS_OFFLINE;
-}
-
diff --git a/plugins/Non-IM Contact/src/stdafx.cxx b/plugins/Non-IM Contact/src/stdafx.cxx
deleted file mode 100644
index d33e44d684..0000000000
--- a/plugins/Non-IM Contact/src/stdafx.cxx
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-Copyright (C) 2012-19 Miranda NG team (https://miranda-ng.org)
-
-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 version 2
-of the License.
-
-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, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h" \ No newline at end of file
diff --git a/plugins/Non-IM Contact/src/stdafx.h b/plugins/Non-IM Contact/src/stdafx.h
deleted file mode 100644
index b0cec1f9cb..0000000000
--- a/plugins/Non-IM Contact/src/stdafx.h
+++ /dev/null
@@ -1,130 +0,0 @@
-//=====================================================
-// Includes (yea why not include lots of stuff :p )
-//=====================================================
-#ifndef COMMONHEADERS
-#define COMMONHEADERS
-
-#include <windows.h>
-#include <commctrl.h>
-#include <winsock.h>
-#include <shlobj.h>
-
-#include <malloc.h>
-#include <stdio.h>
-#include <time.h>
-#include <stddef.h>
-#include <process.h>
-#include <string.h>
-
-struct DLGTEMPLATEEX
-{
- WORD dlgVer;
- WORD signature;
- DWORD helpID;
- DWORD exStyle;
- DWORD style;
- WORD cDlgItems;
- short x;
- short y;
- short cx;
- short cy;
-};
-
-#include <newpluginapi.h>
-#include <m_clistint.h>
-#include <m_skin.h>
-#include <m_langpack.h>
-#include <m_database.h>
-#include <m_system.h>
-#include <m_icolib.h>
-#include <m_protocols.h>
-#include <m_userinfo.h>
-#include <m_options.h>
-#include <m_protosvc.h>
-#include <m_utils.h>
-#include <m_ignore.h>
-#include <m_netlib.h>
-#include <win2k.h>
-
-#include "resource.h"
-
-//=======================================================
-// Definitions
-//=======================================================
-#define MODNAME "NIM_Contact"
-#define modFullname "Non-IM Contact"
-#define MAXLINES 10000
-#define MAX_STRING_LENGTH 10000
-#define LINE_LENGTH 10000
-#define msg(a,b) MessageBoxA(0,a,b,MB_OK);
-#define TIMER (g_plugin.getWord("Timer", 1) * 1000)
-
-/* ERROR VALUES */
-#define ERROR_NO_LINE_AFTER_VAR_F -1
-#define ERROR_LINE_NOT_READ -2
-#define ERROR_NO_FILE -3
-
-//=======================================================
-// Defines
-//=======================================================
-// General
-
-extern int LCStatus;
-extern IconItem iconList[];
-
-// Services.c
-INT_PTR GetLCCaps(WPARAM wParam,LPARAM lParam);
-INT_PTR GetLCName(WPARAM wParam,LPARAM lParam);
-INT_PTR LoadLCIcon(WPARAM wParam,LPARAM lParam);
-int SetLCStatus(WPARAM wParam,LPARAM lParam);
-INT_PTR GetLCStatus(WPARAM wParam,LPARAM lParam);
-
-// dialog.c
-INT_PTR addContact(WPARAM wParam,LPARAM lParam) ;
-INT_PTR editContact(WPARAM wParam,LPARAM lParam);
-INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR testStringReplacer(WPARAM wParam, LPARAM lParam);
-INT_PTR LoadFilesDlg(WPARAM wParam, LPARAM lParam);
-
-
-// files.c
-int Openfile(char* outputFile, int saveOpen);
-INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-int savehtml(char* outFile);
-char* getMimDir(char* file);
-INT_PTR exportContacts(WPARAM wParam,LPARAM lParam) ;
-
-// contactinfo.c
-INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-void ExportContact(MCONTACT hContact);
-INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam);
-
-// stringreplacer.c
-int stringReplacer(const char *oldString, CMStringA &szNewString, MCONTACT hContact);
-void replaceAllStrings(MCONTACT hContact);
-void WriteSetting(MCONTACT hContact, char* module1, char* setting1 , char* module12, char* setting2);
-
-//timer.c
-int startTimer(int interval);
-int killTimer();
-
-// http.c
-void NetlibInit();
-int InternetDownloadFile (char *szUrl);
-extern char *szInfo;
-extern char *szData;
-extern HNETLIBUSER hNetlibUser;
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin();
-
- int Load() override;
- int Unload() override;
-};
-
-#endif
-
-#pragma comment(lib,"comctl32.lib")
diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp
deleted file mode 100644
index 6e34352f2e..0000000000
--- a/plugins/Non-IM Contact/src/timer.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "stdafx.h"
-
-static UINT_PTR timerId = 0;
-
-//=====================================================
-// Name : timerProc
-// Parameters: none
-// Returns : void
-// Description : called when the timer interval occurs
-//=====================================================
-//
-void timerFunc(void*)
-{
- char text[512], fn[16], szFileName[MAX_PATH], temp[MAX_PATH];
-
- int timerCount = g_plugin.getWord("timerCount", 1) + 1;
-
- if (LCStatus == ID_STATUS_OFFLINE) {
- killTimer();
- return;
- }
- g_plugin.setWord("timerCount", (WORD)timerCount);
-
- /* update the web pages*/
- for (int i = 0;; i++) {
- mir_snprintf(fn, "fn%d", i);
- if (db_get_static(NULL, MODNAME, fn, text, _countof(text)))
- break;
-
- if (!strncmp("http://", text, mir_strlen("http://")) || !strncmp("https://", text, mir_strlen("https://"))) {
- mir_snprintf(fn, "fn%d_timer", i);
- int timer = g_plugin.getWord(fn, 60);
- if (timer && !(timerCount % timer)) {
- if (!InternetDownloadFile(text)) {
- mir_snprintf(szFileName, "%s\\plugins\\fn%d.html", getMimDir(temp), i);
- savehtml(szFileName);
- }
- }
- }
- }
-
- /* update all the contacts */
- for (auto &hContact : Contacts(MODNAME)) {
- int timer = g_plugin.getWord(hContact, "Timer", 15);
- if (timer && !(timerCount % timer))
- if (!db_get_static(hContact, MODNAME, "Name", text, _countof(text)))
- replaceAllStrings(hContact);
- }
-}
-
-void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
-{
- // new thread for the timer...
- mir_forkthread(timerFunc);
-}
-
-//=====================================================
-// Name : startTimer
-// Parameters: int interval
-// Returns : int
-// Description : starts the timer
-//=====================================================
-//
-int startTimer(int interval)
-{
- timerId = SetTimer(nullptr, 0, interval, timerProc);
- return 0;
-}
-
-//=====================================================
-// Name : killTimer
-// Parameters: none
-// Returns : int
-// Description : stops the timer
-//=====================================================
-//
-int killTimer()
-{
- if (timerId != 0) {
- g_plugin.setWord("timerCount", 0);
- KillTimer(nullptr, timerId);
- timerId = 0;
- }
- return 0;
-}
diff --git a/plugins/Non-IM Contact/src/version.h b/plugins/Non-IM Contact/src/version.h
deleted file mode 100644
index d8bf664b36..0000000000
--- a/plugins/Non-IM Contact/src/version.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 6
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 3
-
-#include <stdver.h>
-
-#define __PLUGIN_NAME "Non-IM Contact"
-#define __FILENAME "NimContact.dll"
-#define __DESCRIPTION "Non-IM Contact allows you to add 'contacts' that can act as shortcuts to other programs, or links to web pages.\r\nThe contacts name can be read from a text file (includes any ASCII file).\r\nThis plugin is a combination of Favorites and Text Reader plugins both made by me)"
-#define __AUTHOR "Jonathan Gordon"
-#define __AUTHORWEB "https://miranda-ng.org/p/NimContact/"
-#define __COPYRIGHT "© 2003-2004 Jonathan Gordon, jdgordy@gmail.com"