summaryrefslogtreecommitdiff
path: root/plugins/SMS/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-05 23:13:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-05 23:13:56 +0000
commit4810d4b1b7a47701b8e6c45490fb2643ea425123 (patch)
treefb94dd5889fdd0558605ffe738f0b2d6d2f08ca2 /plugins/SMS/src
parent007b4c7301f0d26a72f89f74e9929f42e24eb3e6 (diff)
rest of menu cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@4325 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SMS/src')
-rw-r--r--plugins/SMS/src/SMSConstans.h9
-rw-r--r--plugins/SMS/src/SMS_svc.cpp94
-rw-r--r--plugins/SMS/src/common.h10
-rw-r--r--plugins/SMS/src/main.cpp26
4 files changed, 34 insertions, 105 deletions
diff --git a/plugins/SMS/src/SMSConstans.h b/plugins/SMS/src/SMSConstans.h
index 06ae75a3ff..d20ce5dc1d 100644
--- a/plugins/SMS/src/SMSConstans.h
+++ b/plugins/SMS/src/SMSConstans.h
@@ -78,12 +78,9 @@ struct SERVICE_ITEM
static const SERVICE_ITEM siPluginServices[] =
{
- { SMS_READ, ReadMsgSMS },
- { SMS_READ_ACK, ReadAckSMS },
- { SMS_SEND, SendSMSMenuCommand },
+ { SMS_READ, ReadMsgSMS },
+ { SMS_READ_ACK, ReadAckSMS },
+ { SMS_SEND, SendSMSMenuCommand },
};
-
-
-
#endif // !defined(AFX_SMS_CONSTANS_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp
index cff9a72946..14df262de2 100644
--- a/plugins/SMS/src/SMS_svc.cpp
+++ b/plugins/SMS/src/SMS_svc.cpp
@@ -19,105 +19,61 @@ int LoadServices(void)
int LoadModules(void)
{
- ssSMSSettings.hHookOptInitialize=HookEvent(ME_OPT_INITIALISE,OptInitialise);
- ssSMSSettings.hHookRebuildCMenu=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,SmsRebuildContactMenu);
- ssSMSSettings.hHookProtoAck=HookEvent(ME_PROTO_ACK,handleAckSMS);
- ssSMSSettings.hHookDbAdd=HookEvent(ME_DB_EVENT_ADDED,handleNewMessage);
- ssSMSSettings.hHookAccListChanged=HookEvent(ME_PROTO_ACCLISTCHANGED,RefreshAccountList);
-
-
- CLISTMENUITEM mi={0};
- CHAR szServiceFunction[MAX_PATH];
+ HookEvent(ME_OPT_INITIALISE,OptInitialise);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU,SmsRebuildContactMenu);
+ HookEvent(ME_PROTO_ACK,handleAckSMS);
+ HookEvent(ME_DB_EVENT_ADDED,handleNewMessage);
+ HookEvent(ME_PROTO_ACCLISTCHANGED,RefreshAccountList);
+ CHAR szServiceFunction[MAX_PATH];
mir_snprintf(szServiceFunction,sizeof(szServiceFunction),"%s%s",PROTOCOL_NAMEA,SMS_SEND);
- mi.cbSize=sizeof(mi);
- mi.position=300050000;
- mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS);
- mi.ptszName=SMS_SEND_STR;
- mi.pszService=szServiceFunction;
- mi.flags=CMIF_TCHAR;
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = 300050000;
+ mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMS);
+ mi.ptszName = SMS_SEND_STR;
+ mi.pszService = szServiceFunction;
+ mi.flags = CMIF_TCHAR;
Menu_AddMainMenuItem(&mi);
- mi.position=-2000070000;
- mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS);
- mi.ptszName=SMS_SEND_CM_STR;
- mi.pszService=szServiceFunction;
- mi.flags=CMIF_TCHAR;
- ssSMSSettings.hContactMenuItems[0]=Menu_AddContactMenuItem(&mi);
+ mi.position = -2000070000;
+ mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMS);
+ mi.ptszName = SMS_SEND_CM_STR;
+ mi.pszService = szServiceFunction;
+ mi.flags = CMIF_TCHAR;
+ ssSMSSettings.hContactMenuItems[0] = Menu_AddContactMenuItem(&mi);
SkinAddNewSoundEx("RecvSMSMsg",PROTOCOL_NAMEA,LPGEN("Incoming SMS Message"));
SkinAddNewSoundEx("RecvSMSConfirmation",PROTOCOL_NAMEA,LPGEN("Incoming SMS Confirmation"));
-
RefreshAccountList(NULL,NULL);
RestoreUnreadMessageAlerts();
-
return 0;
}
-
-void UnloadModules()
-{
- // Main menu destroy
- //CListDestroyMenu(gdiMenuItems,SIZEOF(gdiMenuItems));
- //ZeroMemory(masMraSettings.hMainMenuItems,sizeof(masMraSettings.hMainMenuItems));
-
- // Contact menu destroy
- //CListDestroyMenu(gdiContactMenuItems,(SIZEOF(gdiContactMenuItems) - ((masMraSettings.heNudgeReceived==NULL)? 0:1)));
- //ZeroMemory(masMraSettings.hContactMenuItems,sizeof(masMraSettings.hContactMenuItems));
-
- if (ssSMSSettings.hHookAccListChanged) {UnhookEvent(ssSMSSettings.hHookAccListChanged); ssSMSSettings.hHookAccListChanged=NULL;}
- if (ssSMSSettings.hHookDbAdd) {UnhookEvent(ssSMSSettings.hHookDbAdd); ssSMSSettings.hHookDbAdd=NULL;}
- if (ssSMSSettings.hHookProtoAck) {UnhookEvent(ssSMSSettings.hHookProtoAck); ssSMSSettings.hHookProtoAck=NULL;}
- if (ssSMSSettings.hHookRebuildCMenu) {UnhookEvent(ssSMSSettings.hHookRebuildCMenu); ssSMSSettings.hHookRebuildCMenu=NULL;}
- if (ssSMSSettings.hHookOptInitialize) {UnhookEvent(ssSMSSettings.hHookOptInitialize); ssSMSSettings.hHookOptInitialize=NULL;}
-
- //IconsUnLoad();
-
-}
-
-
-void UnloadServices()
-{
- CHAR szServiceFunction[MAX_PATH],*pszServiceFunctionName;
-
- CopyMemory(szServiceFunction,PROTOCOL_NAMEA,PROTOCOL_NAME_SIZE);
- pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN;
-
- // destroy plugin services
- for (SIZE_T i=0;i<SIZEOF(siPluginServices);i++)
- {
- CopyMemory(pszServiceFunctionName,siPluginServices[i].lpszName,(lstrlenA(siPluginServices[i].lpszName)+1));
- DestroyServiceFunction(szServiceFunction);
- }
-}
-
-
-
int SmsRebuildContactMenu(WPARAM wParam,LPARAM lParam)
{
Menu_ShowItem(ssSMSSettings.hContactMenuItems[0], GetContactPhonesCount((HANDLE)wParam));
return 0;
}
-
//This function called when user clicked Menu.
int SendSMSMenuCommand(WPARAM wParam,LPARAM lParam)
{
HWND hwndSendSms;
- if (wParam)
- {// user clicked on the "SMS Message" on one of the users
- hwndSendSms=SendSMSWindowIsOtherInstanceHContact((HANDLE)wParam);
+ // user clicked on the "SMS Message" on one of the users
+ if (wParam) {
+ hwndSendSms = SendSMSWindowIsOtherInstanceHContact((HANDLE)wParam);
if (hwndSendSms)
SetFocus(hwndSendSms);
else
- hwndSendSms=SendSMSWindowAdd((HANDLE)wParam);
+ hwndSendSms = SendSMSWindowAdd((HANDLE)wParam);
}
- else{// user clicked on the "SMS Send" in the Main Menu
- hwndSendSms=SendSMSWindowAdd(NULL);
+ // user clicked on the "SMS Send" in the Main Menu
+ else{
+ hwndSendSms = SendSMSWindowAdd(NULL);
EnableWindow(GetDlgItem(hwndSendSms,IDC_NAME),TRUE);
EnableWindow(GetDlgItem(hwndSendSms,IDC_SAVENUMBER),FALSE);
diff --git a/plugins/SMS/src/common.h b/plugins/SMS/src/common.h
index b0c3366480..e88b11c131 100644
--- a/plugins/SMS/src/common.h
+++ b/plugins/SMS/src/common.h
@@ -59,14 +59,6 @@ typedef struct
HGENMENU hMainMenuItems[MAIN_MENU_ITEMS_COUNT+1];
HGENMENU hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+1];
- HANDLE hHookModulesLoaded;
- HANDLE hHookPreShutdown;
- HANDLE hHookOptInitialize;
- HANDLE hHookRebuildCMenu;
- HANDLE hHookDbAdd;
- HANDLE hHookProtoAck;
- HANDLE hHookAccListChanged;
-
LIST_MT lmtSendSMSWindowsListMT;
LIST_MT lmtRecvSMSWindowsListMT;
@@ -155,8 +147,6 @@ int OptInitialise(WPARAM wParam,LPARAM lParam);
int LoadServices();
int LoadModules();
-void UnloadModules();
-void UnloadServices();
int handleAckSMS(WPARAM wParam,LPARAM lParam);
int handleNewMessage(WPARAM wParam,LPARAM lParam);
diff --git a/plugins/SMS/src/main.cpp b/plugins/SMS/src/main.cpp
index 0d8d9de589..d2a846e5e1 100644
--- a/plugins/SMS/src/main.cpp
+++ b/plugins/SMS/src/main.cpp
@@ -80,8 +80,8 @@ extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
- ssSMSSettings.hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,OnModulesLoaded);
- ssSMSSettings.hHookPreShutdown=HookEvent(ME_SYSTEM_PRESHUTDOWN,OnPreShutdown);
+ HookEvent(ME_SYSTEM_MODULESLOADED,OnModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN,OnPreShutdown);
SendSMSWindowInitialize();
RecvSMSWindowInitialize();
@@ -93,11 +93,6 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
- UnloadServices();
-
- if (ssSMSSettings.hHookPreShutdown) {UnhookEvent(ssSMSSettings.hHookPreShutdown); ssSMSSettings.hHookPreShutdown=NULL;}
- if (ssSMSSettings.hHookModulesLoaded) {UnhookEvent(ssSMSSettings.hHookModulesLoaded); ssSMSSettings.hHookModulesLoaded=NULL;}
-
return 0;
}
@@ -112,8 +107,6 @@ int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
int OnPreShutdown(WPARAM wParam,LPARAM lParam)
{
- UnloadModules();
-
RecvSMSWindowDestroy();
SendSMSWindowDestroy();
FreeAccountList();
@@ -126,24 +119,17 @@ void VersionConversions()
WCHAR wsztm[MAX_PATH];
if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,SIZEOF(wsztm),NULL))
- {
DB_SMS_SetByte(NULL,"UseSignature",(wsztm[0]=='0'));
- }else{
+ else
DB_SMS_SetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE);
- }
if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,SIZEOF(wsztm),NULL))
- {
DB_SMS_SetByte(NULL,"SignaturePos",(wsztm[0]=='0'));
- }else{
+ else
DB_SMS_SetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS);
- }
if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,SIZEOF(wsztm),NULL))
- {
DB_SMS_SetByte(NULL,"ShowACK",(wsztm[0]=='0'));
- }else{
+ else
DB_SMS_SetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK);
- }
-
-} \ No newline at end of file
+}