summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-04 18:51:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-04 18:51:53 +0000
commitecb177cadbcff850a16c4b9e306beb15f61ac6f9 (patch)
treeda36e3107747a5f37dbd078197d584054057609f /protocols/JabberG
parent808f3b5e0fefeb560ce5393bf8311927d0927411 (diff)
kernel extraicons, part II
git-svn-id: http://svn.miranda-ng.org/main/trunk@2188 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_util.cpp11
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp102
2 files changed, 50 insertions, 63 deletions
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index a7650c5cd0..f0b85068db 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -1199,20 +1199,17 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc( void* param )
return;
ppro->m_pInfoFrame->LockUpdates();
- if (!ppro->m_bJabberOnline)
- {
+ if (!ppro->m_bJabberOnline) {
ppro->m_pInfoFrame->RemoveInfoItem("$/PEP");
ppro->m_pInfoFrame->RemoveInfoItem("$/Transports");
ppro->m_pInfoFrame->UpdateInfoItem("$/JID", LoadSkinnedIconHandle(SKINICON_OTHER_USERDETAILS), TranslateT("Offline"));
- } else
- {
+ }
+ else {
ppro->m_pInfoFrame->UpdateInfoItem("$/JID", LoadSkinnedIconHandle(SKINICON_OTHER_USERDETAILS), ppro->m_szJabberJID);
if (!ppro->m_bPepSupported)
- {
ppro->m_pInfoFrame->RemoveInfoItem("$/PEP");
- } else
- {
+ else {
ppro->m_pInfoFrame->RemoveInfoItem("$/PEP/");
ppro->m_pInfoFrame->CreateInfoItem("$/PEP", false);
ppro->m_pInfoFrame->UpdateInfoItem("$/PEP", ppro->GetIconHandle(IDI_PL_LIST_ANY), TranslateT("Advanced Status"));
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index c0e278de66..b88c0282c3 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -719,13 +719,11 @@ void CPepMood::SetExtraIcon(HANDLE hContact, char *szMood)
void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText)
{
int mood = -1;
- if (szMood)
- {
+ if (szMood) {
char* p = mir_t2a( szMood );
for (int i = 1; i < SIZEOF(g_arrMoods); ++i)
- if (!lstrcmpA(g_arrMoods[i].szTag, p ))
- {
+ if (!lstrcmpA(g_arrMoods[i].szTag, p )) {
mood = i;
break;
}
@@ -736,32 +734,29 @@ void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText
return;
}
- if (!hContact)
- {
+ if (!hContact) {
m_mode = mood;
replaceStrT(m_text, szText);
HANDLE hIcon = (mood >= 0) ? m_icons.GetIcolibHandle(g_arrMoods[mood].szTag) : LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT);
TCHAR title[128];
- if (mood >= 0)
- {
- mir_sntprintf(title, SIZEOF(title), TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", m_icons.GetIcolibHandle(g_arrMoods[mood].szTag), TranslateTS(g_arrMoods[mood].szName));
- } else
- {
- lstrcpy(title, LPGENT("Set mood..."));
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set mood..."));
+ if (m_proto->m_pInfoFrame) {
+ if (mood >= 0) {
+ mir_sntprintf(title, SIZEOF(title), TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
+ m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", m_icons.GetIcolibHandle(g_arrMoods[mood].szTag), TranslateTS(g_arrMoods[mood].szName));
+ }
+ else {
+ lstrcpy(title, LPGENT("Set mood..."));
+ m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set mood..."));
+ }
}
UpdateMenuItem(hIcon, title);
- } else
- {
- SetExtraIcon(hContact, mood < 0 ? NULL : g_arrMoods[mood].szTag);
}
+ else SetExtraIcon(hContact, mood < 0 ? NULL : g_arrMoods[mood].szTag);
- if (szMood)
- {
+ if (szMood) {
m_proto->JSetByte(hContact, DBSETTING_XSTATUSID, mood);
m_proto->JSetStringT(hContact, DBSETTING_XSTATUSNAME, TranslateTS(g_arrMoods[mood].szName));
if (szText)
@@ -770,8 +765,8 @@ void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText
m_proto->JDeleteSetting(hContact, DBSETTING_XSTATUSMSG);
m_proto->WriteAdvStatus(hContact, ADVSTATUS_MOOD, szMood, m_icons.GetIcolibName(g_arrMoods[mood].szTag), TranslateTS(g_arrMoods[mood].szName), szText);
- } else
- {
+ }
+ else {
m_proto->JDeleteSetting(hContact, DBSETTING_XSTATUSID);
m_proto->JDeleteSetting(hContact, DBSETTING_XSTATUSNAME);
m_proto->JDeleteSetting(hContact, DBSETTING_XSTATUSMSG);
@@ -797,17 +792,18 @@ void CPepMood::ShowSetDialog(BYTE bQuiet)
replaceStrT(m_text, dlg.GetStatusText());
}
- if (m_mode >= 0)
- {
- Publish();
+ if (m_proto->m_pInfoFrame) {
+ if (m_mode >= 0) {
+ Publish();
- UpdateMenuItem(m_icons.GetIcolibHandle(g_arrMoods[m_mode].szTag), g_arrMoods[m_mode].szName);
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", m_icons.GetIcolibHandle(g_arrMoods[m_mode].szTag), TranslateTS(g_arrMoods[m_mode].szName));
- } else
- {
- Retract();
- UpdateMenuItem(LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), LPGENT("Set mood..."));
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set mood..."));
+ UpdateMenuItem(m_icons.GetIcolibHandle(g_arrMoods[m_mode].szTag), g_arrMoods[m_mode].szName);
+ m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", m_icons.GetIcolibHandle(g_arrMoods[m_mode].szTag), TranslateTS(g_arrMoods[m_mode].szName));
+ }
+ else {
+ Retract();
+ UpdateMenuItem(LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), LPGENT("Set mood..."));
+ m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set mood..."));
+ }
}
}
@@ -1140,10 +1136,8 @@ void CPepActivity::SetExtraIcon(HANDLE hContact, char *szActivity)
void CPepActivity::SetActivity(HANDLE hContact, LPCTSTR szFirst, LPCTSTR szSecond, LPCTSTR szText)
{
int activity = -1;
- if (szFirst || szSecond)
- {
+ if (szFirst || szSecond) {
activity = ActivityCheck(szFirst, szSecond);
-
if (activity < 0)
return;
}
@@ -1151,38 +1145,34 @@ void CPepActivity::SetActivity(HANDLE hContact, LPCTSTR szFirst, LPCTSTR szSecon
TCHAR activityTitle[128];
ActivityBuildTitle(activity, activityTitle, SIZEOF(activityTitle));
- if (!hContact)
- {
+ if (!hContact) {
m_mode = activity;
replaceStrT(m_text, szText);
HANDLE hIcon = (activity >= 0) ? m_icons.GetIcolibHandle(returnActivity(activity)) : LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT);
TCHAR title[128];
- if (activity >= 0)
- {
- mir_sntprintf(title, SIZEOF(title), TranslateT("Activity: %s"), activityTitle);
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", m_icons.GetIcolibHandle(returnActivity(activity)), activityTitle);
- } else
- {
- lstrcpy(title, LPGENT("Set activity..."));
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set activity..."));
+ if (m_proto->m_pInfoFrame) {
+ if (activity >= 0) {
+ mir_sntprintf(title, SIZEOF(title), TranslateT("Activity: %s"), activityTitle);
+ m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", m_icons.GetIcolibHandle(returnActivity(activity)), activityTitle);
+ }
+ else {
+ lstrcpy(title, LPGENT("Set activity..."));
+ m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set activity..."));
+ }
}
UpdateMenuItem(hIcon, title);
- } else
- {
- SetExtraIcon(hContact, activity < 0 ? NULL : returnActivity(activity));
}
-
+ else SetExtraIcon(hContact, activity < 0 ? NULL : returnActivity(activity));
if (activity >= 0) {
TCHAR* p = mir_a2t( ActivityGetId(activity));
m_proto->WriteAdvStatus(hContact, ADVSTATUS_ACTIVITY, p, m_icons.GetIcolibName(returnActivity(activity)), activityTitle, szText);
mir_free( p );
}
- else
- m_proto->ResetAdvStatus(hContact, ADVSTATUS_ACTIVITY);
+ else m_proto->ResetAdvStatus(hContact, ADVSTATUS_ACTIVITY);
}
void CPepActivity::ShowSetDialog(BYTE bQuiet)
@@ -1203,12 +1193,14 @@ void CPepActivity::ShowSetDialog(BYTE bQuiet)
Publish();
UpdateMenuItem(m_icons.GetIcolibHandle(returnActivity(m_mode)), g_arrActivities[m_mode].szTitle);
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", m_icons.GetIcolibHandle(returnActivity(m_mode)), TranslateTS(g_arrActivities[m_mode].szTitle));
- } else
- {
+ if (m_proto->m_pInfoFrame)
+ m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", m_icons.GetIcolibHandle(returnActivity(m_mode)), TranslateTS(g_arrActivities[m_mode].szTitle));
+ }
+ else {
Retract();
UpdateMenuItem(LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), LPGENT("Set activity..."));
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set activity..."));
+ if (m_proto->m_pInfoFrame)
+ m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set activity..."));
}
}
@@ -2050,9 +2042,7 @@ void CJabberInfoFrame::SetInfoItemCallback(char *pszName, void (CJabberProto::*o
{
CJabberInfoFrameItem item(pszName);
if (CJabberInfoFrameItem *pItem = m_pItems.find(&item))
- {
pItem->m_onEvent = onEvent;
- }
}
void CJabberInfoFrame::UpdateInfoItem(char *pszName, HANDLE hIcolibIcon, TCHAR *pszText)