diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-09 22:36:24 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-09 22:36:24 +0000 |
commit | 5fa0373e4269178d6c53e43b9e2fe7cf6157cfb7 (patch) | |
tree | 3c38b1565e5e06bd18d5f9551aa7ca6afa0256cd /plugins | |
parent | f285cbbf373f4ca84d239190d46f3fcdfc339a4d (diff) |
same fix for Scriver
git-svn-id: http://svn.miranda-ng.org/main/trunk@9753 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Scriver/src/globals.cpp | 149 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 13 |
2 files changed, 87 insertions, 75 deletions
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index e717c8536e..9b306dac6c 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -25,9 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. GlobalMessageData g_dat;
-static int ackevent(WPARAM wParam, LPARAM lParam);
-
-extern int Chat_ModulesLoaded(WPARAM wParam,LPARAM lParam);
+int Chat_ModulesLoaded(WPARAM wParam,LPARAM lParam);
static const char *buttonIcons[] = {"scriver_CLOSEX", "scriver_QUOTE", "scriver_SMILEY",
"scriver_ADD", NULL, "scriver_USERDETAILS", "scriver_HISTORY",
@@ -106,6 +104,80 @@ void RegisterIcons(void) /////////////////////////////////////////////////////////////////////////////////////////
+static int ackevent(WPARAM wParam, LPARAM lParam)
+{
+ ACKDATA *pAck = (ACKDATA *)lParam;
+ if (!pAck)
+ return 0;
+
+ if (pAck->type != ACKTYPE_MESSAGE)
+ return 0;
+
+ MCONTACT hContact = pAck->hContact;
+ MessageSendQueueItem *item = FindSendQueueItem(hContact, (HANDLE)pAck->hProcess);
+ if (item == NULL)
+ item = FindSendQueueItem(hContact = db_mc_getMeta(pAck->hContact), (HANDLE)pAck->hProcess);
+ if (item == NULL)
+ return 0;
+
+ HWND hwndSender = item->hwndSender;
+ if (pAck->result == ACKRESULT_FAILED) {
+ if (item->hwndErrorDlg != NULL)
+ item = FindOldestPendingSendQueueItem(hwndSender, hContact);
+
+ if (item != NULL && item->hwndErrorDlg == NULL) {
+ if (hwndSender != NULL) {
+ ErrorWindowData *ewd = (ErrorWindowData *)mir_alloc(sizeof(ErrorWindowData));
+ ewd->szName = GetNickname(item->hContact, item->proto);
+ ewd->szDescription = mir_a2t((char *)pAck->lParam);
+ ewd->szText = GetSendBufferMsg(item);
+ ewd->hwndParent = hwndSender;
+ ewd->queueItem = item;
+ SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0);
+ SendMessage(hwndSender, DM_SHOWERRORMESSAGE, 0, (LPARAM)ewd);
+ }
+ else RemoveSendQueueItem(item);
+ }
+ return 0;
+ }
+
+ hContact = (db_mc_isMeta(hContact)) ? db_mc_getSrmmSub(item->hContact) : item->hContact;
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.flags = DBEF_SENT | ((item->flags & PREF_RTL) ? DBEF_RTL : 0);
+ if (item->flags & PREF_UTF)
+ dbei.flags |= DBEF_UTF;
+ dbei.szModule = GetContactProto(hContact);
+ dbei.timestamp = time(NULL);
+ dbei.cbBlob = lstrlenA(item->sendBuffer) + 1;
+ if (!(item->flags & PREF_UTF))
+ dbei.cbBlob *= sizeof(TCHAR) + 1;
+ dbei.pBlob = (PBYTE)item->sendBuffer;
+
+ MessageWindowEvent evt = { sizeof(evt), (int)item->hSendId, hContact, &dbei };
+ NotifyEventHooks(hHookWinWrite, 0, (LPARAM)&evt);
+
+ item->sendBuffer = (char *)dbei.pBlob;
+ db_event_add(hContact, &dbei);
+
+ if (item->hwndErrorDlg != NULL)
+ DestroyWindow(item->hwndErrorDlg);
+
+ if (RemoveSendQueueItem(item) && db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) {
+ if (hwndSender != NULL)
+ DestroyWindow(hwndSender);
+ }
+ else if (hwndSender != NULL) {
+ SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0);
+ SkinPlaySound("SendMsg");
+ }
+
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
int ImageList_AddIcon_Ex(HIMAGELIST hIml, int id)
{
HICON hIcon = LoadSkinnedIcon(id);
@@ -389,74 +461,3 @@ void ReloadGlobals() g_dat.limitTabsNum = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
g_dat.limitChatsTabsNum = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM);
}
-
-static int ackevent(WPARAM wParam, LPARAM lParam)
-{
- ACKDATA *pAck = (ACKDATA *)lParam;
- if (!pAck)
- return 0;
-
- if (pAck->type != ACKTYPE_MESSAGE)
- return 0;
-
- MCONTACT hContact = pAck->hContact;
- MessageSendQueueItem *item = FindSendQueueItem(hContact, (HANDLE)pAck->hProcess);
- if (item == NULL)
- item = FindSendQueueItem(hContact = db_mc_getMeta(pAck->hContact), (HANDLE)pAck->hProcess);
- if (item == NULL)
- return 0;
-
- HWND hwndSender = item->hwndSender;
- if (pAck->result == ACKRESULT_FAILED) {
- if (item->hwndErrorDlg != NULL)
- item = FindOldestPendingSendQueueItem(hwndSender, hContact);
-
- if (item != NULL && item->hwndErrorDlg == NULL) {
- if (hwndSender != NULL) {
- ErrorWindowData *ewd = (ErrorWindowData *)mir_alloc(sizeof(ErrorWindowData));
- ewd->szName = GetNickname(item->hContact, item->proto);
- ewd->szDescription = mir_a2t((char *)pAck->lParam);
- ewd->szText = GetSendBufferMsg(item);
- ewd->hwndParent = hwndSender;
- ewd->queueItem = item;
- SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0);
- SendMessage(hwndSender, DM_SHOWERRORMESSAGE, 0, (LPARAM)ewd);
- }
- else
- RemoveSendQueueItem(item);
- }
- return 0;
- }
-
- DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.flags = DBEF_SENT | ((item->flags & PREF_RTL) ? DBEF_RTL : 0);
- if (item->flags & PREF_UTF)
- dbei.flags |= DBEF_UTF;
- dbei.szModule = GetContactProto(item->hContact);
- dbei.timestamp = time(NULL);
- dbei.cbBlob = lstrlenA(item->sendBuffer) + 1;
- if (!(item->flags & PREF_UTF))
- dbei.cbBlob *= sizeof(TCHAR) + 1;
- dbei.pBlob = (PBYTE)item->sendBuffer;
-
- MessageWindowEvent evt = { sizeof(evt), (int)item->hSendId, item->hContact, &dbei };
- NotifyEventHooks(hHookWinWrite, 0, (LPARAM)&evt);
-
- item->sendBuffer = (char *)dbei.pBlob;
- db_event_add(item->hContact, &dbei);
-
- if (item->hwndErrorDlg != NULL)
- DestroyWindow(item->hwndErrorDlg);
-
- if (RemoveSendQueueItem(item) && db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) {
- if (hwndSender != NULL)
- DestroyWindow(hwndSender);
- }
- else if (hwndSender != NULL) {
- SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0);
- SkinPlaySound("SendMsg");
- }
-
- return 0;
-}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index c416c65989..b2dab1d2c5 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -441,6 +441,16 @@ static int ModuleLoad(WPARAM wParam, LPARAM lParam) return 0;
}
+static int MetaContactChanged(WPARAM hMeta, LPARAM)
+{
+ if (hMeta) {
+ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hMeta);
+ if (hwnd != NULL)
+ SendMessage(hwnd, DM_GETAVATAR, 0, 0);
+ }
+ return 0;
+}
+
static int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
ReloadGlobals();
@@ -462,6 +472,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
HookEvent(ME_FONT_RELOAD, FontServiceFontsChanged);
HookEvent(ME_MSG_ICONPRESSED, StatusIconPressed);
+ HookEvent(ME_MC_DEFAULTTCHANGED, MetaContactChanged);
RestoreUnreadMessageAlerts();
Chat_ModulesLoaded(wParam, lParam);
@@ -469,7 +480,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) return 0;
}
-int OnSystemPreshutdown(WPARAM wParam, LPARAM lParam)
+int OnSystemPreshutdown(WPARAM, LPARAM)
{
WindowList_Broadcast(g_dat.hMessageWindowList, WM_CLOSE, 0, 0);
WindowList_Broadcast(g_dat.hParentWindowList, WM_CLOSE, 0, 0);
|