summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MyDetails/src/commons.h2
-rw-r--r--plugins/MyDetails/src/data.cpp17
-rw-r--r--plugins/MyDetails/src/data.h2
-rw-r--r--plugins/MyDetails/src/frame.cpp40
-rw-r--r--plugins/MyDetails/src/mydetails.cpp12
5 files changed, 72 insertions, 1 deletions
diff --git a/plugins/MyDetails/src/commons.h b/plugins/MyDetails/src/commons.h
index ee2e8c56eb..2a40d0e2e1 100644
--- a/plugins/MyDetails/src/commons.h
+++ b/plugins/MyDetails/src/commons.h
@@ -46,6 +46,8 @@ Boston, MA 02111-1307, USA.
#include <m_proto_listeningto.h>
#include <m_listeningto.h>
#include <m_statusplugins.h>
+#include <m_awaymsg.h>
+#include <m_simplestatusmsg.h>
#include <m_smileyadd.h>
#include <m_mydetails.h>
#include <m_skin_eng.h>
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp
index 8244c6e7b2..66f91b9e93 100644
--- a/plugins/MyDetails/src/data.cpp
+++ b/plugins/MyDetails/src/data.cpp
@@ -219,6 +219,10 @@ void Protocol::GetStatusMsg(int aStatus, TCHAR *msg, size_t msg_size)
ptrT tmp((TCHAR *)CallProtoService(name, PS_GETMYAWAYMSG, 0, SGMA_TCHAR));
lcopystr(msg, tmp == NULL ? _T("") : tmp, msg_size);
}
+ else if (ServiceExists(MS_AWAYMSG_GETSTATUSMSGT)) {
+ ptrT tmp((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)aStatus, 0));
+ lcopystr(msg, tmp == NULL ? _T("") : tmp, msg_size);
+ }
}
TCHAR* Protocol::GetStatusMsg()
@@ -439,6 +443,13 @@ Protocol *ProtocolArray::Get(const char *name)
return NULL;
}
+
+bool ProtocolArray::CanSetStatusMsgPerProtocol()
+{
+ return ServiceExists(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG) != 0;
+}
+
+
void ProtocolArray::GetAvatars()
{
for (int i = 0; i < buffer_len; i++)
@@ -547,6 +558,12 @@ TCHAR *ProtocolArray::GetDefaultStatusMsg(int status)
if (status == ID_STATUS_CONNECTING)
status = ID_STATUS_OFFLINE;
+ TCHAR *tmp = (TCHAR *)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)status, 0);
+ if (tmp != NULL) {
+ lstrcpyn(default_status_message, tmp, SIZEOF(default_status_message));
+ mir_free(tmp);
+ }
+
return default_status_message;
}
diff --git a/plugins/MyDetails/src/data.h b/plugins/MyDetails/src/data.h
index 803c6ecc23..53bc6ade9d 100644
--- a/plugins/MyDetails/src/data.h
+++ b/plugins/MyDetails/src/data.h
@@ -134,6 +134,8 @@ public:
void GetStatuses();
int GetGlobalStatus();
+ bool CanSetStatusMsgPerProtocol();
+
void GetDefaultNick(); // Copy to cache
void GetDefaultAvatar(); // Copy to cache
TCHAR *GetDefaultStatusMsg(); // Copy to cache
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp
index 3e1309edd8..2469e22728 100644
--- a/plugins/MyDetails/src/frame.cpp
+++ b/plugins/MyDetails/src/frame.cpp
@@ -1806,6 +1806,26 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
HMENU submenu = GetSubMenu(menu, 3);
TranslateMenu(submenu);
+ if (protocols->CanSetStatusMsgPerProtocol()) {
+ // Add this proto to menu
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."), proto->description);
+
+ MENUITEMINFO mii = {0};
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_ID | MIIM_TYPE;
+ mii.fType = MFT_STRING;
+ mii.dwTypeData = tmp;
+ mii.cch = (int)_tcslen(tmp);
+ mii.wID = 1;
+
+ if (!proto->CanSetStatusMsg()) {
+ mii.fMask |= MIIM_STATE;
+ mii.fState = MFS_DISABLED;
+ }
+
+ InsertMenuItem(submenu, 0, TRUE, &mii);
+ }
+
// Add this to menu
mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."),
CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->status, GSMDF_TCHAR));
@@ -1907,6 +1927,26 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
InsertMenuItem(submenu, 0, TRUE, &mii);
+ if (protocols->CanSetStatusMsgPerProtocol()) {
+ // Add this proto to menu
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."), proto->description);
+
+ ZeroMemory(&mii, sizeof(mii));
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_ID | MIIM_TYPE;
+ mii.fType = MFT_STRING;
+ mii.dwTypeData = tmp;
+ mii.cch = (int)_tcslen(tmp);
+ mii.wID = 3;
+
+ if ( !proto->CanSetStatusMsg()) {
+ mii.fMask |= MIIM_STATE;
+ mii.fState = MFS_DISABLED;
+ }
+
+ InsertMenuItem(submenu, 0, TRUE, &mii);
+ }
+
mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my nickname for %s..."), proto->description);
ZeroMemory(&mii, sizeof(mii));
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp
index 5316f302eb..0ccf19a2d5 100644
--- a/plugins/MyDetails/src/mydetails.cpp
+++ b/plugins/MyDetails/src/mydetails.cpp
@@ -488,9 +488,19 @@ static INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam)
if (proto_num == -1)
return -1;
- if (!proto->CanSetStatusMsg())
+ if (protocols->CanSetStatusMsgPerProtocol() && !proto->CanSetStatusMsg())
return -2;
}
+ else if (ServiceExists(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG)) {
+ if (proto == NULL && status == 0)
+ CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, protocols->GetGlobalStatus(), NULL);
+ else if (status == 0)
+ CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, proto->status, (LPARAM)proto_name);
+ else
+ CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, status, (LPARAM)proto_name);
+
+ return 0;
+ }
if (proto == NULL || proto->status != ID_STATUS_OFFLINE) {
if (!status_msg_dialog_open) {