summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src/StartupStatus
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/StatusManager/src/StartupStatus')
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_options.cpp74
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_profiles.cpp37
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.cpp134
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.h23
4 files changed, 92 insertions, 176 deletions
diff --git a/plugins/StatusManager/src/StartupStatus/ss_options.cpp b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
index 90bdc218aa..dc7acf304e 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_options.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
@@ -27,30 +27,6 @@ char* OptName(int i, const char* setting)
}
/////////////////////////////////////////////////////////////////////////////////////////
-
-int SSCompareSettings(const TSSSetting *p1, const TSSSetting *p2)
-{
- return mir_strcmp(p1->m_szName, p2->m_szName);
-}
-
-TSettingsList* GetCurrentProtoSettings()
-{
- int count;
- PROTOACCOUNT **protos;
- Proto_EnumAccounts(&count, &protos);
-
- TSettingsList *result = new TSettingsList(count, SSCompareSettings);
- if (result == nullptr)
- return nullptr;
-
- for (int i = 0; i < count; i++)
- if (IsSuitableProto(protos[i]))
- result->insert(new TSSSetting(protos[i]));
-
- return result;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// Command line processing
static char* GetStatusDesc(int status)
@@ -71,7 +47,7 @@ static char* GetStatusDesc(int status)
return "offline";
}
-static char* GetCMDLArguments(TSettingsList& protoSettings)
+static char* GetCMDLArguments(TProtoSettings& protoSettings)
{
if (protoSettings.getCount() == 0)
return nullptr;
@@ -107,7 +83,7 @@ static char* GetCMDLArguments(TSettingsList& protoSettings)
return cmdl;
}
-static char* GetCMDL(TSettingsList& protoSettings)
+static char* GetCMDL(TProtoSettings& protoSettings)
{
char path[MAX_PATH];
GetModuleFileNameA(nullptr, path, MAX_PATH);
@@ -127,14 +103,14 @@ static char* GetCMDL(TSettingsList& protoSettings)
/////////////////////////////////////////////////////////////////////////////////////////
// Link processing
-static wchar_t* GetLinkDescription(TSettingsList& protoSettings)
+static wchar_t* GetLinkDescription(TProtoSettings& protoSettings)
{
if (protoSettings.getCount() == 0)
return nullptr;
CMStringW result(SHORTCUT_DESC);
for (int i = 0; i < protoSettings.getCount(); i++) {
- TSSSetting &p = protoSettings[i];
+ SMProto &p = protoSettings[i];
wchar_t *status;
if (p.m_status == ID_STATUS_LAST)
@@ -158,7 +134,7 @@ static wchar_t* GetLinkDescription(TSettingsList& protoSettings)
return mir_wstrndup(result, result.GetLength());
}
-HRESULT CreateLink(TSettingsList& protoSettings)
+HRESULT CreateLink(TProtoSettings& protoSettings)
{
wchar_t savePath[MAX_PATH];
if (SHGetSpecialFolderPath(nullptr, savePath, 0x10, FALSE))
@@ -201,13 +177,13 @@ HRESULT CreateLink(TSettingsList& protoSettings)
INT_PTR CALLBACK CmdlOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- static TSettingsList* optionsProtoSettings;
+ static TProtoSettings* optionsProtoSettings;
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- optionsProtoSettings = (TSettingsList*)lParam;
+ optionsProtoSettings = (TProtoSettings*)lParam;
char* cmdl = GetCMDL(*optionsProtoSettings);
SetDlgItemTextA(hwndDlg, IDC_CMDL, cmdl);
free(cmdl);
@@ -421,15 +397,13 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
int defProfile = (int)SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETITEMDATA,
SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0), 0);
- TSettingsList* ps = GetCurrentProtoSettings();
- if (ps) {
- GetProfile(defProfile, *ps);
- for (int i = 0; i < ps->getCount(); i++)
- if ((*ps)[i].m_szMsg != nullptr)
- (*ps)[i].m_szMsg = wcsdup((*ps)[i].m_szMsg);
+ TProtoSettings ps = protoList;
+ GetProfile(defProfile, ps);
+ for (int i = 0; i < ps.getCount(); i++)
+ if (ps[i].m_szMsg != nullptr)
+ ps[i].m_szMsg = wcsdup(ps[i].m_szMsg);
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CMDLOPTIONS), hwndDlg, CmdlOptionsDlgProc, (LPARAM)ps);
- }
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CMDLOPTIONS), hwndDlg, CmdlOptionsDlgProc, (LPARAM)&ps);
break;
}
}
@@ -573,7 +547,7 @@ class CSSAdvancedOptDlg : public CDlgBase
// fill proto list
lstAccount.ResetContent();
- TSettingsList& ar = *arProfiles[sel].ps;
+ TProtoSettings &ar = arProfiles[sel].ps;
for (int i = 0; i < ar.getCount(); i++)
lstAccount.AddString(ar[i].m_tszAccName, (LPARAM)&ar[i]);
lstAccount.SetCurSel(0);
@@ -586,7 +560,7 @@ class CSSAdvancedOptDlg : public CDlgBase
int idx = lstAccount.GetCurSel();
if (idx != -1) {
// fill status box
- TSSSetting* ps = (TSSSetting*)lstAccount.GetItemData(idx);
+ SMProto* ps = (SMProto*)lstAccount.GetItemData(idx);
int flags = (CallProtoService(ps->m_szName, PS_GETCAPS, PFLAGNUM_2, 0))&~(CallProtoService(ps->m_szName, PS_GETCAPS, PFLAGNUM_5, 0));
lstStatus.ResetContent();
@@ -616,7 +590,7 @@ class CSSAdvancedOptDlg : public CDlgBase
bool bStatusMsg = false;
int idx = lstAccount.GetCurSel();
if (idx != -1) {
- TSSSetting *ps = (TSSSetting*)lstAccount.GetItemData(idx);
+ SMProto *ps = (SMProto*)lstAccount.GetItemData(idx);
CheckRadioButton(m_hwnd, IDC_MIRANDAMSG, IDC_CUSTOMMSG, ps->m_szMsg != nullptr ? IDC_CUSTOMMSG : IDC_MIRANDAMSG);
if (ps->m_szMsg != nullptr)
@@ -690,8 +664,8 @@ public:
for (int i = 0; i < profileCount; i++) {
PROFILEOPTIONS *ppo = new PROFILEOPTIONS;
- ppo->ps = GetCurrentProtoSettings();
- TSettingsList& ar = *ppo->ps;
+ ppo->ps = protoList;
+ TProtoSettings &ar = ppo->ps;
if (GetProfile(i, ar) == -1) {
/* create an empty profile */
@@ -754,7 +728,7 @@ public:
db_set_w(0, SSMODULENAME, OptName(i, SETTING_HOTKEY), po.hotKey);
db_set_ws(0, SSMODULENAME, OptName(i, SETTING_PROFILENAME), po.tszName);
- TSettingsList& ar = *po.ps;
+ TProtoSettings &ar = po.ps;
for (int j = 0; j < ar.getCount(); j++) {
if (ar[j].m_szMsg != nullptr) {
char setting[128];
@@ -809,7 +783,7 @@ public:
{
int idx = lstAccount.GetCurSel();
if (idx != -1) {
- TSSSetting* ps = (TSSSetting*)lstAccount.GetItemData(idx);
+ SMProto* ps = (SMProto*)lstAccount.GetItemData(idx);
ps->m_status = lstStatus.GetItemData(lstStatus.GetCurSel());
NotifyChange();
}
@@ -829,7 +803,7 @@ public:
void onChange_StatusMsg(CCtrlCheck*)
{
int len;
- TSSSetting* ps = (TSSSetting*)lstAccount.GetItemData(lstAccount.GetCurSel());
+ SMProto* ps = (SMProto*)lstAccount.GetItemData(lstAccount.GetCurSel());
if (ps->m_szMsg != nullptr)
free(ps->m_szMsg);
@@ -852,7 +826,7 @@ public:
{
// update the status message in memory, this is done on each character tick, not nice
// but it works
- TSSSetting* ps = (TSSSetting*)lstAccount.GetItemData(lstAccount.GetCurSel());
+ SMProto* ps = (SMProto*)lstAccount.GetItemData(lstAccount.GetCurSel());
if (ps->m_szMsg != nullptr) {
if (*ps->m_szMsg)
free(ps->m_szMsg);
@@ -897,10 +871,10 @@ public:
PROFILEOPTIONS* ppo = new PROFILEOPTIONS;
ppo->tszName = mir_wstrdup(tszName);
- ppo->ps = GetCurrentProtoSettings();
+ ppo->ps = protoList;
arProfiles.insert(ppo);
- ReinitProfiles();;
+ ReinitProfiles();
break;
}
diff --git a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
index 19f9d05ecd..0e151abb99 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
@@ -164,7 +164,29 @@ wchar_t* GetStatusMessage(int profile, char *szProto)
return pce[pceCount - 1].msg;
}
-int GetProfile(int profile, TSettingsList& arSettings)
+void FillStatus(SMProto &ps, int profile)
+{
+ // load status
+ char setting[80];
+ mir_snprintf(setting, "%d_%s", profile, ps.m_szName);
+ int iStatus = db_get_w(0, SSMODULENAME, setting, 0);
+ if (iStatus < MIN_STATUS || iStatus > MAX_STATUS)
+ iStatus = DEFAULT_STATUS;
+ ps.m_status = iStatus;
+
+ // load last status
+ mir_snprintf(setting, "%s%s", PREFIX_LAST, ps.m_szName);
+ iStatus = db_get_w(0, SSMODULENAME, setting, 0);
+ if (iStatus < MIN_STATUS || iStatus > MAX_STATUS)
+ iStatus = DEFAULT_STATUS;
+ ps.m_lastStatus = iStatus;
+
+ ps.m_szMsg = GetStatusMessage(profile, ps.m_szName);
+ if (ps.m_szMsg)
+ ps.m_szMsg = wcsdup(ps.m_szMsg);
+}
+
+int GetProfile(int profile, TProtoSettings &arSettings)
{
if (profile < 0) // get default profile
profile = db_get_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
@@ -173,15 +195,8 @@ int GetProfile(int profile, TSettingsList& arSettings)
if (profile >= count && count > 0)
return -1;
- arSettings.destroy();
-
- // if count == 0, continue so the default profile will be returned
- PROTOACCOUNT** protos;
- Proto_EnumAccounts(&count, &protos);
-
- for (int i = 0; i < count; i++)
- if (IsSuitableProto(protos[i]))
- arSettings.insert(new TSSSetting(profile, protos[i]));
+ for (int i = 0; i < arSettings.getCount(); i++)
+ FillStatus(arSettings[i], profile);
return (arSettings.getCount() == 0) ? -1 : 0;
}
@@ -197,7 +212,7 @@ INT_PTR LoadAndSetProfile(WPARAM iProfileNo, LPARAM)
{
// wParam == profile no.
int profile = (int)iProfileNo;
- TSettingsList profileSettings(10, SSCompareSettings);
+ TProtoSettings profileSettings(10, CompareProtoSettings);
if (!GetProfile(profile, profileSettings)) {
profile = (profile >= 0) ? profile : db_get_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
index 6559fa6811..d84781c1be 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
@@ -21,50 +21,9 @@
int SSLangPack;
-static HANDLE hServices[3], hEvents[4];
+static HANDLE hServices[3], hEvents[3];
static UINT_PTR setStatusTimerId = 0;
-static TSettingsList startupSettings(10, SSCompareSettings);
-
-TSSSetting::TSSSetting(PROTOACCOUNT *pa)
-{
- m_szName = pa->szModuleName;
- m_tszAccName = pa->tszAccountName;
- m_status = m_lastStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
- m_szMsg = nullptr;
-}
-
-TSSSetting::TSSSetting(int profile, PROTOACCOUNT *pa)
-{
- // copy name
- m_szName = pa->szModuleName;
- m_tszAccName = pa->tszAccountName;
-
- // load status
- char setting[80];
- mir_snprintf(setting, "%d_%s", profile, pa->szModuleName);
- int iStatus = db_get_w(0, SSMODULENAME, setting, 0);
- if (iStatus < MIN_STATUS || iStatus > MAX_STATUS)
- iStatus = DEFAULT_STATUS;
- m_status = iStatus;
-
- // load last status
- mir_snprintf(setting, "%s%s", PREFIX_LAST, m_szName);
- iStatus = db_get_w(0, SSMODULENAME, setting, 0);
- if (iStatus < MIN_STATUS || iStatus > MAX_STATUS)
- iStatus = DEFAULT_STATUS;
- m_lastStatus = iStatus;
-
- m_szMsg = GetStatusMessage(profile, m_szName);
- if (m_szMsg)
- m_szMsg = wcsdup(m_szMsg);
-}
-
-TSSSetting::~TSSSetting()
-{
- free(m_szMsg);
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
static HANDLE hProtoAckHook, hCSStatusChangeHook, hStatusChangeHook;
@@ -76,7 +35,7 @@ static BYTE showDialogOnStartup = 0;
/////////////////////////////////////////////////////////////////////////////////////////
// command line options
-static PROTOCOLSETTINGEX* IsValidProtocol(TSettingsList& protoSettings, char* protoName)
+static PROTOCOLSETTINGEX* IsValidProtocol(TProtoSettings &protoSettings, const char *protoName)
{
for (int i = 0; i < protoSettings.getCount(); i++)
if (!strncmp(protoSettings[i].m_szName, protoName, mir_strlen(protoSettings[i].m_szName)))
@@ -113,7 +72,7 @@ static int IsValidStatusDesc(char* statusDesc)
return 0;
}
-static void ProcessCommandLineOptions(TSettingsList& protoSettings)
+static void ProcessCommandLineOptions(TProtoSettings& protoSettings)
{
if (protoSettings.getCount() == 0)
return;
@@ -156,7 +115,7 @@ static void ProcessCommandLineOptions(TSettingsList& protoSettings)
}
}
-static void SetLastStatusMessages(TSettingsList &ps)
+static void SetLastStatusMessages(TProtoSettings &ps)
{
for (int i = 0; i < ps.getCount(); i++) {
if (ps[i].m_status != ID_STATUS_LAST)
@@ -176,27 +135,6 @@ static void SetLastStatusMessages(TSettingsList &ps)
/////////////////////////////////////////////////////////////////////////////////////////
// Account control event
-int OnSSAccChanged(WPARAM wParam, LPARAM lParam)
-{
- PROTOACCOUNT *pa = (PROTOACCOUNT*)lParam;
- switch (wParam) {
- case PRAC_ADDED:
- startupSettings.insert(new TSSSetting(-1, pa));
- break;
-
- case PRAC_REMOVED:
- for (int i = 0; i < startupSettings.getCount(); i++) {
- if (!mir_strcmp(startupSettings[i].m_szName, pa->szModuleName)) {
- startupSettings.remove(i);
- break;
- }
- }
- break;
- }
-
- return 0;
-}
-
// 'allow override'
static int ProcessProtoAck(WPARAM, LPARAM lParam)
{
@@ -205,12 +143,12 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam)
if (ack->type != ACKTYPE_STATUS && ack->result != ACKRESULT_FAILED)
return 0;
- if (!db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
+ if (!db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1) || protoList.getCount() == 0)
return 0;
- for (int i = 0; i < startupSettings.getCount(); i++) {
- if (!mir_strcmp(ack->szModule, startupSettings[i].m_szName)) {
- startupSettings[i].m_szName = "";
+ for (int i = 0; i < protoList.getCount(); i++) {
+ if (!mir_strcmp(ack->szModule, protoList[i].m_szName)) {
+ protoList[i].m_szName = "";
log_debugA("StartupStatus: %s overridden by ME_PROTO_ACK, status will not be set", ack->szModule);
}
}
@@ -221,20 +159,20 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam)
static int StatusChange(WPARAM, LPARAM lParam)
{
// change by menu
- if (!db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
+ if (!db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1) || protoList.getCount() == 0)
return 0;
char *szProto = (char *)lParam;
if (szProto == nullptr) { // global status change
- for (int i = 0; i < startupSettings.getCount(); i++) {
- startupSettings[i].m_szName = "";
+ for (int i = 0; i < protoList.getCount(); i++) {
+ protoList[i].m_szName = "";
log_debugA("StartupStatus: all protos overridden by ME_CLIST_STATUSMODECHANGE, status will not be set");
}
}
else {
- for (int i = 0; i < startupSettings.getCount(); i++) {
- if (!mir_strcmp(startupSettings[i].m_szName, szProto)) {
- startupSettings[i].m_szName = "";
+ for (int i = 0; i < protoList.getCount(); i++) {
+ if (!mir_strcmp(protoList[i].m_szName, szProto)) {
+ protoList[i].m_szName = "";
log_debugA("StartupStatus: %s overridden by ME_CLIST_STATUSMODECHANGE, status will not be set", szProto);
}
}
@@ -246,7 +184,7 @@ static int StatusChange(WPARAM, LPARAM lParam)
static int CSStatusChangeEx(WPARAM wParam, LPARAM)
{
// another status plugin made the change
- if (!db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
+ if (!db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1) || protoList.getCount() == 0)
return 0;
if (wParam != 0) {
@@ -254,15 +192,15 @@ static int CSStatusChangeEx(WPARAM wParam, LPARAM)
if (ps == nullptr)
return -1;
- for (int i = 0; i < startupSettings.getCount(); i++) {
- for (int j = 0; j < startupSettings.getCount(); j++) {
- if (ps[i]->m_szName == nullptr || startupSettings[j].m_szName == nullptr)
+ for (int i = 0; i < protoList.getCount(); i++) {
+ for (int j = 0; j < protoList.getCount(); j++) {
+ if (ps[i]->m_szName == nullptr || protoList[j].m_szName == nullptr)
continue;
- if (!mir_strcmp(ps[i]->m_szName, startupSettings[j].m_szName)) {
+ if (!mir_strcmp(ps[i]->m_szName, protoList[j].m_szName)) {
log_debugA("StartupStatus: %s overridden by MS_CS_SETSTATUSEX, status will not be set", ps[i]->m_szName);
// use a hack to disable this proto
- startupSettings[j].m_szName = "";
+ protoList[j].m_szName = "";
}
}
}
@@ -277,7 +215,7 @@ static void CALLBACK SetStatusTimed(HWND, UINT, UINT_PTR, DWORD)
UnhookEvent(hProtoAckHook);
UnhookEvent(hCSStatusChangeHook);
UnhookEvent(hStatusChangeHook);
- CallService(MS_CS_SETSTATUSEX, (WPARAM)&startupSettings, 0);
+ CallService(MS_CS_SETSTATUSEX, (WPARAM)&protoList, 0);
}
static int OnOkToExit(WPARAM, LPARAM)
@@ -370,7 +308,7 @@ static int OnShutdown(WPARAM, LPARAM)
if (hMessageWindow)
DestroyWindow(hMessageWindow);
- startupSettings.destroy();
+ protoList.destroy();
return 0;
}
@@ -393,28 +331,25 @@ static DWORD CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM)
int SSModuleLoaded(WPARAM, LPARAM)
{
- protoList = (OBJLIST<PROTOCOLSETTINGEX>*)&startupSettings;
-
InitProfileModule();
- hEvents[0] = HookEvent(ME_PROTO_ACCLISTCHANGED, OnSSAccChanged);
- hEvents[1] = HookEvent(ME_OPT_INITIALISE, StartupStatusOptionsInit);
+ hEvents[0] = HookEvent(ME_OPT_INITIALISE, StartupStatusOptionsInit);
/* shutdown hook for normal shutdown */
- hEvents[2] = HookEvent(ME_SYSTEM_OKTOEXIT, OnOkToExit);
- hEvents[3] = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
+ hEvents[1] = HookEvent(ME_SYSTEM_OKTOEXIT, OnOkToExit);
+ hEvents[2] = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
/* message window for poweroff */
hMessageWindow = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
SetWindowLongPtr(hMessageWindow, GWLP_WNDPROC, (LONG_PTR)MessageWndProc);
- GetProfile(-1, startupSettings);
+ GetProfile(-1, protoList);
// override with cmdl
- ProcessCommandLineOptions(startupSettings);
- if (startupSettings.getCount() == 0)
+ ProcessCommandLineOptions(protoList);
+ if (protoList.getCount() == 0)
return 0;// no protocols are loaded
- SetLastStatusMessages(startupSettings);
+ SetLastStatusMessages(protoList);
showDialogOnStartup = (showDialogOnStartup || db_get_b(0, SSMODULENAME, SETTING_SHOWDIALOG, 0));
// dial
@@ -424,7 +359,7 @@ int SSModuleLoaded(WPARAM, LPARAM)
// set the status!
if (showDialogOnStartup || db_get_b(0, SSMODULENAME, SETTING_SHOWDIALOG, 0))
- ShowConfirmDialogEx((TProtoSettings*)&startupSettings, db_get_dw(0, SSMODULENAME, SETTING_DLGTIMEOUT, 5));
+ ShowConfirmDialogEx((TProtoSettings*)&protoList, db_get_dw(0, SSMODULENAME, SETTING_DLGTIMEOUT, 5));
else if (db_get_b(0, SSMODULENAME, SETTING_SETPROFILE, 1)) {
// set hooks for override
if (db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1)) {
@@ -479,18 +414,17 @@ int SSModuleLoaded(WPARAM, LPARAM)
static INT_PTR SrvGetProfile(WPARAM wParam, LPARAM lParam)
{
- return GetProfile((int)wParam, *(TSettingsList*)lParam);
+ return GetProfile((int)wParam, *(TProtoSettings*)lParam);
}
void StartupStatusLoad()
{
SSLangPack = GetPluginLangId(MIID_LAST, 0);
- if (g_bMirandaLoaded) {
+ if (g_bMirandaLoaded)
SSModuleLoaded(0, 0);
- StartupStatusOptionsInit(0, 0);
- }
- else HookEvent(ME_SYSTEM_MODULESLOADED, SSModuleLoaded);
+ else
+ HookEvent(ME_SYSTEM_MODULESLOADED, SSModuleLoaded);
if (db_get_b(0, SSMODULENAME, SETTING_SETPROFILE, 1) || db_get_b(0, SSMODULENAME, SETTING_OFFLINECLOSE, 0))
db_set_w(0, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.h b/plugins/StatusManager/src/StartupStatus/startupstatus.h
index 2c9f03b40e..e680962e17 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.h
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.h
@@ -21,17 +21,6 @@
#define SSMODULENAME "StartupStatus"
-struct TSSSetting : public PROTOCOLSETTINGEX, public MZeroedObject
-{
- TSSSetting(PROTOACCOUNT *pa);
- TSSSetting(int profile, PROTOACCOUNT *pa);
- ~TSSSetting();
-};
-
-int SSCompareSettings(const TSSSetting *p1, const TSSSetting *p2);
-
-typedef OBJLIST<TSSSetting> TSettingsList;
-
struct PROFILECE
{
int profile;
@@ -41,14 +30,17 @@ struct PROFILECE
struct PROFILEOPTIONS : public MZeroedObject
{
+ __inline PROFILEOPTIONS() :
+ ps(10, CompareProtoSettings)
+ {}
+
__inline ~PROFILEOPTIONS()
{
- delete ps;
mir_free(tszName);
}
wchar_t *tszName;
- TSettingsList* ps;
+ TProtoSettings ps;
BOOL showDialog;
BOOL createTtb;
BOOL createMmi;
@@ -133,10 +125,11 @@ void StartupStatusUnload();
int SSLoadMainOptions();
-TSettingsList* GetCurrentProtoSettings();
+void GetCurrentProtoSettings(TProtoSettings&);
// profile
-int GetProfile(int profileID, TSettingsList& arSettings );
+void FillStatus(SMProto &ps, int profile);
+int GetProfile(int profileID, TProtoSettings& arSettings );
wchar_t *GetStatusMessage(int profile, char *szProto);
INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam);