summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2008-04-27 20:12:44 +0000
committerpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2008-04-27 20:12:44 +0000
commit1bb69f7e9ae66e6086c897e475e14f46fc4974db (patch)
treed2b1bdc5cbda1345458f62e4e87caf5a92cf8af0
parentd052a59d5fbbdd17035ed92fee43932381a1e5c9 (diff)
Support for SRMM (but no button)
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@90 c086bb3d-8645-0410-b8da-73a8550f86e7
-rw-r--r--Plugins/emoticons/Docs/emoticons_changelog.txt3
-rw-r--r--Plugins/emoticons/Docs/emoticons_version.txt2
-rw-r--r--Plugins/emoticons/ZIP/doit.bat7
-rw-r--r--Plugins/emoticons/commons.h7
-rw-r--r--Plugins/emoticons/emoticons.cpp165
5 files changed, 76 insertions, 108 deletions
diff --git a/Plugins/emoticons/Docs/emoticons_changelog.txt b/Plugins/emoticons/Docs/emoticons_changelog.txt
index 22bff39..9c664de 100644
--- a/Plugins/emoticons/Docs/emoticons_changelog.txt
+++ b/Plugins/emoticons/Docs/emoticons_changelog.txt
@@ -2,6 +2,9 @@ Emoticons
Changelog:
+. 0.0.2.5
+ + Support for SRMM (but no button)
+
. 0.0.2.4
* Handle metacontact change in the middle of chat
* Works with miranda 0.7
diff --git a/Plugins/emoticons/Docs/emoticons_version.txt b/Plugins/emoticons/Docs/emoticons_version.txt
index d9e9c78..4ea8b7c 100644
--- a/Plugins/emoticons/Docs/emoticons_version.txt
+++ b/Plugins/emoticons/Docs/emoticons_version.txt
@@ -1 +1 @@
-Emoticons 0.0.2.4 \ No newline at end of file
+Emoticons 0.0.2.5 \ No newline at end of file
diff --git a/Plugins/emoticons/ZIP/doit.bat b/Plugins/emoticons/ZIP/doit.bat
index 0b06c00..4b3e94e 100644
--- a/Plugins/emoticons/ZIP/doit.bat
+++ b/Plugins/emoticons/ZIP/doit.bat
@@ -52,6 +52,8 @@ del /Q *.*
copy ..\..\..\sdk\*.*
cd ..
cd ..
+copy ..\Release\%name%.pdb
+copy "..\Unicode_Release\%name%W.pdb"
pause
@@ -70,7 +72,10 @@ cd ..
"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%.zip Plugins Docs Customize
"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%_src.zip src\*.*
+"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%.pdb.zip %name%.pdb
+"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%W.pdb.zip %name%W.pdb
+del *.pdb
rd /S /Q Plugins
rd /S /Q Docs
rd /S /Q Customize
@@ -83,6 +88,8 @@ pause
"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%.zip %ftp% -overwrite -close
"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%W.zip %ftp% -overwrite -close
+"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%.pdb.zip %ftp% -overwrite -close
+"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%W.pdb.zip %ftp% -overwrite -close
"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%_changelog.txt %ftp% -overwrite -close
"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%_version.txt %ftp% -overwrite -close
"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%_readme.txt %ftp% -overwrite -close
diff --git a/Plugins/emoticons/commons.h b/Plugins/emoticons/commons.h
index c148edb..76c0d3b 100644
--- a/Plugins/emoticons/commons.h
+++ b/Plugins/emoticons/commons.h
@@ -200,9 +200,12 @@ struct RichEditCtrl
IRichEditOle *ole;
ITextDocument *textDocument;
WNDPROC old_edit_proc;
- BOOL received_stream_in;
- int stream_in_pos;
BOOL sending;
+
+ BOOL isLoaded()
+ {
+ return ole != NULL;
+ }
};
struct Contact
diff --git a/Plugins/emoticons/emoticons.cpp b/Plugins/emoticons/emoticons.cpp
index 629c2f0..e754b0c 100644
--- a/Plugins/emoticons/emoticons.cpp
+++ b/Plugins/emoticons/emoticons.cpp
@@ -30,7 +30,7 @@ PLUGININFOEX pluginInfo={
#else
"Emoticons",
#endif
- PLUGIN_MAKE_VERSION(0,0,2,4),
+ PLUGIN_MAKE_VERSION(0,0,2,5),
"Emoticons",
"Ricardo Pescuma Domenecci",
"",
@@ -1044,7 +1044,7 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return ret;
}
-/*
+
LRESULT CALLBACK LogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
DialogMapType::iterator dlgit = dialogData.find(hwnd);
@@ -1053,73 +1053,18 @@ LRESULT CALLBACK LogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Dialog *dlg = dlgit->second;
- switch(msg)
- {
- case WM_SETREDRAW:
- {
- if (wParam == FALSE)
- {
- dlg->log.received_stream_in = FALSE;
- }
- else
- {
- if (dlg->log.received_stream_in)
- {
- RichEditCtrl &rec = dlg->log;
- SUSPEND_UNDO(rec); \
- POINT __old_scroll_pos; \
- SendMessage(rec.hwnd, EM_GETSCROLLPOS, 0, (LPARAM) &__old_scroll_pos); \
- CHARRANGE __old_sel; \
- SendMessage(rec.hwnd, EM_EXGETSEL, 0, (LPARAM) &__old_sel); \
- POINT __caretPos; \
- GetCaretPos(&__caretPos); \
- DWORD __old_mask = SendMessage(rec.hwnd, EM_GETEVENTMASK, 0, 0); \
- SendMessage(rec.hwnd, EM_SETEVENTMASK, 0, __old_mask & ~ENM_CHANGE); \
- BOOL __inverse = (__old_sel.cpMin >= LOWORD(SendMessage(rec.hwnd, EM_CHARFROMPOS, 0, (LPARAM) &__caretPos)));
-
- CHARRANGE sel = { dlg->log.stream_in_pos, GetWindowTextLength(dlg->log.hwnd) };
- SendMessage(dlg->log.hwnd, EM_EXSETSEL, 0, (LPARAM) &sel);
-
- int len = sel.cpMax - sel.cpMin;
- TCHAR *text = (TCHAR *) malloc((len + 1) * sizeof(TCHAR));
- SendMessage(dlg->log.hwnd, EM_GETSELTEXT, 0, (LPARAM) text);
-
- for(int i = len; i > 0; i--)
- {
- int dif = ReplaceEmoticonBackwards(dlg->log.hwnd, text, i, sel.cpMin + i, dlg->module);
-
- FixSelection(__old_sel.cpMax, i, dif);
- FixSelection(__old_sel.cpMin, i, dif);
- }
-
- if (__inverse) \
- { \
- LONG __tmp = __old_sel.cpMin; \
- __old_sel.cpMin = __old_sel.cpMax; \
- __old_sel.cpMax = __tmp; \
- } \
- SendMessage(rec.hwnd, EM_SETEVENTMASK, 0, __old_mask); \
- SendMessage(rec.hwnd, EM_EXSETSEL, 0, (LPARAM) &__old_sel); \
- SendMessage(rec.hwnd, EM_SETSCROLLPOS, 0, (LPARAM) &__old_scroll_pos); \
- InvalidateRect(rec.hwnd, NULL, FALSE); \
- RESUME_UNDO(rec);
- }
- }
- break;
- }
- case EM_STREAMIN:
- {
- dlg->log.received_stream_in = TRUE;
- dlg->log.stream_in_pos = GetWindowTextLength(dlg->log.hwnd);
- break;
- }
- }
+ int stream_in_pos;
+ if (msg == EM_STREAMIN)
+ stream_in_pos = GetWindowTextLength(dlg->log.hwnd);
LRESULT ret = CallWindowProc(dlg->log.old_edit_proc, hwnd, msg, wParam, lParam);
+ if (msg == EM_STREAMIN)
+ ReplaceAllEmoticons(dlg->log, dlg->contact, dlg->module, stream_in_pos, -1);
+
return ret;
}
-*/
+
LRESULT CALLBACK OwnerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -1130,7 +1075,7 @@ LRESULT CALLBACK OwnerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Dialog *dlg = dlgit->second;
- if (msg == WM_COMMAND && (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) && dlg->input.old_edit_proc != NULL)
+ if (msg == WM_COMMAND && (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624))
{
dlg->log.sending = TRUE;
@@ -1163,13 +1108,27 @@ LRESULT CALLBACK OwnerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
+void UnloadRichEdit(RichEditCtrl *rec)
+{
+ if (rec->textDocument != NULL)
+ {
+ rec->textDocument->Release();
+ rec->textDocument = NULL;
+ }
+ if (rec->ole != NULL)
+ {
+ rec->ole->Release();
+ rec->ole = NULL;
+ }
+}
+
+
int LoadRichEdit(RichEditCtrl *rec, HWND hwnd)
{
rec->hwnd = hwnd;
rec->ole = NULL;
rec->textDocument = NULL;
rec->old_edit_proc = NULL;
- rec->received_stream_in = FALSE;
rec->sending = FALSE;
SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&rec->ole);
@@ -1177,21 +1136,16 @@ int LoadRichEdit(RichEditCtrl *rec, HWND hwnd)
return 0;
if (rec->ole->QueryInterface(IID_ITextDocument, (void**)&rec->textDocument) != S_OK)
+ {
rec->textDocument = NULL;
+ UnloadRichEdit(rec);
+ return 0;
+ }
return 1;
}
-void UnloadRichEdit(RichEditCtrl *rec)
-{
- if (rec->textDocument != NULL)
- rec->textDocument->Release();
- if (rec->ole != NULL)
- rec->ole->Release();
-}
-
-
HANDLE GetRealContact(HANDLE hContact)
{
if (hContact == NULL || !ServiceExists(MS_MC_GETMOSTONLINECONTACT))
@@ -1204,6 +1158,17 @@ HANDLE GetRealContact(HANDLE hContact)
}
+BOOL isSRMM()
+{
+ if (!ServiceExists(MS_MSG_GETWINDOWCLASS))
+ return FALSE;
+
+ char cls[256];
+ CallService(MS_MSG_GETWINDOWCLASS, (WPARAM) cls, (LPARAM) MAX_REGS(cls));
+ return strcmp(cls, "SRMM") == 0;
+}
+
+
int MsgWindowEvent(WPARAM wParam, LPARAM lParam)
{
MessageWindowEventData *evt = (MessageWindowEventData *)lParam;
@@ -1227,20 +1192,33 @@ int MsgWindowEvent(WPARAM wParam, LPARAM lParam)
dlg->module = m;
dlg->hwnd_owner = evt->hwndWindow;
- LoadRichEdit(&dlg->input, evt->hwndInput);
- LoadRichEdit(&dlg->log, evt->hwndLog);
+ int loaded = LoadRichEdit(&dlg->input, evt->hwndInput);
+ loaded |= LoadRichEdit(&dlg->log, evt->hwndLog);
+
+ if (!loaded)
+ {
+ free(dlg);
+ return 0;
+ }
- if (opts.replace_in_input)
+ if (opts.replace_in_input && dlg->input.isLoaded())
{
dlg->input.old_edit_proc = (WNDPROC) SetWindowLong(dlg->input.hwnd, GWL_WNDPROC, (LONG) EditProc);
dialogData[dlg->input.hwnd] = dlg;
+
+ dlg->owner_old_edit_proc = (WNDPROC) SetWindowLong(dlg->hwnd_owner, GWL_WNDPROC, (LONG) OwnerProc);
}
- dlg->owner_old_edit_proc = (WNDPROC) SetWindowLong(dlg->hwnd_owner, GWL_WNDPROC, (LONG) OwnerProc);
dialogData[dlg->hwnd_owner] = dlg;
-// dlg->log.old_edit_proc = (WNDPROC) SetWindowLong(dlg->log.hwnd, GWL_WNDPROC, (LONG) LogProc);
dialogData[dlg->log.hwnd] = dlg;
+
+ if (isSRMM())
+ {
+ ReplaceAllEmoticons(dlg->log, dlg->contact, dlg->module, 0, -1);
+
+ dlg->log.old_edit_proc = (WNDPROC) SetWindowLong(dlg->log.hwnd, GWL_WNDPROC, (LONG) LogProc);
+ }
}
else if (evt->uType == MSG_WINDOW_EVT_CLOSING)
{
@@ -1254,7 +1232,8 @@ int MsgWindowEvent(WPARAM wParam, LPARAM lParam)
if (dlg->input.old_edit_proc != NULL)
SetWindowLong(dlg->input.hwnd, GWL_WNDPROC, (LONG) dlg->input.old_edit_proc);
- SetWindowLong(dlg->hwnd_owner, GWL_WNDPROC, (LONG) dlg->owner_old_edit_proc);
+ if (dlg->owner_old_edit_proc != NULL)
+ SetWindowLong(dlg->hwnd_owner, GWL_WNDPROC, (LONG) dlg->owner_old_edit_proc);
free(dlg);
}
@@ -1309,30 +1288,6 @@ char *strtrim(char *str)
return str;
}
-/*
-BOOL HasProto(char *proto)
-{
- PROTOCOLDESCRIPTOR **protos;
- int count;
- CallService(MS_PROTO_ENUMPROTOS, (WPARAM)&count, (LPARAM)&protos);
-
- for (int i = 0; i < count; i++)
- {
- PROTOCOLDESCRIPTOR *p = protos[i];
-
- if (p->type != PROTOTYPE_PROTOCOL)
- continue;
-
- if (p->szName == NULL || p->szName[0] == '\0')
- continue;
-
- if (stricmp(proto, p->szName) == 0)
- return TRUE;
- }
-
- return FALSE;
-}
-*/
void LoadModules()
{