summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ/src/utilities.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-08 13:58:24 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-08 13:58:31 +0300
commit6206d9efcead4e4cd92df1b6c9bb0150d13052cc (patch)
tree780e6bee288a40d65886d374af6a116a0dc89ea7 /protocols/IcqOscarJ/src/utilities.cpp
parent7b5a7da18a7834e9eb3aaa25cad0f256491c90ee (diff)
fixes #1154 (Invisible" status is broken)
This reverts commit 1ca493fc7af16dd20ad13453fc19774da3c65181.
Diffstat (limited to 'protocols/IcqOscarJ/src/utilities.cpp')
-rw-r--r--protocols/IcqOscarJ/src/utilities.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp
index db1af286c9..97253e2cc1 100644
--- a/protocols/IcqOscarJ/src/utilities.cpp
+++ b/protocols/IcqOscarJ/src/utilities.cpp
@@ -1095,6 +1095,44 @@ void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay)
}
+int CIcqProto::SetStatusNote(const char *szStatusNote, DWORD dwDelay, int bForce)
+{
+ int bChanged = FALSE;
+
+ // bForce is intended for login sequence - need to call this earlier than icqOnline()
+ // the process is delayed and icqOnline() is ready when needed inside SetStatusNoteThread()
+ if (!bForce && !icqOnline()) return bChanged;
+
+ // reuse generic critical section (used for cookies list and object variables locks)
+ mir_cslock l(cookieMutex);
+
+ if (!setStatusNoteText && (!m_bMoodsEnabled || !setStatusMoodData)) { // check if the status note was changed and if yes, create thread to change it
+ char *szCurrentStatusNote = getSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, nullptr);
+
+ if (mir_strcmp(szCurrentStatusNote, szStatusNote)) { // status note was changed
+ // create thread to change status note on existing server connection
+ setStatusNoteText = null_strdup(szStatusNote);
+
+ if (dwDelay)
+ ForkThread(&CIcqProto::SetStatusNoteThread, (void*)dwDelay);
+ else // we cannot afford any delay, so do not run in separate thread
+ SetStatusNoteThread(nullptr);
+
+ bChanged = TRUE;
+ }
+ SAFE_FREE(&szCurrentStatusNote);
+ }
+ else { // only alter status note object with new status note, keep the thread waiting for execution
+ SAFE_FREE(&setStatusNoteText);
+ setStatusNoteText = null_strdup(szStatusNote);
+
+ bChanged = TRUE;
+ }
+
+ return bChanged;
+}
+
+
int CIcqProto::SetStatusMood(const char *szMoodData, DWORD dwDelay)
{
int bChanged = FALSE;