diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2014-02-23 21:28:06 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2014-02-23 21:28:06 +0000 |
commit | a8a5cfd818bcf099c5a0f5bd018d1d596a0d533b (patch) | |
tree | 10099d3253e06d291263553e587945991f89aaa9 /plugins | |
parent | 5324ca994e91397adba4e620fe31459dc86e2e75 (diff) |
-minor fixes for NewAwaySystem
git-svn-id: http://svn.miranda-ng.org/main/trunk@8239 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/NewAwaySysMod/res/NewAwaySys.rc | 28 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/AwayOpt.cpp | 10 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/AwaySys.cpp | 90 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Common.h | 40 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/ContactList.cpp | 4 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 8 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Notification.cpp | 6 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Options.cpp | 16 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Properties.cpp | 2 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Properties.h | 2 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/ReadAwayMsg.cpp | 2 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Services.cpp | 8 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 2 |
13 files changed, 94 insertions, 124 deletions
diff --git a/plugins/NewAwaySysMod/res/NewAwaySys.rc b/plugins/NewAwaySysMod/res/NewAwaySys.rc index 4e79555c42..de46f7ef9a 100644 --- a/plugins/NewAwaySysMod/res/NewAwaySys.rc +++ b/plugins/NewAwaySysMod/res/NewAwaySys.rc @@ -600,20 +600,20 @@ END // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-IDI_MSGICON ICON DISCARDABLE "res\\MsgIcon.ico"
-IDI_SOE_ENABLED ICON DISCARDABLE "res\\on.ico"
-IDI_SOE_DISABLED ICON DISCARDABLE "res\\off.ico"
-IDI_DOT ICON DISCARDABLE "res\\Dot.ico"
-IDI_IGNORE ICON DISCARDABLE "res\\Ignore.ico"
-IDI_SAVE ICON DISCARDABLE "res\\SaveMsg.ico"
-IDI_SAVEASNEW ICON DISCARDABLE "res\\SaveAsNew.ico"
-IDI_DELETE ICON DISCARDABLE "res\\Delete.ico"
-IDI_NEWCATEGORY ICON DISCARDABLE "res\\NewCat.ico"
-IDI_VARIABLES ICON DISCARDABLE "res\\Variables.ico"
-IDI_NEWMESSAGE ICON DISCARDABLE "res\\NewMessage.ico"
-IDI_SETTINGS ICON DISCARDABLE "res\\Settings.ico"
-IDI_STATUS_OTHER ICON DISCARDABLE "res\\Status_Other.ico"
-IDI_INDEFINITE ICON DISCARDABLE "res\\Indefinite.ico"
+IDI_MSGICON ICON DISCARDABLE "MsgIcon.ico"
+IDI_SOE_ENABLED ICON DISCARDABLE "on.ico"
+IDI_SOE_DISABLED ICON DISCARDABLE "off.ico"
+IDI_DOT ICON DISCARDABLE "Dot.ico"
+IDI_IGNORE ICON DISCARDABLE "Ignore.ico"
+IDI_SAVE ICON DISCARDABLE "SaveMsg.ico"
+IDI_SAVEASNEW ICON DISCARDABLE "SaveAsNew.ico"
+IDI_DELETE ICON DISCARDABLE "Delete.ico"
+IDI_NEWCATEGORY ICON DISCARDABLE "NewCat.ico"
+IDI_VARIABLES ICON DISCARDABLE "Variables.ico"
+IDI_NEWMESSAGE ICON DISCARDABLE "NewMessage.ico"
+IDI_SETTINGS ICON DISCARDABLE "Settings.ico"
+IDI_STATUS_OTHER ICON DISCARDABLE "Status_Other.ico"
+IDI_INDEFINITE ICON DISCARDABLE "Indefinite.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp index 6a39066c0b..732055aac4 100644 --- a/plugins/NewAwaySysMod/src/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp @@ -169,7 +169,7 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (Dlg1Buttons[i].IconIndex != ILI_NOICON)
SendDlgItemMessage(hwndDlg, Dlg1Buttons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg1Buttons[i].IconIndex]);
- my_variables_skin_helpbutton(hwndDlg, IDC_MESSAGEDLG_VARS);
+ variables_skin_helpbutton(hwndDlg, IDC_MESSAGEDLG_VARS);
break;
case WM_NOTIFY:
@@ -576,7 +576,7 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l for (int i = 0; i < SIZEOF(Dlg3StatusButtons); i++)
SendDlgItemMessage(hwndDlg, Dlg3StatusButtons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg3StatusButtons[i].IconIndex]);
- my_variables_skin_helpbutton(hwndDlg, IDC_REPLYDLG_VARS);
+ variables_skin_helpbutton(hwndDlg, IDC_REPLYDLG_VARS);
SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_EVNTMSG, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[ILI_EVENT_MESSAGE]);
SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_EVNTURL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[ILI_EVENT_URL]);
SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_EVNTFILE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[ILI_EVENT_FILE]);
@@ -724,7 +724,7 @@ INT_PTR CALLBACK MessagesModernOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPA if (Dlg4Buttons[i].IconIndex != ILI_NOICON)
SendDlgItemMessage(hwndDlg, Dlg4Buttons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg4Buttons[i].IconIndex]);
- my_variables_skin_helpbutton(hwndDlg, IDC_MESSAGEDLG_VARS);
+ variables_skin_helpbutton(hwndDlg, IDC_MESSAGEDLG_VARS);
break;
case WM_NOTIFY:
@@ -1233,7 +1233,7 @@ INT_PTR CALLBACK ContactsOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP return 0;
}
-int OptsDlgInit(WPARAM wParam, LPARAM lParam)
+int OptsDlgInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE optDi = { sizeof(optDi) };
optDi.position = 920000000;
@@ -1287,7 +1287,7 @@ void InitOptions() TreeRootItemArray RootItems;
RootItems.AddElem(CTreeRootItem(TranslateT("Predefined messages"), g_Messages_PredefinedRootID = ID++, TIF_EXPANDED));
RootItems.AddElem(CTreeRootItem(TranslateT("Recent messages"), g_Messages_RecentRootID = ID++, TIF_EXPANDED));
- DefMsgTree.AddElem(CTreeItem(TranslateT("Gone fragging"), g_Messages_PredefinedRootID, ID++, 0, TranslateTS(_T("Been fragging since %") _T(VAR_AWAYSINCE_TIME) _T("%, i'll msg you later when the adrenaline wears off."))));
+ DefMsgTree.AddElem(CTreeItem(TranslateT("Gone fragging"), g_Messages_PredefinedRootID, ID++, 0, TranslateT("Been fragging since %nas_awaysince_time%, i'll msg you later when the adrenaline wears off.")));
DefMsgTree.AddElem(CTreeItem(TranslateT("Creepy"), g_Messages_PredefinedRootID, ID++, 0, TranslateT("Your master, %nas_mynick%, has been %nas_statdesc% since the day that is only known as ?nas_awaysince_date(dddd)... When he gets back, i'll tell him you dropped by...")));
DefMsgTree.AddElem(CTreeItem(TranslateT("Default messages"), g_Messages_PredefinedRootID, ParentID1 = ID++, TIF_GROUP | TIF_EXPANDED));
g_MsgTreePage.Items.AddElem(new COptItem_IntDBSetting(IDS_MESSAGEDLG_DEF_ONL, StatusToDBSetting(ID_STATUS_ONLINE, MESSAGES_DB_MSGTREEDEF), DBVT_WORD, false, ID));
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index 77463950e8..a970746d03 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -102,16 +102,11 @@ TCString GetDynamicStatMsg(MCONTACT hContact, char *szProto, DWORD UIN, int iSta VarParseData.Message = CProtoSettings(szProto, iStatus).GetMsgFormat(iStatus ? GMF_LASTORDEFAULT : GMF_ANYCURRENT);
TCString sTime;
- VarParseData.szProto = szProto ? szProto : ((hContact && hContact != INVALID_CONTACT_ID) ? (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0) : NULL);
+ VarParseData.szProto = szProto ? szProto : ((hContact && hContact != INVALID_CONTACT_ID) ? GetContactProto(hContact) : NULL);
VarParseData.UIN = UIN;
VarParseData.Flags = 0;
if (ServiceExists(MS_VARS_FORMATSTRING) && !g_SetAwayMsgPage.GetDBValueCopy(IDS_SAWAYMSG_DISABLEVARIABLES)) {
- FORMATINFO fi = { 0 };
- fi.cbSize = sizeof(fi);
- fi.tszFormat = VarParseData.Message;
- fi.hContact = hContact;
- fi.flags = FIF_TCHAR;
- TCHAR *szResult = (TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ TCHAR *szResult = variables_parse(VarParseData.Message, 0, hContact);
if (szResult) {
VarParseData.Message = szResult;
mir_free(szResult);
@@ -129,7 +124,7 @@ int StatusMsgReq(WPARAM wParam, LPARAM lParam, CString &szProto) char *szFoundProto;
MCONTACT hFoundContact = NULL; // if we'll find the contact only on some other protocol, but not on szProto, then we'll use that hContact.
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- char *szCurProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ char *szCurProto = GetContactProto(hContact);
if (db_get_dw(hContact, szCurProto, "UIN", 0) == lParam) {
szFoundProto = szCurProto;
hFoundContact = hContact;
@@ -296,7 +291,7 @@ int StatusChanged(WPARAM wParam, LPARAM lParam) #define ID_STATUS_DISABLED 41083
// wParam = PROTOCOLSETTINGEX** protoSettings
-int CSStatusChange(WPARAM wParam, LPARAM lParam) // CommonStatus plugins (StartupStatus and AdvancedAutoAway)
+int CSStatusChange(WPARAM wParam, LPARAM) // CommonStatus plugins (StartupStatus and AdvancedAutoAway)
{
PROTOCOLSETTINGEX **ps = *(PROTOCOLSETTINGEX***)wParam;
if (!ps)
@@ -316,7 +311,7 @@ int CSStatusChange(WPARAM wParam, LPARAM lParam) // CommonStatus plugins (Startu return 0;
}
-static int IdleChangeEvent(WPARAM wParam, LPARAM lParam)
+static int IdleChangeEvent(WPARAM, LPARAM lParam)
{
LogMessage("ME_IDLE_CHANGED event. lParam=0x%x", lParam); // yes, we don't do anything with status message changes on idle.. there seems to be no any good solution for the wrong status message issue :(
g_bIsIdle = lParam & IDF_ISIDLE;
@@ -324,13 +319,13 @@ static int IdleChangeEvent(WPARAM wParam, LPARAM lParam) }
// wParam = numAccs
-int CSModuleLoaded(WPARAM wParam, LPARAM lParam) // StartupStatus and AdvancedAutoAway
+int CSModuleLoaded(WPARAM wParam, LPARAM) // StartupStatus and AdvancedAutoAway
{
g_CSProtoCount = wParam;
return 0;
}
-int PreBuildContactMenu(WPARAM hContact, LPARAM lParam)
+int PreBuildContactMenu(WPARAM hContact, LPARAM)
{
char *szProto = GetContactProto(hContact);
CLISTMENUITEM miSetMsg = { sizeof(miSetMsg) };
@@ -394,7 +389,7 @@ int PreBuildContactMenu(WPARAM hContact, LPARAM lParam) }
-static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM lParam)
+static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM)
{
if (g_SetAwayMsgPage.GetWnd()) { // already setting something
SetForegroundWindow(g_SetAwayMsgPage.GetWnd());
@@ -410,7 +405,7 @@ static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM lParam) return 0;
}
-INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM lParam)
+INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM)
{
// used only for the global setting
CContactSettings(g_ProtoStates[hContact ? GetContactProto(hContact) : NULL].Status, hContact).Autoreply.Toggle();
@@ -432,25 +427,25 @@ INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM lParam) return 0;
}
-INT_PTR srvAutoreplyOn(WPARAM hContact, LPARAM lParam)
+INT_PTR srvAutoreplyOn(WPARAM hContact, LPARAM)
{
CContactSettings(g_ProtoStates[GetContactProto(hContact)].Status, hContact).Autoreply = 1;
return 0;
}
-INT_PTR srvAutoreplyOff(WPARAM hContact, LPARAM lParam)
+INT_PTR srvAutoreplyOff(WPARAM hContact, LPARAM)
{
CContactSettings(g_ProtoStates[GetContactProto(hContact)].Status, hContact).Autoreply = 0;
return 0;
}
-INT_PTR srvAutoreplyUseDefault(WPARAM hContact, LPARAM lParam)
+INT_PTR srvAutoreplyUseDefault(WPARAM hContact, LPARAM)
{
CContactSettings(g_ProtoStates[GetContactProto(hContact)].Status, hContact).Autoreply = VAL_USEDEFAULT;
return 0;
}
-static int Create_TopToolbar(WPARAM wParam, LPARAM lParam)
+static int Create_TopToolbar(WPARAM, LPARAM)
{
int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply;
if (ServiceExists(MS_TTB_REMOVEBUTTON)) {
@@ -469,7 +464,7 @@ static int Create_TopToolbar(WPARAM wParam, LPARAM lParam) return 0;
}
-static int IconsChanged(WPARAM wParam, LPARAM lParam)
+static int IconsChanged(WPARAM, LPARAM)
{
g_IconList.ReloadIcons();
@@ -484,7 +479,7 @@ static int IconsChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-static int ContactSettingsInit(WPARAM wParam, LPARAM lParam)
+static int ContactSettingsInit(WPARAM wParam, LPARAM)
{
CONTACTSETTINGSINIT *csi = (CONTACTSETTINGSINIT*)wParam;
char *szProto = (csi->Type == CSIT_CONTACT) ? GetContactProto(csi->hContact) : NULL;
@@ -548,23 +543,23 @@ static int ContactSettingsInit(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR srvVariablesHandler(WPARAM wParam, LPARAM lParam)
+INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam)
{
ARGUMENTSINFO *ai = (ARGUMENTSINFO*)lParam;
ai->flags = AIF_DONTPARSE;
TCString Result;
- if (!lstrcmp(ai->targv[0], _T(VAR_AWAYSINCE_TIME))) {
+ if (!lstrcmp(ai->targv[0], VAR_AWAYSINCE_TIME)) {
GetTimeFormat(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT), 0, g_ProtoStates[VarParseData.szProto].AwaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : _T("H:mm"), Result.GetBuffer(256), 256);
Result.ReleaseBuffer();
}
- else if (!lstrcmp(ai->targv[0], _T(VAR_AWAYSINCE_DATE))) {
+ else if (!lstrcmp(ai->targv[0], VAR_AWAYSINCE_DATE)) {
GetDateFormat(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT), 0, g_ProtoStates[VarParseData.szProto].AwaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : NULL, Result.GetBuffer(256), 256);
Result.ReleaseBuffer();
}
- else if (!lstrcmp(ai->targv[0], _T(VAR_STATDESC))) {
+ else if (!lstrcmp(ai->targv[0], VAR_STATDESC)) {
Result = (VarParseData.Flags & VPF_XSTATUS) ? STR_XSTATUSDESC : pcli->pfnGetStatusModeDescription(g_ProtoStates[VarParseData.szProto].Status, 0);
}
- else if (!lstrcmp(ai->targv[0], _T(VAR_MYNICK))) {
+ else if (!lstrcmp(ai->targv[0], VAR_MYNICK)) {
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_MYNICKPERPROTO) && VarParseData.szProto)
Result = db_get_s(NULL, VarParseData.szProto, "Nick", (TCHAR*)NULL);
@@ -574,15 +569,15 @@ INT_PTR srvVariablesHandler(WPARAM wParam, LPARAM lParam) if (Result == NULL)
Result = TranslateT("Stranger");
}
- else if (!lstrcmp(ai->targv[0], _T(VAR_REQUESTCOUNT))) {
+ else if (!lstrcmp(ai->targv[0], VAR_REQUESTCOUNT)) {
mir_sntprintf(Result.GetBuffer(16), 16, _T("%d"), db_get_w(ai->fi->hContact, MOD_NAME, DB_REQUESTCOUNT, 0));
Result.ReleaseBuffer();
}
- else if (!lstrcmp(ai->targv[0], _T(VAR_MESSAGENUM))) {
+ else if (!lstrcmp(ai->targv[0], VAR_MESSAGENUM)) {
mir_sntprintf(Result.GetBuffer(16), 16, _T("%d"), db_get_w(ai->fi->hContact, MOD_NAME, DB_MESSAGECOUNT, 0));
Result.ReleaseBuffer();
}
- else if (!lstrcmp(ai->targv[0], _T(VAR_TIMEPASSED))) {
+ else if (!lstrcmp(ai->targv[0], VAR_TIMEPASSED)) {
ULARGE_INTEGER ul_AwaySince, ul_Now;
SYSTEMTIME st;
GetLocalTime(&st);
@@ -599,7 +594,7 @@ INT_PTR srvVariablesHandler(WPARAM wParam, LPARAM lParam) mir_sntprintf(Result, 256, TranslateT("%d seconds"), ul_Now.LowPart);
Result.ReleaseBuffer();
}
- else if (!lstrcmp(ai->targv[0], _T(VAR_PREDEFINEDMESSAGE))) {
+ else if (!lstrcmp(ai->targv[0], VAR_PREDEFINEDMESSAGE)) {
ai->flags = 0; // reset AIF_DONTPARSE flag
if (ai->argc != 2)
return NULL;
@@ -617,7 +612,7 @@ INT_PTR srvVariablesHandler(WPARAM wParam, LPARAM lParam) if (Result == NULL) // if we didn't find a message with specified title
return NULL; // return it now, as later we change NULL to ""
}
- else if (!lstrcmp(ai->targv[0], _T(VAR_PROTOCOL))) {
+ else if (!lstrcmp(ai->targv[0], VAR_PROTOCOL)) {
if (VarParseData.szProto) {
CString AnsiResult;
CallProtoService(VarParseData.szProto, PS_GETNAME, 256, (LPARAM)AnsiResult.GetBuffer(256));
@@ -627,15 +622,15 @@ INT_PTR srvVariablesHandler(WPARAM wParam, LPARAM lParam) if (Result == NULL) // if we didn't find a message with specified title
return NULL; // return it now, as later we change NULL to ""
}
- TCHAR *szResult;
- if (!(szResult = (TCHAR*)malloc((Result.GetLen() + 1) * sizeof(TCHAR))))
+ TCHAR *szResult = (TCHAR*)malloc((Result.GetLen() + 1) * sizeof(TCHAR));
+ if (!szResult)
return NULL;
_tcscpy(szResult, (Result != NULL) ? Result : _T(""));
- return (int)szResult;
+ return (INT_PTR)szResult;
}
-INT_PTR srvFreeVarMem(WPARAM wParam, LPARAM lParam)
+INT_PTR srvFreeVarMem(WPARAM, LPARAM lParam)
{
if (!lParam)
return -1;
@@ -687,18 +682,18 @@ struct }
static Variables[] =
{
- { _T(VAR_AWAYSINCE_TIME), LPGEN("New Away System\t(x)\tAway since time in default format; ?nas_awaysince_time(x) in format x"), TRF_FIELD | TRF_FUNCTION },
- { _T(VAR_AWAYSINCE_DATE), LPGEN("New Away System\t(x)\tAway since date in default format; ?nas_awaysince_date(x) in format x"), TRF_FIELD | TRF_FUNCTION },
- { _T(VAR_STATDESC), LPGEN("New Away System\tStatus description"), TRF_FIELD | TRF_FUNCTION },
- { _T(VAR_MYNICK), LPGEN("New Away System\tYour nick for current protocol"), TRF_FIELD | TRF_FUNCTION },
- { _T(VAR_REQUESTCOUNT), LPGEN("New Away System\tNumber of status message requests from the contact"), TRF_FIELD | TRF_FUNCTION },
- { _T(VAR_MESSAGENUM), LPGEN("New Away System\tNumber of messages from the contact"), TRF_FIELD | TRF_FUNCTION },
- { _T(VAR_TIMEPASSED), LPGEN("New Away System\tTime passed until request"), TRF_FIELD | TRF_FUNCTION },
- { _T(VAR_PREDEFINEDMESSAGE), LPGEN("New Away System\t(x)\tReturns one of your predefined messages by its title: ?nas_predefinedmessage(creepy)"), TRF_FUNCTION },
- { _T(VAR_PROTOCOL), LPGEN("New Away System\tCurrent protocol name"), TRF_FIELD | TRF_FUNCTION }
+ { VAR_AWAYSINCE_TIME, LPGEN("New Away System")"\t(x)\t"LPGEN("Away since time in default format; ?nas_awaysince_time(x) in format x"), TRF_FIELD | TRF_FUNCTION },
+ { VAR_AWAYSINCE_DATE, LPGEN("New Away System")"\t(x)\t"LPGEN("Away since date in default format; ?nas_awaysince_date(x) in format x"), TRF_FIELD | TRF_FUNCTION },
+ { VAR_STATDESC, LPGEN("New Away System")"\t"LPGEN("Status description"), TRF_FIELD | TRF_FUNCTION },
+ { VAR_MYNICK, LPGEN("New Away System")"\t"LPGEN("Your nick for current protocol"), TRF_FIELD | TRF_FUNCTION },
+ { VAR_REQUESTCOUNT, LPGEN("New Away System")"\t"LPGEN("Number of status message requests from the contact"), TRF_FIELD | TRF_FUNCTION },
+ { VAR_MESSAGENUM, LPGEN("New Away System")"\t"LPGEN("Number of messages from the contact"), TRF_FIELD | TRF_FUNCTION },
+ { VAR_TIMEPASSED, LPGEN("New Away System")"\t"LPGEN("Time passed until request"), TRF_FIELD | TRF_FUNCTION },
+ { VAR_PREDEFINEDMESSAGE, LPGEN("New Away System")"\t(x)\t"LPGEN("Returns one of your predefined messages by its title: ?nas_predefinedmessage(creepy)"), TRF_FUNCTION },
+ { VAR_PROTOCOL, LPGEN("New Away System")"\t"LPGEN("Current protocol name"), TRF_FIELD | TRF_FUNCTION }
};
-int MirandaLoaded(WPARAM wParam, LPARAM lParam)
+int MirandaLoaded(WPARAM, LPARAM)
{
LoadMsgTreeModule();
LoadCListModule();
@@ -743,7 +738,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_IDLE_CHANGED, IdleChangeEvent);
HookEvent(ME_CONTACTSETTINGS_INITIALISE, ContactSettingsInit);
- g_hReadWndList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
+ g_hReadWndList = WindowList_Create();
int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply;
@@ -834,15 +829,13 @@ extern "C" int __declspec(dllexport) Load(void) mir_getCLI();
HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded);
- if (db_get_s(NULL, "KnownModules", "New Away System", (char*)NULL) == NULL)
- db_set_s(NULL, "KnownModules", "New Away System", MOD_NAME);
Icon_Register(g_hInstance, MOD_NAME, iconList, SIZEOF(iconList), "nas");
InitCommonControls();
InitOptions(); // must be called before we hook CallService
- logservice_register(LOG_ID, LPGENT("New Away System"), _T("NewAwaySys?puts(p,?dbsetting(%subject%,Protocol,p))?if2(_?dbsetting(,?get(p),?pinfo(?get(p),uidsetting)),).log"), TranslateTS(_T("`[`!cdate()-!ctime()`]` ?cinfo(%subject%,display) (?cinfo(%subject%,id)) read your %") _T(VAR_STATDESC) _T("% message:\r\n%extratext%\r\n\r\n")));
+ logservice_register(LOG_ID, LPGENT("New Away System"), _T("NewAwaySys?puts(p,?dbsetting(%subject%,Protocol,p))?if2(_?dbsetting(,?get(p),?pinfo(?get(p),uidsetting)),).log"), TranslateT("`[`!cdate()-!ctime()`]` ?cinfo(%subject%,display) (?cinfo(%subject%,id)) read your %nas_statdesc% message:\r\n%extratext%\r\n\r\n"));
if (db_get_b(NULL, MOD_NAME, DB_SETTINGSVER, 0) < 1) { // change all %nas_message% variables to %extratext% if it wasn't done before
TCString Str = db_get_s(NULL, MOD_NAME, "PopupsFormat", _T(""));
@@ -862,6 +855,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload()
{
+ WindowList_Destroy(g_hReadWndList);
CloseHandle(hMainThread);
return 0;
}
diff --git a/plugins/NewAwaySysMod/src/Common.h b/plugins/NewAwaySysMod/src/Common.h index f76248db0c..4f26c8d451 100644 --- a/plugins/NewAwaySysMod/src/Common.h +++ b/plugins/NewAwaySysMod/src/Common.h @@ -48,6 +48,7 @@ #include "m_langpack.h"
#include "m_protosvc.h"
#include "m_options.h"
+#include "m_netlib.h"
#include "..\..\protocols\IcqOscarJ\src\icq_constants.h"
#include "m_skin.h"
#include "m_awaymsg.h"
@@ -81,15 +82,15 @@ #define CBSSTATE_PRESSED 2
#define CBSSTATE_DISABLED 3
-#define VAR_AWAYSINCE_TIME "nas_awaysince_time"
-#define VAR_AWAYSINCE_DATE "nas_awaysince_date"
-#define VAR_STATDESC "nas_statdesc"
-#define VAR_MYNICK "nas_mynick"
-#define VAR_REQUESTCOUNT "nas_requestcount"
-#define VAR_MESSAGENUM "nas_messagecount"
-#define VAR_TIMEPASSED "nas_timepassed"
-#define VAR_PREDEFINEDMESSAGE "nas_predefinedmessage"
-#define VAR_PROTOCOL "nas_protocol"
+#define VAR_AWAYSINCE_TIME _T("nas_awaysince_time")
+#define VAR_AWAYSINCE_DATE _T("nas_awaysince_date")
+#define VAR_STATDESC _T("nas_statdesc")
+#define VAR_MYNICK _T("nas_mynick")
+#define VAR_REQUESTCOUNT _T("nas_requestcount")
+#define VAR_MESSAGENUM _T("nas_messagecount")
+#define VAR_TIMEPASSED _T("nas_timepassed")
+#define VAR_PREDEFINEDMESSAGE _T("nas_predefinedmessage")
+#define VAR_PROTOCOL _T("nas_protocol")
#define SENDSMSG_EVENT_MSG 0x1
#define SENDSMSG_EVENT_URL 0x2
@@ -120,7 +121,7 @@ #define AUTOREPLY_DEF_REPLY 0
#define AUTOREPLY_DEF_REPLYONEVENT (EF_MSG | EF_URL | EF_FILE)
-#define AUTOREPLY_DEF_PREFIX TranslateT("Miranda IM autoreply >\r\n%extratext%")
+#define AUTOREPLY_DEF_PREFIX TranslateT("Miranda NG autoreply >\r\n%extratext%")
#define AUTOREPLY_DEF_DISABLEREPLY (SF_ONL | SF_INV)
#define AUTOREPLY_IDLE_WINDOWS 0
@@ -158,8 +159,6 @@ #define SIZEOF(s) (sizeof(s) / sizeof(*s))
#endif
-#define MS_NETLIB_LOG "Netlib/Log"
-
#define UM_ICONSCHANGED (WM_USER + 121)
// IDD_READAWAYMSG user-defined message constants
@@ -302,7 +301,7 @@ extern HANDLE g_hReadWndList; INT_PTR GetContactStatMsg(WPARAM wParam, LPARAM lParam);
// AwayOpt.cpp
-int OptsDlgInit(WPARAM wParam, LPARAM lParam); // called on opening of the options dialog
+int OptsDlgInit(WPARAM wParam, LPARAM); // called on opening of the options dialog
void InitOptions(); // called once when plugin is loaded
//int ShowPopupNotification(COptPage &PopupNotifyData, MCONTACT hContact, int iStatusMode);
@@ -339,23 +338,10 @@ __inline int CallAllowedPS_SETAWAYMSG(const char *szProto, int iMode, const char return CallService(str, (WPARAM)iMode, (LPARAM)szMsg);
}
-static __inline void my_variables_skin_helpbutton(HWND hwndDlg, UINT uIDButton)
-{
- HICON hIcon = ServiceExists(MS_VARS_GETSKINITEM) ? (HICON)CallService(MS_VARS_GETSKINITEM, 0, (LPARAM)VSI_HELPICON) : NULL;
- if (hIcon)
- SendDlgItemMessage(hwndDlg, uIDButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
-}
-
static __inline int my_variables_showhelp(HWND hwndDlg, UINT uIDEdit, int flags = 0, char *szSubjectDesc = NULL, char *szExtraDesc = NULL)
{
if (ServiceExists(MS_VARS_SHOWHELPEX)) {
- VARHELPINFO vhi = {0};
- vhi.cbSize = sizeof(VARHELPINFO);
- vhi.flags = flags ? flags : (VHF_FULLDLG | VHF_SETLASTSUBJECT);
- vhi.hwndCtrl = GetDlgItem(hwndDlg, uIDEdit);
- vhi.szSubjectDesc = szSubjectDesc;
- vhi.szExtraTextDesc = szExtraDesc;
- return CallService(MS_VARS_SHOWHELPEX, (WPARAM)hwndDlg, (LPARAM)&vhi);
+ return variables_showhelp(hwndDlg, uIDEdit, flags, szSubjectDesc,szExtraDesc);
}
else {
ShowMsg(TranslateT("New Away System"), TranslateT("Variables plugin is not installed"), true);
diff --git a/plugins/NewAwaySysMod/src/ContactList.cpp b/plugins/NewAwaySysMod/src/ContactList.cpp index 88102ed768..0471763944 100644 --- a/plugins/NewAwaySysMod/src/ContactList.cpp +++ b/plugins/NewAwaySysMod/src/ContactList.cpp @@ -37,7 +37,7 @@ static int CLContactIconChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-static int CLIconsChanged(WPARAM wParam, LPARAM lParam)
+static int CLIconsChanged(WPARAM, LPARAM)
{
WindowList_Broadcast(hCLWindowList, INTM_INVALIDATE, 0, 0);
return 0;
@@ -45,7 +45,7 @@ static int CLIconsChanged(WPARAM wParam, LPARAM lParam) void LoadCListModule()
{
- hCLWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
+ hCLWindowList = WindowList_Create();
HookEvent(ME_DB_CONTACT_DELETED, CLContactDeleted);
HookEvent(ME_CLIST_CONTACTICONCHANGED, CLContactIconChanged);
HookEvent(ME_SKIN_ICONSCHANGED, CLIconsChanged);
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index b624a2d088..87c6bf8c3d 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -234,13 +234,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) GetDynamicStatMsg(hContact); // it updates VarParseData.Message needed for %extratext% in the format
TCString Reply(*(TCString*)AutoreplyOptData.GetValue(IDC_REPLYDLG_PREFIX));
if (Reply != NULL && ServiceExists(MS_VARS_FORMATSTRING) && !g_SetAwayMsgPage.GetDBValueCopy(IDS_SAWAYMSG_DISABLEVARIABLES)) {
- FORMATINFO fi = { 0 };
- fi.cbSize = sizeof(FORMATINFO);
- fi.tszFormat = Reply;
- fi.hContact = hContact;
- fi.flags = FIF_TCHAR;
- fi.tszExtraText = VarParseData.Message;
- TCHAR *szResult = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ TCHAR *szResult = variables_parse(Reply, VarParseData.Message, hContact);
if (szResult != NULL) {
Reply = szResult;
mir_free(szResult);
diff --git a/plugins/NewAwaySysMod/src/Notification.cpp b/plugins/NewAwaySysMod/src/Notification.cpp index c55cab9feb..6f04dc0267 100644 --- a/plugins/NewAwaySysMod/src/Notification.cpp +++ b/plugins/NewAwaySysMod/src/Notification.cpp @@ -26,12 +26,12 @@ void ShowMsg(TCHAR *FirstLine, TCHAR *SecondLine, bool IsErrorMsg, int Timeout) if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
POPUPDATAT ppd = { 0 };
ppd.lchIcon = LoadIcon(NULL, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION);
- lstrcpy(ppd.lptzContactName, FirstLine);
- lstrcpy(ppd.lptzText, SecondLine);
+ lstrcpyn(ppd.lptzContactName, FirstLine, MAX_CONTACTNAME);
+ lstrcpyn(ppd.lptzText, SecondLine, MAX_SECONDLINE);
ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD;
ppd.colorText = IsErrorMsg ? 0xE8F1FD : 0x000000;
ppd.iSeconds = Timeout;
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
+ PUAddPopupT(&ppd);
}
else MessageBox(NULL, SecondLine, FirstLine, MB_OK | (IsErrorMsg ? MB_ICONEXCLAMATION : MB_ICONINFORMATION));
}
diff --git a/plugins/NewAwaySysMod/src/Options.cpp b/plugins/NewAwaySysMod/src/Options.cpp index 63f76fcd88..b1dff3580d 100644 --- a/plugins/NewAwaySysMod/src/Options.cpp +++ b/plugins/NewAwaySysMod/src/Options.cpp @@ -220,12 +220,11 @@ void COptItem_BitDBSetting::MemToDB(CString &sModule, CString *sDBSettingPrefix) int COptItem_TreeCtrl::IDToOrder(int ID)
{
- int i;
- for (i = 0; i < RootItems.GetSize(); i++)
+ for (int i = 0; i < RootItems.GetSize(); i++)
if (RootItems[i].ID == ID)
return ROOT_INDEX_TO_ORDER(i);
- for (i = 0; i < Value.GetSize(); i++)
+ for (int i = 0; i < Value.GetSize(); i++)
if (Value[i].ID == ID)
return i;
@@ -234,12 +233,11 @@ int COptItem_TreeCtrl::IDToOrder(int ID) int COptItem_TreeCtrl::hItemToOrder(HTREEITEM hItem)
{
- int i;
- for (i = 0; i < RootItems.GetSize(); i++)
+ for (int i = 0; i < RootItems.GetSize(); i++)
if (RootItems[i].hItem == hItem)
return ROOT_INDEX_TO_ORDER(i);
- for (i = 0; i < Value.GetSize(); i++)
+ for (int i = 0; i < Value.GetSize(); i++)
if (Value[i].hItem == hItem)
return i;
@@ -308,8 +306,7 @@ void COptItem_TreeCtrl::DBToMem(CString &sModule, CString *sDBSettingPrefix) Value = DefValue;
}
else {
- int i;
- for (i = 0; i < Value.GetSize(); i++) {
+ for (int i = 0; i < Value.GetSize(); i++) {
if (Value[i].Title == NULL) {
Value.RemoveElem(i);
i--;
@@ -559,8 +556,7 @@ CTreeItem* COptItem_TreeCtrl::InsertItem(HWND hWnd, CTreeItem &Item) }
}
tvIn.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
- tvIn.item.state = tvIn.item.stateMask = (Item.Flags & TIF_GROUP) ? (TVIS_BOLD |
- ((Item.Flags & TIF_EXPANDED) ? TVIS_EXPANDED : 0)) : 0;
+ tvIn.item.state = tvIn.item.stateMask = (Item.Flags & TIF_GROUP) ? (TVIS_BOLD | ((Item.Flags & TIF_EXPANDED) ? TVIS_EXPANDED : 0)) : 0;
if (TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES) {
tvIn.item.stateMask |= TVIS_STATEIMAGEMASK;
tvIn.item.state |= INDEXTOSTATEIMAGEMASK((Item.Flags & TIF_ENABLED) ? 2 : 1);
diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp index f0721d3088..ce7adf0ebd 100644 --- a/plugins/NewAwaySysMod/src/Properties.cpp +++ b/plugins/NewAwaySysMod/src/Properties.cpp @@ -37,7 +37,7 @@ void ResetSettingsOnStatusChange(const char *szProto = NULL, int bResetPersonalM MCONTACT hContact = db_find_first();
while (hContact) {
const char *szCurProto;
- if (!szProto || ((szCurProto = (const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)) && !lstrcmpA(szProto, szCurProto))) {
+ if (!szProto || ((szCurProto = GetContactProto(hContact)) && !lstrcmpA(szProto, szCurProto))) {
ResetContactSettingsOnStatusChange(hContact);
if (bResetPersonalMsgs) {
CContactSettings(Status, hContact).SetMsgFormat(SMF_PERSONAL, NULL); // TODO: delete only when SAM dialog opens?
diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h index e02e5c1586..6e839ddd52 100644 --- a/plugins/NewAwaySysMod/src/Properties.h +++ b/plugins/NewAwaySysMod/src/Properties.h @@ -464,7 +464,7 @@ public: _ASSERT((Parent->hContact && Parent->hContact != INVALID_CONTACT_ID) || szProtoOverride); // we need either correct protocol or a correct hContact to determine its protocol
int Value = *this;
if (Value == VAL_USEDEFAULT) {
- const char *szProto = (Parent->hContact && Parent->hContact != INVALID_CONTACT_ID) ? (const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)Parent->hContact, 0) : szProtoOverride;
+ const char *szProto = (Parent->hContact && Parent->hContact != INVALID_CONTACT_ID) ? GetContactProto(Parent->hContact) : szProtoOverride;
return CProtoSettings(szProto).Autoreply.IncludingParents();
}
return Value;
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index 5b7b9efb70..e829b7cbb1 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -139,7 +139,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam return false;
}
-INT_PTR GetContactStatMsg(WPARAM wParam, LPARAM lParam)
+INT_PTR GetContactStatMsg(WPARAM wParam, LPARAM)
{
if (HWND hWnd = WindowList_Find(g_hReadWndList, wParam)) // already have it
SetForegroundWindow(hWnd);
diff --git a/plugins/NewAwaySysMod/src/Services.cpp b/plugins/NewAwaySysMod/src/Services.cpp index b98f2cf605..5696b98766 100644 --- a/plugins/NewAwaySysMod/src/Services.cpp +++ b/plugins/NewAwaySysMod/src/Services.cpp @@ -50,7 +50,7 @@ __inline void PSSetStatus(char *szProto, WORD Status, int bNoClistSetStatusMode // called by GamerStatus and built-in miranda autoaway module
// wParam = (int)status, lParam = 0
// MS_AWAYMSG_GETSTATUSMSG "SRAway/GetStatusMessage"
-INT_PTR GetStatusMsg(WPARAM wParam, LPARAM lParam)
+INT_PTR GetStatusMsg(WPARAM wParam, LPARAM)
{
LogMessage("MS_AWAYMSG_GETSTATUSMSG called. status=%d", wParam);
CString Msg(_T2A(GetDynamicStatMsg(INVALID_CONTACT_ID, NULL, 0, wParam)));
@@ -62,7 +62,7 @@ INT_PTR GetStatusMsg(WPARAM wParam, LPARAM lParam) lstrcpyA(szMsg, Msg);
}
LogMessage("returned szMsg:\n%s", szMsg ? szMsg : "NULL");
- return (int)szMsg;
+ return (INT_PTR)szMsg;
}
// wParam = int iMode
@@ -167,7 +167,7 @@ INT_PTR SetStateW(WPARAM wParam, LPARAM lParam) // wParam = (WPARAM)(NAS_ISWINFO*)iswi - pointer to a NAS_ISWINFO structure.
// lParam = 0
// returns HWND of the window on success, or NULL on failure.
-INT_PTR InvokeStatusWindow(WPARAM wParam, LPARAM lParam)
+INT_PTR InvokeStatusWindow(WPARAM wParam, LPARAM)
{
NAS_ISWINFO *iswi = (NAS_ISWINFO*)wParam;
if (iswi->cbSize != sizeof(NAS_ISWINFOv1) && iswi->cbSize < sizeof(NAS_ISWINFO))
@@ -189,5 +189,5 @@ INT_PTR InvokeStatusWindow(WPARAM wParam, LPARAM lParam) dat->IsModeless = true;
if (iswi->cbSize > sizeof(NAS_ISWINFOv1))
dat->ISW_Flags = iswi->Flags;
- return (int)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), NULL, SetAwayMsgDlgProc, (LPARAM)dat);
+ return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), NULL, SetAwayMsgDlgProc, (LPARAM)dat);
}
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index ea3d95e58e..8d18acd995 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -1017,7 +1017,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (Buttons[i].IconIndex != ILI_NOICON)
SendDlgItemMessage(hwndDlg, Buttons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Buttons[i].IconIndex]);
- my_variables_skin_helpbutton(hwndDlg, IDC_SAWAYMSG_VARS);
+ variables_skin_helpbutton(hwndDlg, IDC_SAWAYMSG_VARS);
break;
case WM_COMMAND:
|