diff options
author | George Hazan <george.hazan@gmail.com> | 2016-02-19 12:05:55 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-02-19 12:05:55 +0000 |
commit | 5b796cb19202cbd63634ff68bda89520a5efc0c3 (patch) | |
tree | d06195813c1c422bea0c673e6e58f098b2d739eb /plugins/YAMN/src/browser | |
parent | a886e1caf3d3d563b43aaa230144b3e8f40a3d4e (diff) |
YAMN:
- incorrect Unicode processing fixed;
- critical sections removed;
- translation fix;
- code cleaning;
git-svn-id: http://svn.miranda-ng.org/main/trunk@16308 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAMN/src/browser')
-rw-r--r-- | plugins/YAMN/src/browser/badconnect.cpp | 32 | ||||
-rw-r--r-- | plugins/YAMN/src/browser/mailbrowser.cpp | 45 |
2 files changed, 29 insertions, 48 deletions
diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index 1285571205..69274be795 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -216,10 +216,6 @@ void __cdecl BadConnection(void *Param) MSG msg;
HWND hBadConnect;
HACCOUNT ActualAccount;
- NOTIFYICONDATA nid;
- char *NotIconText = Translate(" - connection error"), *src;
- TCHAR *dest;
- int i;
struct BadConnectionParam MyParam = *(struct BadConnectionParam *)Param;
ActualAccount = MyParam.account;
@@ -237,19 +233,10 @@ void __cdecl BadConnection(void *Param) SendMessage(hBadConnect, WM_SETICON, ICON_BIG, (LPARAM)g_LoadIconEx(3));
SendMessage(hBadConnect, WM_SETICON, ICON_SMALL, (LPARAM)g_LoadIconEx(3));
- memset(&nid, 0, sizeof(nid));
- nid.cbSize = sizeof(NOTIFYICONDATA);
- nid.hWnd = hBadConnect;
- nid.hIcon = g_LoadIconEx(3);
- nid.uID = 0;
- nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
- nid.uCallbackMessage = WM_YAMN_NOTIFYICON;
-
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read wait\n");
#endif
- if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO))
- {
+ if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO)) {
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read wait failed\n");
#endif
@@ -258,16 +245,23 @@ void __cdecl BadConnection(void *Param) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read enter\n");
#endif
- for (src = ActualAccount->Name, dest = nid.szTip, i = 0; (*src != (TCHAR)0) && (i + 1 < sizeof(nid.szTip)); *dest++ = *src++);
- for (src = NotIconText; (*src != (TCHAR)0) && (i + 1 < sizeof(nid.szTip)); *dest++ = *src++);
- *dest = (TCHAR)0;
-
if (ActualAccount->BadConnectN.Flags & YAMN_ACC_SND)
CallService(MS_SKIN_PLAYSOUND, 0, (LPARAM)YAMN_CONNECTFAILSOUND);
+
if (ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG)
ShowWindow(hBadConnect, SW_SHOWNORMAL);
- if (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO)
+
+ if (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO) {
+ NOTIFYICONDATA nid = {};
+ nid.cbSize = sizeof(nid);
+ nid.hWnd = hBadConnect;
+ nid.hIcon = g_LoadIconEx(3);
+ nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
+ nid.uCallbackMessage = WM_YAMN_NOTIFYICON;
+ mir_sntprintf(nid.szTip, _T("%S%s"), ActualAccount->Name, TranslateT(" - connection error")); Shell_NotifyIcon(NIM_ADD, &nid);
+ }
+
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read done\n");
#endif
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index ada976daa0..498f96a54a 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -622,36 +622,35 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, DWORD nflags, DWORD nnflags) { - char *NotIconText = Translate("- new mail message(s)"); - NOTIFYICONDATA nid; - - memset(&nid, 0, sizeof(nid)); + NOTIFYICONDATA nid = {}; + nid.cbSize = sizeof(nid); + nid.hWnd = hDlg; if (MN->Real.EventNC + MN->Virtual.EventNC) NotifyEventHooks(hNewMailHook, 0, 0); - if ((nflags & YAMN_ACC_KBN) && (MN->Real.PopupRun + MN->Virtual.PopupRun)) { + if ((nflags & YAMN_ACC_KBN) && (MN->Real.PopupRun + MN->Virtual.PopupRun)) CallService(MS_KBDNOTIFY_STARTBLINK, (WPARAM)MN->Real.PopupNC + MN->Virtual.PopupNC, NULL); - } if ((nflags & YAMN_ACC_CONT) && (MN->Real.PopupRun + MN->Virtual.PopupRun)) { - char sMsg[250]; - mir_snprintf(sMsg, Translate("%s : %d new mail message(s), %d total"), ActualAccount->Name, MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); + TCHAR tszMsg[250]; + mir_sntprintf(tszMsg, TranslateT("%s : %d new mail message(s), %d total"), _A2T(ActualAccount->Name), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); + if (!(nflags & YAMN_ACC_CONTNOEVENT)) { CLISTEVENT evt = {};
+ evt.flags = CLEF_TCHAR;
evt.hContact = ActualAccount->hContact; evt.hIcon = g_LoadIconEx(2); evt.hDbEvent = ActualAccount->hContact; evt.lParam = ActualAccount->hContact; evt.pszService = MS_YAMN_CLISTDBLCLICK; - evt.pszTooltip = sMsg; + evt.ptszTooltip = tszMsg; pcli->pfnAddEvent(&evt); } - db_set_s(ActualAccount->hContact, "CList", "StatusMsg", sMsg); + db_set_ts(ActualAccount->hContact, "CList", "StatusMsg", tszMsg); - if (nflags & YAMN_ACC_CONTNICK) { - db_set_s(ActualAccount->hContact, YAMN_DBMODULE, "Nick", sMsg); - } + if (nflags & YAMN_ACC_CONTNICK) + db_set_ts(ActualAccount->hContact, YAMN_DBMODULE, "Nick", tszMsg); } if ((nflags & YAMN_ACC_POP) && @@ -679,14 +678,11 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D PUAddPopupT(&NewMailPopup); } - //destroy tray icon if no new mail - if ((MN->Real.SysTrayUC + MN->Virtual.SysTrayUC == 0) && (hDlg != NULL)) { - nid.hWnd = hDlg; - nid.uID = 0; + // destroy tray icon if no new mail + if ((MN->Real.SysTrayUC + MN->Virtual.SysTrayUC == 0) && (hDlg != NULL)) Shell_NotifyIcon(NIM_DELETE, &nid); - } - //and remove the event + // and remove the event if ((nflags & YAMN_ACC_CONT) && (!(nflags & YAMN_ACC_CONTNOEVENT)) && (MN->Real.UnSeen + MN->Virtual.UnSeen == 0)) pcli->pfnRemoveEvent(ActualAccount->hContact, ActualAccount->hContact); @@ -705,19 +701,10 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D SendDlgItemMessageW(hDlg, IDC_LISTMAILS, LVM_SCROLL, 0, (LPARAM)0x7ffffff); if ((nflags & YAMN_ACC_ICO) && (MN->Real.SysTrayUC + MN->Virtual.SysTrayUC)) { - char* src; - TCHAR *dest; - int i; - - for (src = ActualAccount->Name, dest = nid.szTip, i = 0; (*src != (TCHAR)0) && (i + 1 < sizeof(nid.szTip)); *dest++ = *src++); - for (src = NotIconText; (*src != (TCHAR)0) && (i + 1 < sizeof(nid.szTip)); *dest++ = *src++); - *dest = (TCHAR)0; - nid.cbSize = sizeof(NOTIFYICONDATA); - nid.hWnd = hDlg; nid.hIcon = g_LoadIconEx(2); - nid.uID = 0; nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; nid.uCallbackMessage = WM_YAMN_NOTIFYICON; + mir_sntprintf(nid.szTip, _T("%S %s"), ActualAccount->Name, TranslateT("- new mail message(s)")); Shell_NotifyIcon(NIM_ADD, &nid); SetTimer(hDlg, TIMER_FLASHING, 500, NULL); } |