diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-08-15 17:25:49 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-08-15 17:25:49 +0000 |
commit | b017d6e495ed9ed7c1ae781086b3f705ea8efed0 (patch) | |
tree | 949111512a198ff9aae9487f43e2155fabd78ba1 /plugins/NewEventNotify/src | |
parent | c97b20dc06e8d7c848e7ec20590243ffd5f011c4 (diff) |
translation fix and minor cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@5705 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewEventNotify/src')
-rw-r--r-- | plugins/NewEventNotify/src/main.cpp | 48 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/neweventnotify.h | 2 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/popup.cpp | 50 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/resource.h | 3 |
4 files changed, 23 insertions, 80 deletions
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index 82e282302c..80d3975a66 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -24,7 +24,6 @@ #include "neweventnotify.h"
-int g_IsSrmmServiceAvail = 0;
int g_IsSrmmWindowAPI = 0;
extern PLUGIN_DATA* PopupList[20];
@@ -64,7 +63,6 @@ int HookedNewEvent(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam;
PLUGIN_DATA* pdata;
- DBEVENTTYPEDESCR* pei;
//are popups currently enabled?
if (pluginOptions.bDisable)
@@ -85,7 +83,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM lParam) //custom database event types
if (ServiceExists(MS_DB_EVENT_GETTYPE))
{
- pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbe.szModule, (LPARAM)dbe.eventType);
+ DBEVENTTYPEDESCR *pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbe.szModule, (LPARAM)dbe.eventType);
if (pei && pei->cbSize >= DBEVENTTYPEDESCR_SIZE && pei->flags & DETF_NONOTIFY)
// ignore events according to flags
return 0;
@@ -125,7 +123,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM lParam) }
//---Called when all the modules are loaded
-int HookedInit(WPARAM wParam, LPARAM lParam)
+int HookedInit(WPARAM, LPARAM)
{
hHookedNewEvent = HookEvent(ME_DB_EVENT_ADDED, HookedNewEvent);
// Plugin sweeper support
@@ -137,11 +135,6 @@ int HookedInit(WPARAM wParam, LPARAM lParam) else
g_IsSrmmWindowAPI = 0;
- if (ServiceExists(MS_MSG_MOD_MESSAGEDIALOGOPENED))
- g_IsSrmmServiceAvail = 1;
- else
- g_IsSrmmServiceAvail = 0;
-
return 0;
}
@@ -215,41 +208,4 @@ int CheckMsgWnd(HANDLE hContact) if (mwd.hwndWindow != NULL && (mwd.uState & MSG_WINDOW_STATE_EXISTS)) return 1;
}
}
- if (g_IsSrmmServiceAvail) { // use the service provided by tabSRMM
- if (CallService(MS_MSG_MOD_MESSAGEDIALOGOPENED, (WPARAM)hContact, 0))
- return 1;
- else
- return 0;
- }
- else
- { // old way: find it by using the window class & title
- TCHAR newtitle[256];
- char *szProto;
- TCHAR *contactName, *szStatus;
-
- szProto = GetContactProto(hContact);
- contactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
- szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto?db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE):ID_STATUS_OFFLINE, GSMDF_TCHAR);
-
- // vj: This code was added by preeze and it does not work:
- // vlko: it maybe work with other plugins
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s)"), contactName, szStatus);
- if(FindWindow(_T("TMsgWindow"), newtitle))
- return 2;
-
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("[%s (%s)]"), contactName, szStatus);
- if(FindWindow(_T("TfrmContainer"), newtitle))
- return 1;
-
- // vj: I have restored this code from original plugin's source: (NewEventNotify 0.0.4)
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message Session"));
- if(FindWindow(_T("#32770"), newtitle)) // JK, this works for old SRMMs (1.0.4.x) and for mine SRMMJ
- return 1;
-
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message Received"));
- if(FindWindow(_T("#32770"), newtitle))
- return 2;
-
- return 0;
- }
}
\ No newline at end of file diff --git a/plugins/NewEventNotify/src/neweventnotify.h b/plugins/NewEventNotify/src/neweventnotify.h index 28ad7c817a..6884cb121d 100644 --- a/plugins/NewEventNotify/src/neweventnotify.h +++ b/plugins/NewEventNotify/src/neweventnotify.h @@ -52,8 +52,6 @@ #define MS_NEN_MENUNOTIFY "NewEventNotify/MenuitemNotifyCommand"
//VERY_PUBLIC End
-#define MS_MSG_MOD_MESSAGEDIALOGOPENED "SRMsg_MOD/MessageDialogOpened"
-
//---------------------------
//---Definitions
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 81edaf7c90..65bb908966 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -125,11 +125,9 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata) return 0;
}
-static BOOL CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- PLUGIN_DATA* pdata = NULL;
-
- pdata = (PLUGIN_DATA*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)pdata);
+ PLUGIN_DATA *pdata = (PLUGIN_DATA*)PUGetPluginData(hWnd);
if (!pdata) return FALSE;
switch (message) {
@@ -384,8 +382,6 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UINT eventType)
{
- PLUGIN_DATA* pdata;
- EVENT_DATA_EX* eventData;
TCHAR* sampleEvent;
long iSeconds;
@@ -447,7 +443,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN db_event_get(hEvent, &dbe);
}
- eventData = (EVENT_DATA_EX*)mir_alloc(sizeof(EVENT_DATA_EX));
+ EVENT_DATA_EX *eventData = (EVENT_DATA_EX*)mir_alloc(sizeof(EVENT_DATA_EX));
eventData->hEvent = hEvent;
eventData->number = 1;
eventData->next = NULL;
@@ -458,7 +454,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN hContact = DbGetAuthEventContact(&dbe);
// set plugin_data ... will be usable within PopupDlgProc
- pdata = (PLUGIN_DATA*)mir_alloc(sizeof(PLUGIN_DATA));
+ PLUGIN_DATA *pdata = (PLUGIN_DATA*)mir_alloc(sizeof(PLUGIN_DATA));
pdata->eventType = eventType;
pdata->hContact = hContact;
pdata->pluginOptions = pluginOptions;
@@ -469,20 +465,18 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN // finally create the popup
pudw.lchContact = hContact;
- pudw.PluginWindowProc = (WNDPROC)PopupDlgProc;
+ pudw.PluginWindowProc = PopupDlgProc;
pudw.PluginData = pdata;
// if hContact is NULL, && hEvent is NULL then popup is only Test
if ((hContact == NULL) && (hEvent == NULL)) {
- _tcsncpy((TCHAR*)pudw.lptzContactName, TranslateT("Plugin Test"), MAX_CONTACTNAME);
- _tcsncpy((TCHAR*)pudw.lptzText, TranslateTS(sampleEvent), MAX_SECONDLINE);
+ _tcsncpy(pudw.lptzContactName, TranslateT("Plugin Test"), MAX_CONTACTNAME);
+ _tcsncpy(pudw.lptzText, TranslateTS(sampleEvent), MAX_SECONDLINE);
}
else { // get the needed event data
- TCHAR* szEventPreview;
-
- _tcsncpy((TCHAR*)pudw.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR), MAX_CONTACTNAME);
- szEventPreview = GetEventPreview(&dbe);
- _tcsncpy((TCHAR*)pudw.lptzText, szEventPreview, MAX_SECONDLINE);
+ _tcsncpy(pudw.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR), MAX_CONTACTNAME);
+ TCHAR *szEventPreview = GetEventPreview(&dbe);
+ _tcsncpy(pudw.lptzText, szEventPreview, MAX_SECONDLINE);
mir_free(szEventPreview);
}
@@ -493,7 +487,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN if (ServiceExists(MS_POPUP_ADDPOPUPT))
{
- if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pudw, 0) < 0)
+ if (PUAddPopupW(&pudw) < 0)
{ // popup creation failed, release popupdata
FreePopupEventData(pdata);
mir_free(pdata);
@@ -508,15 +502,8 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN int PopupUpdate(HANDLE hContact, HANDLE hEvent)
{
- PLUGIN_DATA* pdata;
- DBEVENTINFO dbe = {0};
- EVENT_DATA_EX* eventData;
- TCHAR lpzText[MAX_SECONDLINE*2] = _T("\0\0");
- int iEvent = 0;
- int doReverse = 0;
-
// merge only message popups
- pdata = (PLUGIN_DATA*)PopupList[NumberPopupData(hContact, EVENTTYPE_MESSAGE)];
+ PLUGIN_DATA *pdata = (PLUGIN_DATA*)PopupList[NumberPopupData(hContact, EVENTTYPE_MESSAGE)];
if (hEvent) {
pdata->countEvent++;
@@ -534,18 +521,20 @@ int PopupUpdate(HANDLE hContact, HANDLE hEvent) SetTimer(pdata->hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, NULL);
}
+ TCHAR lpzText[MAX_SECONDLINE*2] = _T("\0\0");
if (pdata->pluginOptions->bShowHeaders)
- mir_sntprintf(lpzText, SIZEOF(lpzText), _T("[b]%s %d[/b]\n"), TranslateT("Number of new message: "), pdata->countEvent);
+ mir_sntprintf(lpzText, SIZEOF(lpzText), TranslateT("[b]Number of new message(s): %d[/b]\n"), pdata->countEvent);
- doReverse = pdata->pluginOptions->bShowON;
+ int doReverse = pdata->pluginOptions->bShowON;
if ((pdata->firstShowEventData != pdata->firstEventData && doReverse) || (pdata->firstShowEventData != pdata->lastEventData && !doReverse))
mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s...\n"), lpzText);
//take the active event as starting one
- eventData = pdata->firstShowEventData;
+ EVENT_DATA_EX *eventData = pdata->firstShowEventData;
- while (TRUE) {
+ int iEvent = 0;
+ while (true) {
if (iEvent) {
if (doReverse)
eventData = eventData->next;
@@ -554,6 +543,7 @@ int PopupUpdate(HANDLE hContact, HANDLE hEvent) }
iEvent++;
//get DBEVENTINFO with pBlob if preview is needed (when is test then is off)
+ DBEVENTINFO dbe = {0};
dbe.cbSize = sizeof(dbe);
dbe.pBlob = NULL;
dbe.cbBlob = 0;
@@ -597,7 +587,7 @@ int PopupUpdate(HANDLE hContact, HANDLE hEvent) if ((doReverse && eventData->next) || (!doReverse && eventData->prev))
mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s\n..."), lpzText);
- CallService(MS_POPUP_CHANGETEXTT, (WPARAM)pdata->hWnd, (LPARAM)lpzText);
+ PUChangeTextT(pdata->hWnd, lpzText);
return 0;
}
diff --git a/plugins/NewEventNotify/src/resource.h b/plugins/NewEventNotify/src/resource.h index 1146a3bfab..f0bd14a536 100644 --- a/plugins/NewEventNotify/src/resource.h +++ b/plugins/NewEventNotify/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by resource.rc
+// Used by ..\res\resource.rc
//
#define IDD_OPT 101
#define IDI_ENABLED 106
@@ -61,7 +61,6 @@ #define IDC_CHKACTTE_DISMISS 1049
#define IDC_CHKACTTE_OPEN 1050
#define IDC_CHKACTTE_REMOVE 1051
-#define IDC_STATIC -1
// Next default values for new objects
//
|