diff options
-rw-r--r-- | src/mir_app/src/meta_menu.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/meta_options.cpp | 56 | ||||
-rw-r--r-- | src/mir_app/src/meta_services.cpp | 12 | ||||
-rw-r--r-- | src/mir_app/src/meta_utils.cpp | 12 | ||||
-rw-r--r-- | src/mir_app/src/metacontacts.h | 2 |
5 files changed, 44 insertions, 44 deletions
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index d4408ea5bd..f072e66bb7 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -99,7 +99,7 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI db_unset(ccSub->contactID, "CList", "Hidden");
// stop ignoring, if we were
- if (options.bSuppressStatus)
+ if (g_metaOptions.bSuppressStatus)
CallService(MS_IGNORE_UNIGNORE, ccSub->contactID, IGNOREEVENT_USERONLINE);
}
}
@@ -276,7 +276,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) MCONTACT hContact = Meta_GetContactHandle(cc, i);
LPCTSTR ptszName;
- if (options.menu_contact_label == DNT_UID) {
+ if (g_metaOptions.menu_contact_label == DNT_UID) {
Meta_GetSubNick(hMeta, i, tszNick);
ptszName = tszNick.GetBuffer();
}
@@ -431,7 +431,7 @@ void InitMenus() Meta_HideMetaContacts(true);
}
else {
- Meta_SuppressStatus(options.bSuppressStatus);
+ Meta_SuppressStatus(g_metaOptions.bSuppressStatus);
Meta_HideMetaContacts(false);
}
}
diff --git a/src/mir_app/src/meta_options.cpp b/src/mir_app/src/meta_options.cpp index 31c7a5b78c..7550018f9e 100644 --- a/src/mir_app/src/meta_options.cpp +++ b/src/mir_app/src/meta_options.cpp @@ -24,28 +24,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "metacontacts.h"
-MetaOptions options;
+MetaOptions g_metaOptions;
int Meta_WriteOptions()
{
- db_set_b(0, META_PROTO, "LockHandle", options.bLockHandle);
- db_set_b(0, META_PROTO, "SuppressStatus", options.bSuppressStatus);
- db_set_w(0, META_PROTO, "MenuContactLabel", (WORD)options.menu_contact_label);
- db_set_w(0, META_PROTO, "MenuContactFunction", (WORD)options.menu_function);
- db_set_w(0, META_PROTO, "CListContactName", (WORD)options.clist_contact_name);
- db_set_dw(0, META_PROTO, "SetStatusFromOfflineDelay", (DWORD)(options.set_status_from_offline_delay));
+ db_set_b(0, META_PROTO, "LockHandle", g_metaOptions.bLockHandle);
+ db_set_b(0, META_PROTO, "SuppressStatus", g_metaOptions.bSuppressStatus);
+ db_set_w(0, META_PROTO, "MenuContactLabel", (WORD)g_metaOptions.menu_contact_label);
+ db_set_w(0, META_PROTO, "MenuContactFunction", (WORD)g_metaOptions.menu_function);
+ db_set_w(0, META_PROTO, "CListContactName", (WORD)g_metaOptions.clist_contact_name);
+ db_set_dw(0, META_PROTO, "SetStatusFromOfflineDelay", (DWORD)(g_metaOptions.set_status_from_offline_delay));
return 0;
}
int Meta_ReadOptions()
{
db_mc_enable(db_get_b(0, META_PROTO, "Enabled", true) != 0);
- options.bSuppressStatus = db_get_b(0, META_PROTO, "SuppressStatus", true) != 0;
- options.menu_contact_label = (int)db_get_w(0, META_PROTO, "MenuContactLabel", DNT_UID);
- options.menu_function = (int)db_get_w(0, META_PROTO, "MenuContactFunction", FT_MENU);
- options.clist_contact_name = (int)db_get_w(0, META_PROTO, "CListContactName", CNNT_DISPLAYNAME);
- options.set_status_from_offline_delay = (int)db_get_dw(0, META_PROTO, "SetStatusFromOfflineDelay", DEFAULT_SET_STATUS_SLEEP_TIME);
- options.bLockHandle = db_get_b(0, META_PROTO, "LockHandle", false) != 0;
+ g_metaOptions.bSuppressStatus = db_get_b(0, META_PROTO, "SuppressStatus", true) != 0;
+ g_metaOptions.menu_contact_label = (int)db_get_w(0, META_PROTO, "MenuContactLabel", DNT_UID);
+ g_metaOptions.menu_function = (int)db_get_w(0, META_PROTO, "MenuContactFunction", FT_MENU);
+ g_metaOptions.clist_contact_name = (int)db_get_w(0, META_PROTO, "CListContactName", CNNT_DISPLAYNAME);
+ g_metaOptions.set_status_from_offline_delay = (int)db_get_dw(0, META_PROTO, "SetStatusFromOfflineDelay", DEFAULT_SET_STATUS_SLEEP_TIME);
+ g_metaOptions.bLockHandle = db_get_b(0, META_PROTO, "LockHandle", false) != 0;
return 0;
}
@@ -72,21 +72,21 @@ public: virtual void OnInitDialog()
{
- m_btnLock.SetState(options.bLockHandle);
- m_btnCheck.SetState(options.bSuppressStatus);
+ m_btnLock.SetState(g_metaOptions.bLockHandle);
+ m_btnCheck.SetState(g_metaOptions.bSuppressStatus);
- if (options.menu_contact_label == DNT_UID)
+ if (g_metaOptions.menu_contact_label == DNT_UID)
m_btnUid.SetState(true);
else
m_btnDid.SetState(true);
- switch (options.menu_function) {
+ switch (g_metaOptions.menu_function) {
case FT_MSG: m_btnMsg.SetState(true); break;
case FT_MENU: m_btnMenu.SetState(true); break;
case FT_INFO: m_btnInfo.SetState(true); break;
}
- if (options.clist_contact_name == CNNT_NICK)
+ if (g_metaOptions.clist_contact_name == CNNT_NICK)
m_btnNick.SetState(true);
else
m_btnName.SetState(true);
@@ -94,22 +94,22 @@ public: virtual void OnApply()
{
- options.bLockHandle = m_btnLock.GetState() != 0;
- options.bSuppressStatus = m_btnCheck.GetState() != 0;
+ g_metaOptions.bLockHandle = m_btnLock.GetState() != 0;
+ g_metaOptions.bSuppressStatus = m_btnCheck.GetState() != 0;
- if (m_btnUid.GetState()) options.menu_contact_label = DNT_UID;
- else if (m_btnDid.GetState()) options.menu_contact_label = DNT_DID;
+ if (m_btnUid.GetState()) g_metaOptions.menu_contact_label = DNT_UID;
+ else if (m_btnDid.GetState()) g_metaOptions.menu_contact_label = DNT_DID;
- if (m_btnMsg.GetState()) options.menu_function = FT_MSG;
- else if (m_btnMenu.GetState()) options.menu_function = FT_MENU;
- else if (m_btnInfo.GetState()) options.menu_function = FT_INFO;
+ if (m_btnMsg.GetState()) g_metaOptions.menu_function = FT_MSG;
+ else if (m_btnMenu.GetState()) g_metaOptions.menu_function = FT_MENU;
+ else if (m_btnInfo.GetState()) g_metaOptions.menu_function = FT_INFO;
- if (m_btnNick.GetState()) options.clist_contact_name = CNNT_NICK;
- else if (m_btnName.GetState()) options.clist_contact_name = CNNT_DISPLAYNAME;
+ if (m_btnNick.GetState()) g_metaOptions.clist_contact_name = CNNT_NICK;
+ else if (m_btnName.GetState()) g_metaOptions.clist_contact_name = CNNT_DISPLAYNAME;
Meta_WriteOptions();
- Meta_SuppressStatus(options.bSuppressStatus);
+ Meta_SuppressStatus(g_metaOptions.bSuppressStatus);
Meta_SetAllNicks();
}
};
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 5943c196cc..350b30187f 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -157,7 +157,7 @@ INT_PTR Meta_SetStatus(WPARAM wParam, LPARAM) // firstSetOnline starts out true - used to delay metacontact's 'onlineness' to prevent double status notifications on startup
if (mcStatus == ID_STATUS_OFFLINE && firstSetOnline) {
// causes crash on exit if miranda is closed in under options.set_status_from_offline milliseconds!
- setStatusTimerId = SetTimer(0, 0, options.set_status_from_offline_delay, SetStatusThread);
+ setStatusTimerId = SetTimer(0, 0, g_metaOptions.set_status_from_offline_delay, SetStatusThread);
firstSetOnline = FALSE;
}
else {
@@ -484,7 +484,7 @@ int Meta_ContactDeleted(WPARAM hContact, LPARAM) currDb->MetaDetouchSub(cc, i);
// stop ignoring, if we were
- if (options.bSuppressStatus)
+ if (g_metaOptions.bSuppressStatus)
CallService(MS_IGNORE_UNIGNORE, cc->pSubs[i], IGNOREEVENT_USERONLINE);
}
return 0;
@@ -602,7 +602,7 @@ static int Meta_SrmmIconClicked(WPARAM hMeta, LPARAM lParam) continue;
CMStringW tszNick;
- if (options.menu_contact_label == DNT_DID)
+ if (g_metaOptions.menu_contact_label == DNT_DID)
tszNick = cli.pfnGetContactDisplayName(cc->pSubs[i], 0);
else
Meta_GetSubNick(hMeta, i, tszNick);
@@ -677,7 +677,7 @@ INT_PTR Meta_ContactMenuFunc(WPARAM hMeta, LPARAM lParam) MCONTACT hContact = Meta_GetContactHandle(cc, (int)lParam);
- if (options.menu_function == FT_MSG) {
+ if (g_metaOptions.menu_function == FT_MSG) {
// open message window if protocol supports message sending or chat, else simulate double click
char *proto = GetContactProto(hContact);
if (proto) {
@@ -694,9 +694,9 @@ INT_PTR Meta_ContactMenuFunc(WPARAM hMeta, LPARAM lParam) else // protocol does not support messaging - simulate double click
Clist_ContactDoubleClicked(hContact);
}
- else if (options.menu_function == FT_MENU) // show contact's context menu
+ else if (g_metaOptions.menu_function == FT_MENU) // show contact's context menu
CallFunctionAsync(sttMenuThread, (void*)hContact);
- else if (options.menu_function == FT_INFO) // show user info for subcontact
+ else if (g_metaOptions.menu_function == FT_INFO) // show user info for subcontact
CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
return 0;
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index 4ae42c329b..b59e268b1a 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -180,7 +180,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default) currDb->MetaMergeHistory(ccDest, ccSub);
// Ignore status if the option is on
- if (options.bSuppressStatus)
+ if (g_metaOptions.bSuppressStatus)
CallService(MS_IGNORE_IGNORE, hSub, IGNOREEVENT_USERONLINE);
NotifyEventHooks(hSubcontactsChanged, hMeta, 0);
@@ -369,7 +369,7 @@ int Meta_HideLinkedContacts(void) }
}
- if (options.bSuppressStatus)
+ if (g_metaOptions.bSuppressStatus)
CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
MCONTACT hMostOnline = Meta_GetMostOnline(ccMeta); // set nick
@@ -383,7 +383,7 @@ int Meta_HideLinkedContacts(void) int Meta_HideMetaContacts(bool bHide)
{
// set status suppression
- bool bSuppress = bHide ? FALSE : options.bSuppressStatus;
+ bool bSuppress = bHide ? FALSE : g_metaOptions.bSuppressStatus;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
bool bSet;
@@ -420,7 +420,7 @@ int Meta_SuppressStatus(BOOL suppress) int Meta_CopyContactNick(DBCachedContact *ccMeta, MCONTACT hContact)
{
- if (options.bLockHandle)
+ if (g_metaOptions.bLockHandle)
hContact = Meta_GetContactHandle(ccMeta, 0);
if (!hContact)
@@ -430,14 +430,14 @@ int Meta_CopyContactNick(DBCachedContact *ccMeta, MCONTACT hContact) if (szProto == nullptr)
return 1;
- if (options.clist_contact_name == CNNT_NICK) {
+ if (g_metaOptions.clist_contact_name == CNNT_NICK) {
ptrW tszNick(db_get_wsa(hContact, szProto, "Nick"));
if (tszNick) {
db_set_ws(ccMeta->contactID, META_PROTO, "Nick", tszNick);
return 0;
}
}
- else if (options.clist_contact_name == CNNT_DISPLAYNAME) {
+ else if (g_metaOptions.clist_contact_name == CNNT_DISPLAYNAME) {
wchar_t *name = cli.pfnGetContactDisplayName(hContact, 0);
if (name && mir_wstrcmp(name, TranslateT("(Unknown contact)")) != 0) {
db_set_ws(ccMeta->contactID, META_PROTO, "Nick", name);
diff --git a/src/mir_app/src/metacontacts.h b/src/mir_app/src/metacontacts.h index 8aadcca5cb..1008e209ea 100644 --- a/src/mir_app/src/metacontacts.h +++ b/src/mir_app/src/metacontacts.h @@ -95,7 +95,7 @@ struct MetaOptions int set_status_from_offline_delay;
};
-extern MetaOptions options;
+extern MetaOptions g_metaOptions;
int Meta_OptInit(WPARAM wParam, LPARAM lParam);
int Meta_ReadOptions();
|