summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-16 12:57:09 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-16 12:57:09 +0300
commit12c0a01bc1826949fa9e146b668a400cab679a63 (patch)
tree2dc6768537cf0de4ce2a7a79b86c3a08f3c8af1e /plugins
parent40086f4fc370ca92218c805fe5cee10c09f57f2c (diff)
merge with master till
IRC fixes #1342 (broken search in channel browser);
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CrashDumper/src/dumper.cpp68
-rw-r--r--plugins/CrashDumper/src/version.h2
-rw-r--r--plugins/Popup/src/config.cpp2
-rw-r--r--plugins/Popup/src/config.h1
-rw-r--r--plugins/Popup/src/main.cpp4
-rw-r--r--plugins/Popup/src/popup_thread.cpp3
-rw-r--r--plugins/Popup/src/services.cpp13
-rw-r--r--plugins/Popup/src/version.h2
-rw-r--r--plugins/SmileyAdd/src/smileys.cpp2
9 files changed, 43 insertions, 54 deletions
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp
index 1eb4113e24..4e2123733a 100644
--- a/plugins/CrashDumper/src/dumper.cpp
+++ b/plugins/CrashDumper/src/dumper.cpp
@@ -262,62 +262,56 @@ static void GetPluginsString(CMStringW &buffer, unsigned &flags)
}
}
-struct ProtoCount
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct ProtoCount : public MZeroedObject
{
- int countse;
- int countsd;
- bool nloaded;
+ ProtoCount(char *p) :
+ szProto(p)
+ {}
+
+ char *szProto;
+ int countse;
+ int countsd;
+ bool nloaded;
+
+ static int Compare(const ProtoCount *p1, const ProtoCount *p2)
+ { return mir_strcmp(p1->szProto, p2->szProto);
+ }
};
static void GetProtocolStrings(CMStringW &buffer)
{
- int accCount;
- PROTOACCOUNT **accList;
- Proto_EnumAccounts(&accCount, &accList);
-
int protoCount;
PROTOCOLDESCRIPTOR **protoList;
Proto_EnumProtocols(&protoCount, &protoList);
- int protoCountMy = 0;
- char **protoListMy = (char**)alloca((protoCount + accCount) * sizeof(char*));
+ OBJLIST<ProtoCount> arProtos(10, &ProtoCount::Compare);
+ // add first all declared protocols, both old & new
for (int i = 0; i < protoCount; i++)
switch (protoList[i]->type) {
case PROTOTYPE_PROTOCOL:
case PROTOTYPE_PROTOWITHACCS:
- protoListMy[protoCountMy++] = protoList[i]->szName;
+ arProtos.insert(new ProtoCount(protoList[i]->szName));
}
- for (int j = 0; j < accCount; j++) {
- int i;
- for (i = 0; i < protoCountMy; i++)
- if (!mir_strcmp(protoListMy[i], accList[j]->szProtoName))
- break;
+ // try to gather all missing protocols from accounts
+ for (auto &pa : Accounts()) {
+ ProtoCount *p = arProtos.find((ProtoCount*)&pa->szProtoName);
+ if (p == nullptr)
+ continue;
- if (i == protoCountMy)
- protoListMy[protoCountMy++] = accList[j]->szProtoName;
+ p->nloaded = pa->bDynDisabled;
+ if (pa->IsEnabled())
+ ++p->countse;
+ else
+ ++p->countsd;
}
- ProtoCount *protos = (ProtoCount*)alloca(sizeof(ProtoCount) * protoCountMy);
- memset(protos, 0, sizeof(ProtoCount) * protoCountMy);
-
- for (int j = 0; j < accCount; j++)
- for (int i = 0; i < protoCountMy; i++)
- if (!mir_strcmp(protoListMy[i], accList[j]->szProtoName)) {
- protos[i].nloaded = accList[j]->bDynDisabled != 0;
- if (accList[j]->IsEnabled())
- ++protos[i].countse;
- else
- ++protos[i].countsd;
- break;
- }
-
- for (int i = 0; i < protoCountMy; i++) {
- auto &p = protos[i];
- buffer.AppendFormat(L"%-24s %d - Enabled %d - Disabled %sLoaded\r\n",
- (wchar_t*)_A2T(protoListMy[i]), p.countse, p.countsd, p.nloaded ? L"Not " : L"");
- }
+ for (auto &p : arProtos)
+ if (p->countsd != 0 || p->countse != 0)
+ buffer.AppendFormat(L"%-24S %d - Enabled %d - Disabled %sLoaded\r\n", p->szProto, p->countse, p->countsd, p->nloaded ? L"Not " : L"");
}
static void GetWeatherStrings(CMStringW &buffer, unsigned flags)
diff --git a/plugins/CrashDumper/src/version.h b/plugins/CrashDumper/src/version.h
index af1c0543f6..390610fc81 100644
--- a/plugins/CrashDumper/src/version.h
+++ b/plugins/CrashDumper/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp
index fc276a1b63..eafca08668 100644
--- a/plugins/Popup/src/config.cpp
+++ b/plugins/Popup/src/config.cpp
@@ -25,8 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ===== General Plugin =====
HINSTANCE hInst;
-HANDLE hMainThread;
-// MNOTIFYLINK *notifyLink; // deprecatet
HANDLE hSemaphore;
BOOL closing = FALSE;
diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h
index 07e9d6d86c..ae2d599e42 100644
--- a/plugins/Popup/src/config.h
+++ b/plugins/Popup/src/config.h
@@ -126,7 +126,6 @@ void LoadOptions();
//===== General Plugin =====
extern HINSTANCE hInst;
-extern HANDLE hMainThread;
extern HANDLE hEventNotify;
extern HANDLE hSemaphore;
extern BOOL closing;
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index 7471eddb29..aaff53315c 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -315,8 +315,6 @@ static int OnShutdown(WPARAM, LPARAM)
// Called when the plugin is loaded into Miranda
MIRAPI int Load(void)
{
- DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0);
-
mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
@@ -438,7 +436,5 @@ MIRAPI int Unload(void)
UnloadActions();
UnloadTreeData();
-
- CloseHandle(hMainThread);
return 0;
}
diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp
index 5caede1cf1..508bece260 100644
--- a/plugins/Popup/src/popup_thread.cpp
+++ b/plugins/Popup/src/popup_thread.cpp
@@ -229,7 +229,7 @@ static unsigned __stdcall PopupThread(void *)
wcl.lpszMenuName = nullptr;
wcl.lpszClassName = L"PopupThreadManagerWnd";
wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
- g_wndClass.cPopupThreadManagerWnd = RegisterClassEx(&wcl);
+ g_wndClass.cPopupThreadManagerWnd = RegisterClassExW(&wcl);
err = GetLastError();
if (!g_wndClass.cPopupThreadManagerWnd) {
wchar_t msg[1024];
@@ -247,6 +247,7 @@ static unsigned __stdcall PopupThread(void *)
}
DestroyWindow(gHwndManager); gHwndManager = nullptr;
+ UnregisterClassW(wcl.lpszClassName, hInst);
return 0;
}
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index d545d5ff9e..fab7339724 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -330,12 +330,13 @@ struct SafeUnhookEventParam
HANDLE hEvent;
};
-static void CALLBACK SafeUnhookEventFunc(ULONG_PTR dwParam)
+static void CALLBACK SafeUnhookEventFunc(void *param)
{
- UnhookEvent(((SafeUnhookEventParam *)dwParam)->hEvent);
- PostMessage(((SafeUnhookEventParam *)dwParam)->hwndPopup, UM_POPUPUNHOOKCOMPLETE, 0,
- (LPARAM)((SafeUnhookEventParam *)dwParam)->hEvent);
- delete (SafeUnhookEventParam *)dwParam;
+ SafeUnhookEventParam *p = (SafeUnhookEventParam*)param;
+
+ UnhookEvent(p->hEvent);
+ PostMessage(p->hwndPopup, UM_POPUPUNHOOKCOMPLETE, 0, (LPARAM)p->hEvent);
+ delete p;
}
INT_PTR Popup_UnhookEventAsync(WPARAM wParam, LPARAM lParam)
@@ -343,7 +344,7 @@ INT_PTR Popup_UnhookEventAsync(WPARAM wParam, LPARAM lParam)
SafeUnhookEventParam *param = new SafeUnhookEventParam;
param->hwndPopup = (HWND)wParam;
param->hEvent = (HANDLE)lParam;
- QueueUserAPC(SafeUnhookEventFunc, hMainThread, (ULONG_PTR)param);
+ CallFunctionAsync(SafeUnhookEventFunc, param);
return 0;
}
diff --git a/plugins/Popup/src/version.h b/plugins/Popup/src/version.h
index cbbaf99aa8..d8239c112b 100644
--- a/plugins/Popup/src/version.h
+++ b/plugins/Popup/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
#define __RELEASE_NUM 1
-#define __BUILD_NUM 12
+#define __BUILD_NUM 14
#include <stdver.h>
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp
index 6c19d195f0..570b15469b 100644
--- a/plugins/SmileyAdd/src/smileys.cpp
+++ b/plugins/SmileyAdd/src/smileys.cpp
@@ -470,7 +470,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMStringW &tbuf, bool onlyInfo)
SmileyType *dat = new SmileyType;
dat->SetRegEx(true);
dat->SetImList(m_hSmList, _wtoi(pStr));
- dat->m_ToolText = xmlGetText(nRec);
+ dat->m_ToolText = FilterQuotes(xmlGetText(nRec));
if (node = xmlGetChildByPath(nRec, L"Expression", 0))
dat->m_TriggerText = FilterQuotes(xmlGetText(node));