summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nohtml/common.h1
-rw-r--r--nohtml/filter.cpp24
-rw-r--r--nohtml/nohtml.cpp11
-rw-r--r--nohtml/version.h4
4 files changed, 35 insertions, 5 deletions
diff --git a/nohtml/common.h b/nohtml/common.h
index dff856c..5d4f15e 100644
--- a/nohtml/common.h
+++ b/nohtml/common.h
@@ -50,6 +50,7 @@
extern HINSTANCE hInst;
extern PLUGINLINK *pluginLink;
+extern DWORD mirandaVer;
#ifndef MIID_NOHTML
#define MIID_NOHTML { 0x9544122C, 0x46DD, 0x4BFA, { 0x8A, 0x5A, 0x5D, 0xDC, 0x3, 0x14, 0x28, 0x93 } }
diff --git a/nohtml/filter.cpp b/nohtml/filter.cpp
index 230cab7..4fd57cd 100644
--- a/nohtml/filter.cpp
+++ b/nohtml/filter.cpp
@@ -3,12 +3,20 @@
#include "options.h"
#include "conv.h"
+#define MIR_VER_FILTERS_FIXED 0x0007001A
+
void LOG(char *message) {
#ifdef _DEBUG
PUShowMessage(message, SM_NOTIFY);
#endif
}
+void LOGW(wchar_t *message) {
+#ifdef _DEBUG
+ PUShowMessageW(message, SM_NOTIFY);
+#endif
+}
+
bool ContactIsOTREncrypted(HANDLE hContact) {
return (DBGetContactSettingByte(hContact, "OTR", "Encrypted", 0) != 0);
}
@@ -79,6 +87,7 @@ int FilterRecvMessage(WPARAM wParam, LPARAM lParam) {
LOG("Recieved a unicode message.");
wchar_t *messagew = (wchar_t *)&old_message[strlen(old_message)+1];
//wchar_t* wbuf=(wchar_t*)&pre->szMessage[lstrlen(pre->szMessage)+1];
+ LOGW(messagew);
wchar_t* st_wbuf;
if(options.bbcodes)
{
@@ -134,9 +143,9 @@ int NewContact(WPARAM wParam, LPARAM lParam) {
void RegisterFilter() {
PROTOCOLDESCRIPTOR pd = {0};
pd.cbSize = sizeof(pd);
- pd.szName = MODULE "Filter";
- // TODO: modify this to reflect the purpose of your plugin
+ pd.szName = MODULE "Filter";
pd.type = PROTOTYPE_FILTER;
+
CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
}
@@ -145,8 +154,17 @@ HANDLE hEventNewContact;
HANDLE hServices[NUM_FILTER_SERVICES];
void AddFilterToContacts() {
+ if(DBGetContactSettingByte(0, MODULE, "FilterOrderFix", 0) != 2) {
+ // remove filter so it can be added again in the right position
+ HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ while ( hContact != NULL ) {
+ CallService( MS_PROTO_REMOVEFROMCONTACT, ( WPARAM )hContact, ( LPARAM )(MODULE "Filter"));
+ hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ }
+ DBWriteContactSettingByte(0, MODULE, "FilterOrderFix", 2);
+ }
+
// this adds us as a filter to all existing and new contacts
- // TODO: modify this (and the NewContact function above) to include only the contacts required
HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
while ( hContact != NULL ) {
CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hContact, ( LPARAM )(MODULE "Filter"));
diff --git a/nohtml/nohtml.cpp b/nohtml/nohtml.cpp
index 77fbf35..cd83377 100644
--- a/nohtml/nohtml.cpp
+++ b/nohtml/nohtml.cpp
@@ -10,6 +10,7 @@
///////////////////////////////////////////////
HINSTANCE hInst;
PLUGINLINK *pluginLink;
+DWORD mirandaVer;
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -34,10 +35,12 @@ extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvRe
}
extern "C" __declspec (dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) {
+ mirandaVer = mirandaVersion;
return &pluginInfo;
}
extern "C" __declspec (dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion) {
+ mirandaVer = mirandaVersion;
pluginInfo.cbSize = sizeof(PLUGININFO);
return (PLUGININFO*)&pluginInfo;
}
@@ -75,6 +78,14 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
}
+#ifdef _DEBUG
+ // show miranda version
+ char str[20];
+ str[0] = '0';
+ str[1] = 'x';
+ _itoa(mirandaVer, str+2, 16);
+ PUShowMessage(str, SM_NOTIFY);
+#endif
return 0;
}
diff --git a/nohtml/version.h b/nohtml/version.h
index 86dcd7e..2a8d28e 100644
--- a/nohtml/version.h
+++ b/nohtml/version.h
@@ -4,8 +4,8 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 4
+#define __RELEASE_NUM 1
+#define __BUILD_NUM 5
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM