diff options
| -rw-r--r-- | plugins/NewEventNotify/neweventnotify_10.vcxproj | 4 | ||||
| -rw-r--r-- | plugins/NewEventNotify/neweventnotify_10.vcxproj.filters | 8 | ||||
| -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 | 
6 files changed, 35 insertions, 80 deletions
| diff --git a/plugins/NewEventNotify/neweventnotify_10.vcxproj b/plugins/NewEventNotify/neweventnotify_10.vcxproj index 2a720351b9..c3981ccb14 100644 --- a/plugins/NewEventNotify/neweventnotify_10.vcxproj +++ b/plugins/NewEventNotify/neweventnotify_10.vcxproj @@ -201,6 +201,10 @@      <ResourceCompile Include="res\resource.rc" />
      <ResourceCompile Include="res\Version.rc" />
    </ItemGroup>
 +  <ItemGroup>
 +    <None Include="res\popup.ico" />
 +    <None Include="res\popup_no.ico" />
 +  </ItemGroup>
    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
    <ImportGroup Label="ExtensionTargets">
    </ImportGroup>
 diff --git a/plugins/NewEventNotify/neweventnotify_10.vcxproj.filters b/plugins/NewEventNotify/neweventnotify_10.vcxproj.filters index 6c7552515c..13b8486777 100644 --- a/plugins/NewEventNotify/neweventnotify_10.vcxproj.filters +++ b/plugins/NewEventNotify/neweventnotify_10.vcxproj.filters @@ -50,4 +50,12 @@        <Filter>Resource Files</Filter>
      </ResourceCompile>
    </ItemGroup>
 +  <ItemGroup>
 +    <None Include="res\popup.ico">
 +      <Filter>Resource Files</Filter>
 +    </None>
 +    <None Include="res\popup_no.ico">
 +      <Filter>Resource Files</Filter>
 +    </None>
 +  </ItemGroup>
  </Project>
\ No newline at end of file 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
  // 
 | 
