summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/connection.cpp2
-rw-r--r--protocols/Discord/src/proto.cpp2
-rw-r--r--protocols/Discord/src/proto.h1
-rw-r--r--protocols/Discord/src/utils.cpp10
-rw-r--r--protocols/FacebookRM/src/connection.cpp4
-rw-r--r--protocols/FacebookRM/src/contacts.cpp28
-rw-r--r--protocols/FacebookRM/src/json.cpp26
-rw-r--r--protocols/FacebookRM/src/proto.cpp2
-rw-r--r--protocols/FacebookRM/src/proto.h1
-rw-r--r--protocols/MSN/src/msn_auth.cpp3
-rw-r--r--protocols/MSN/src/msn_misc.cpp19
-rw-r--r--protocols/MinecraftDynmap/src/communication.cpp3
-rw-r--r--protocols/SkypeWeb/src/skype_accounts.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp16
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp10
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h4
-rw-r--r--protocols/Steam/src/steam_contacts.cpp6
-rw-r--r--protocols/Steam/src/steam_polling.cpp44
-rw-r--r--protocols/Steam/src/steam_proto.cpp4
-rw-r--r--protocols/Steam/src/steam_proto.h1
-rw-r--r--protocols/Twitter/src/connection.cpp3
-rw-r--r--protocols/Twitter/src/contacts.cpp9
-rw-r--r--protocols/Twitter/src/proto.cpp6
-rw-r--r--protocols/Twitter/src/proto.h1
25 files changed, 50 insertions, 159 deletions
diff --git a/protocols/Discord/src/connection.cpp b/protocols/Discord/src/connection.cpp
index 5d8f9677e2..9c3c36da40 100644
--- a/protocols/Discord/src/connection.cpp
+++ b/protocols/Discord/src/connection.cpp
@@ -87,7 +87,7 @@ void CDiscordProto::OnLoggedOut()
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, ID_STATUS_OFFLINE);
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
- SetAllContactStatuses(ID_STATUS_OFFLINE);
+ setAllContactStatuses(ID_STATUS_OFFLINE, true);
}
void CDiscordProto::ShutdownSession()
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index e937ade657..fc935e20d0 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -148,7 +148,7 @@ int CDiscordProto::SetStatus(int iNewStatus)
ShutdownSession();
}
m_iStatus = m_iDesiredStatus;
- SetAllContactStatuses(ID_STATUS_OFFLINE);
+ setAllContactStatuses(ID_STATUS_OFFLINE, true);
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus);
}
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h
index 5970ce26d3..c701a7b98a 100644
--- a/protocols/Discord/src/proto.h
+++ b/protocols/Discord/src/proto.h
@@ -132,7 +132,6 @@ class CDiscordProto : public PROTO<CDiscordProto>
//////////////////////////////////////////////////////////////////////////////////////
// session control
- void SetAllContactStatuses(int iStatus);
void ConnectionFailed(int iReason);
void ShutdownSession(void);
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp
index 0b37e53167..6e6d9700a7 100644
--- a/protocols/Discord/src/utils.cpp
+++ b/protocols/Discord/src/utils.cpp
@@ -17,16 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-void CDiscordProto::SetAllContactStatuses(int status)
-{
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- if (!getByte(hContact, "ChatRoom"))
- setWord(hContact, "Status", (WORD)status);
- else if (status == ID_STATUS_OFFLINE)
- Chat_Terminate(m_szModuleName, ptrW(getWStringA(hContact, "ChatRoomID")));
- }
-}
-
int StrToStatus(const CMStringW &str)
{
if (str == L"idle")
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp
index c8c3bd2329..e66fb5b921 100644
--- a/protocols/FacebookRM/src/connection.cpp
+++ b/protocols/FacebookRM/src/connection.cpp
@@ -55,7 +55,7 @@ void FacebookProto::ChangeStatus(void*)
facy.logout();
OnLeaveChat(NULL, NULL);
- SetAllContactStatuses(ID_STATUS_OFFLINE);
+ setAllContactStatuses(ID_STATUS_OFFLINE);
ToggleStatusMenuItems(false);
delSetting(FACEBOOK_KEY_LOGON_TS);
@@ -161,7 +161,7 @@ void FacebookProto::ChangeStatus(void*)
else { // Change between online/away/invisible statuses
if (new_status == ID_STATUS_INVISIBLE)
// When switching to invisible (from online/away), we need to set all contacts offline as we won't receive no status updates from Facebook
- SetAllContactStatuses(ID_STATUS_OFFLINE);
+ setAllContactStatuses(ID_STATUS_OFFLINE);
}
bool wasAwayOrInvisible = (old_status == ID_STATUS_AWAY || old_status == ID_STATUS_INVISIBLE);
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index 91d52145fd..415a6afb49 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -393,16 +393,6 @@ MCONTACT FacebookProto::AddToContactList(facebook_user* fbu, bool force_add, boo
return hContact;
}
-void FacebookProto::SetAllContactStatuses(int status)
-{
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- if (isChatRoom(hContact))
- continue;
-
- setWord(hContact, "Status", status);
- }
-}
-
void FacebookProto::DeleteContactFromServer(void *data)
{
facy.handle_entry("DeleteContactFromServer");
@@ -638,13 +628,11 @@ void FacebookProto::RefreshUserInfo(void *data)
std::string homepage = FACEBOOK_URL_PROFILE + fbu.user_id;
setString(hContact, "Homepage", homepage.c_str());
- if (!fbu.real_name.empty()) {
+ if (!fbu.real_name.empty())
SaveName(hContact, &fbu);
- }
- if (fbu.gender) {
+ if (fbu.gender)
setByte(hContact, "Gender", fbu.gender);
- }
int oldType = getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE);
// From server we won't get request/approve types, only none, so we don't want to overwrite and lost it in that case
@@ -653,9 +641,8 @@ void FacebookProto::RefreshUserInfo(void *data)
}
// If this contact is page, set it as invisible (if enabled in options)
- if (getBool(FACEBOOK_KEY_PAGES_ALWAYS_ONLINE, DEFAULT_PAGES_ALWAYS_ONLINE) && fbu.type == CONTACT_PAGE) {
+ if (getBool(FACEBOOK_KEY_PAGES_ALWAYS_ONLINE, DEFAULT_PAGES_ALWAYS_ONLINE) && fbu.type == CONTACT_PAGE)
setWord(hContact, "Status", ID_STATUS_INVISIBLE);
- }
CheckAvatarChange(hContact, fbu.image_url);
@@ -686,26 +673,21 @@ void FacebookProto::RefreshUserInfo(void *data)
std::string year = birthday.substr(pos2 + 2, 4);
setWord(hContact, "BirthYear", atoi(year.c_str()));
}
- else {
- // We have to set ANY year, otherwise UserInfoEx shows completely wrong date
+ else // We have to set ANY year, otherwise UserInfoEx shows completely wrong date
setWord(hContact, "BirthYear", 1800);
- }
}
}
ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)nullptr, 0);
}
-
HANDLE FacebookProto::GetAwayMsg(MCONTACT)
{
return nullptr; // Status messages are disabled
}
-int FacebookProto::OnContactDeleted(WPARAM wParam, LPARAM)
+int FacebookProto::OnContactDeleted(WPARAM hContact, LPARAM)
{
- MCONTACT hContact = (MCONTACT)wParam;
-
// Remove this contact from caches
ptrA id(getStringA(hContact, FACEBOOK_KEY_ID));
if (id)
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 01beebc0e4..c7d768c1e7 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -844,11 +844,10 @@ int FacebookProto::ParseMessages(std::string *pData, std::vector<facebook_messag
for (auto itNodes = buddyList.begin(); itNodes != buddyList.end(); ++itNodes) {
std::string id = (*itNodes).name();
+ // Facebook now sends info also about some nonfriends, so we just ignore status change of contacts we don't have in list
MCONTACT hContact = ContactIDToHContact(id);
- if (!hContact) {
- // Facebook now sends info also about some nonfriends, so we just ignore status change of contacts we don't have in list
+ if (!hContact)
continue;
- }
// TODO: Check for friends existence/inexistence? Here we should get all friends (but we're already doing friendslist request, so we should have fresh data already)
@@ -880,27 +879,18 @@ int FacebookProto::ParseMessages(std::string *pData, std::vector<facebook_messag
delSetting(hContact, "LastActiveTS");
// Set users inactive for too long as offline
- if (last_active > 0 && last_active < offlineThreshold) {
+ if (last_active > 0 && last_active < offlineThreshold)
setWord(hContact, "Status", ID_STATUS_OFFLINE);
- }
}
// Probably means client: guess 0 = web, 8 = messenger, 10 = something else?
if (vc_) {
- int vc = vc_.as_int();
wchar_t *client;
-
- if (vc == 0) {
- client = FACEBOOK_CLIENT_WEB;
- }
- else if (vc == 8) {
- client = FACEBOOK_CLIENT_MESSENGER; // I was online on Miranda, but when looked at myself at messenger.com I had icon of Messenger.
- }
- else if (vc == 10) {
- client = FACEBOOK_CLIENT_MOBILE;
- }
- else {
- client = FACEBOOK_CLIENT_OTHER;
+ switch (vc_.as_int()) {
+ case 0: client = FACEBOOK_CLIENT_WEB; break;
+ case 8: client = FACEBOOK_CLIENT_MESSENGER; break;
+ case 10: client = FACEBOOK_CLIENT_MOBILE; break;
+ default: client = FACEBOOK_CLIENT_OTHER; break;
}
setWString(hContact, "MirVer", client);
}
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 4d42208359..f365cee0ea 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -99,7 +99,7 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) :
facy.set_handle(m_hNetlibUser);
// Set all contacts offline -- in case we crashed
- SetAllContactStatuses(ID_STATUS_OFFLINE);
+ setAllContactStatuses(ID_STATUS_OFFLINE);
// register special type of event
// there's no need to declare the special service for getting text
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index d3306433f9..779b6bc11d 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -221,7 +221,6 @@ public:
std::string ThreadIDToContactID(const std::string&);
void LoadContactInfo(facebook_user* fbu);
MCONTACT AddToContactList(facebook_user*, bool force_add = false, bool add_temporarily = false);
- void SetAllContactStatuses(int status);
MCONTACT HContactFromAuthEvent(MEVENT hEvent);
void StartTyping(MCONTACT hContact);
void StopTyping(MCONTACT hContact);
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp
index 228792b274..c9a2715370 100644
--- a/protocols/MSN/src/msn_auth.cpp
+++ b/protocols/MSN/src/msn_auth.cpp
@@ -330,8 +330,9 @@ int debugLogSkyLoginA(void *Pproto, LPCSTR szFormat, ...)
va_list args;
va_start(args, szFormat);
- ProtoLogA(pProto, szFormat, args);
+ CMStringA body; body.FormatV(szFormat, args);
va_end(args);
+ pProto->debugLogA("%s", body.c_str());
return 1;
}
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 9a7f7157bf..8376d8b8f4 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -368,24 +368,7 @@ void CMsnProto::MSN_GoOffline(void)
int msnOldStatus = m_iStatus; m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)msnOldStatus, ID_STATUS_OFFLINE);
isIdle = false;
-
- MCONTACT hContact = NULL;
-
- for (hContact = db_find_first(m_szModuleName); hContact;
- hContact = db_find_next(hContact, m_szModuleName))
- {
- if (isChatRoom(hContact) != 0) {
- ptrW wszRoom(getWStringA(hContact, "ChatRoomID"));
- if (wszRoom != NULL)
- Chat_Control(m_szModuleName, wszRoom, SESSION_OFFLINE);
- }
- else {
- if (ID_STATUS_OFFLINE != getWord(hContact, "Status", ID_STATUS_OFFLINE)) {
- setWord(hContact, "Status", ID_STATUS_OFFLINE);
- setDword(hContact, "IdleTS", 0);
- }
- }
- }
+ setAllContactStatuses(ID_STATUS_OFFLINE, true);
}
}
diff --git a/protocols/MinecraftDynmap/src/communication.cpp b/protocols/MinecraftDynmap/src/communication.cpp
index ccc7405596..f82f4030e4 100644
--- a/protocols/MinecraftDynmap/src/communication.cpp
+++ b/protocols/MinecraftDynmap/src/communication.cpp
@@ -409,9 +409,6 @@ void MinecraftDynmapProto::SignOffWorker(void*)
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
- //SetAllContactStatuses(ID_STATUS_OFFLINE);
- //ToggleStatusMenuItems(false);
-
if (hConnection)
Netlib_CloseHandle(hConnection);
hConnection = nullptr;
diff --git a/protocols/SkypeWeb/src/skype_accounts.cpp b/protocols/SkypeWeb/src/skype_accounts.cpp
index 1e54acb021..f5c01b0c4f 100644
--- a/protocols/SkypeWeb/src/skype_accounts.cpp
+++ b/protocols/SkypeWeb/src/skype_accounts.cpp
@@ -51,7 +51,7 @@ CSkypeProto* CSkypeProto::GetContactAccount(MCONTACT hContact)
int CSkypeProto::OnAccountLoaded(WPARAM, LPARAM)
{
- SetAllContactsStatus(ID_STATUS_OFFLINE);
+ setAllContactStatuses(ID_STATUS_OFFLINE, true);
HookProtoEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit);
HookProtoEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnPreCreateMessage);
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 9dbb8032a8..78ea23d170 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -32,22 +32,6 @@ void CSkypeProto::InitGroupChatModule()
CreateProtoService(PS_LEAVECHAT, &CSkypeProto::OnLeaveChatRoom);
}
-void CSkypeProto::CloseAllChatChatSessions()
-{
- GC_INFO gci = { 0 };
- gci.Flags = GCF_BYINDEX | GCF_ID;
- gci.pszModule = m_szModuleName;
-
- int count = pci->SM_GetCount(m_szModuleName);
- for (int i = 0; i < count; i++) {
- gci.iItem = i;
- if (!Chat_GetInfo(&gci)) {
- Chat_Control(m_szModuleName, gci.pszID, SESSION_OFFLINE);
- Chat_Terminate(m_szModuleName, gci.pszID);
- }
- }
-}
-
MCONTACT CSkypeProto::FindChatRoom(const char *chatname)
{
SESSION_INFO *si = pci->SM_FindSession(_A2T(chatname), m_szModuleName);
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
index 58b7f8ea82..1ee5fbe0a3 100644
--- a/protocols/SkypeWeb/src/skype_contacts.cpp
+++ b/protocols/SkypeWeb/src/skype_contacts.cpp
@@ -32,16 +32,6 @@ void CSkypeProto::SetContactStatus(MCONTACT hContact, WORD status)
}
}
-void CSkypeProto::SetAllContactsStatus(WORD status)
-{
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- if (!isChatRoom(hContact))
- SetContactStatus(hContact, status);
- }
- if (status == ID_STATUS_OFFLINE)
- CloseAllChatChatSessions();
-}
-
void CSkypeProto::SetChatStatus(MCONTACT hContact, int iStatus)
{
ptrW tszChatID(getWStringA(hContact, "ChatRoomID"));
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp
index 58406f4630..8535578bde 100644
--- a/protocols/SkypeWeb/src/skype_proto.cpp
+++ b/protocols/SkypeWeb/src/skype_proto.cpp
@@ -261,7 +261,7 @@ int CSkypeProto::SetStatus(int iNewStatus)
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, ID_STATUS_OFFLINE);
if (!Miranda_IsTerminated())
- SetAllContactsStatus(ID_STATUS_OFFLINE);
+ setAllContactStatuses(ID_STATUS_OFFLINE, true);
return 0;
}
else {
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index cc70467445..21a14c69c1 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -279,7 +279,6 @@ private:
// contacts
WORD GetContactStatus(MCONTACT hContact);
void SetContactStatus(MCONTACT hContact, WORD status);
- void SetAllContactsStatus(WORD status);
void SetAvatarUrl(MCONTACT hContact, CMStringW &tszUrl);
void ReloadAvatarInfo(MCONTACT hContact);
@@ -325,15 +324,12 @@ private:
// sync
void OnGetServerHistory(const NETLIBHTTPREQUEST *response);
void OnSyncHistory(const NETLIBHTTPREQUEST *response);
- void SyncHistory();
//chats
void InitGroupChatModule();
- void CloseAllChatChatSessions();
MCONTACT FindChatRoom(const char *chatname);
- MCONTACT AddChatRoom(const char *chatname);
int __cdecl OnGroupChatEventHook(WPARAM, LPARAM lParam);
int __cdecl OnGroupChatMenuHook(WPARAM, LPARAM lParam);
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index fddad8a4a5..98f06662de 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -48,12 +48,6 @@ void CSteamProto::SetContactStatus(MCONTACT hContact, WORD status)
}
}
-void CSteamProto::SetAllContactsStatus(WORD status)
-{
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
- SetContactStatus(hContact, status);
-}
-
MCONTACT CSteamProto::GetContactFromAuthEvent(MEVENT hEvent)
{
DWORD body[3];
diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp
index 78ffd06c8b..2397b7531c 100644
--- a/protocols/Steam/src/steam_polling.cpp
+++ b/protocols/Steam/src/steam_polling.cpp
@@ -11,8 +11,7 @@ void CSteamProto::ParsePollData(const JSONNode &data)
time_t timestamp = _wtol(item["utc_timestamp"].as_mstring());
MCONTACT hContact = NULL;
- if (!IsMe(steamId.c_str()) &&
- !(hContact = FindContact(steamId.c_str())))
+ if (!IsMe(steamId.c_str()) && !(hContact = FindContact(steamId.c_str())))
// probably this is info about random player playing on same server, so we ignore it
continue;
@@ -79,35 +78,30 @@ void CSteamProto::ParsePollData(const JSONNode &data)
switch (state)
{
case 0:
- {// removed
- MCONTACT hContact = FindContact(steamId.c_str());
- if (hContact)
- ContactIsRemoved(hContact);
- }
+ hContact = FindContact(steamId.c_str());
+ if (hContact)
+ ContactIsRemoved(hContact);
break;
case 1:
- {// ignored
- MCONTACT hContact = FindContact(steamId.c_str());
- if (hContact)
- ContactIsIgnored(hContact);
- }
+ hContact = FindContact(steamId.c_str());
+ if (hContact)
+ ContactIsIgnored(hContact);
break;
case 2:
- {// auth request
- MCONTACT hContact = FindContact(steamId.c_str());
- if (hContact)
- ContactIsAskingAuth(hContact);
- else
- {
- // load info about this user from server
- ptrA token(getStringA("TokenSecret"));
-
- PushRequest(
- new GetUserSummariesRequest(token, steamId.c_str()),
- &CSteamProto::OnAuthRequested);
- }
+ // auth request
+ hContact = FindContact(steamId.c_str());
+ if (hContact)
+ ContactIsAskingAuth(hContact);
+ else
+ {
+ // load info about this user from server
+ ptrA token(getStringA("TokenSecret"));
+
+ PushRequest(
+ new GetUserSummariesRequest(token, steamId.c_str()),
+ &CSteamProto::OnAuthRequested);
}
break;
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp
index fd7d5cf9d8..52022b10d5 100644
--- a/protocols/Steam/src/steam_proto.cpp
+++ b/protocols/Steam/src/steam_proto.cpp
@@ -46,7 +46,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName)
db_set_resident(m_szModuleName, "ServerIP");
db_set_resident(m_szModuleName, "ServerID");
- SetAllContactsStatus(ID_STATUS_OFFLINE);
+ setAllContactStatuses(ID_STATUS_OFFLINE);
// services
CreateServiceFunction(MODULE"/MenuChoose", CSteamProto::MenuChooseService);
@@ -318,7 +318,7 @@ int CSteamProto::SetStatus(int new_status)
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
if (!Miranda_IsTerminated())
- SetAllContactsStatus(ID_STATUS_OFFLINE);
+ setAllContactStatuses(ID_STATUS_OFFLINE);
LogOut();
}
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h
index fee78f4b02..d53e21b009 100644
--- a/protocols/Steam/src/steam_proto.h
+++ b/protocols/Steam/src/steam_proto.h
@@ -147,7 +147,6 @@ protected:
// contacts
void SetContactStatus(MCONTACT hContact, WORD status);
- void SetAllContactsStatus(WORD status);
MCONTACT GetContactFromAuthEvent(MEVENT hEvent);
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp
index 95e83c0a47..98928756ca 100644
--- a/protocols/Twitter/src/connection.cpp
+++ b/protocols/Twitter/src/connection.cpp
@@ -67,7 +67,8 @@ void TwitterProto::SignOn(void*)
if (!in_chat_ && getByte(TWITTER_KEY_CHATFEED))
OnJoinChat(0, true);
- SetAllContactStatuses(ID_STATUS_ONLINE);
+ setAllContactStatuses(ID_STATUS_ONLINE);
+ SetChatStatus(ID_STATUS_ONLINE);
hMsgLoop_ = ForkThreadEx(&TwitterProto::MessageLoop, nullptr, nullptr);
}
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp
index ea8d299c22..b71f6a011f 100644
--- a/protocols/Twitter/src/contacts.cpp
+++ b/protocols/Twitter/src/contacts.cpp
@@ -263,12 +263,3 @@ MCONTACT TwitterProto::AddToClientList(const char *name, const char *status)
return 0;
}
-
-void TwitterProto::SetAllContactStatuses(int status)
-{
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
- if (!getByte(hContact, "ChatRoom"))
- setWord(hContact, "Status", (WORD)status);
-
- SetChatStatus(status);
-}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index ccb1132806..5db294c884 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -177,7 +177,8 @@ int TwitterProto::SetStatus(int new_status)
else if (new_status == ID_STATUS_OFFLINE) {
twit_.Disconnect();
m_iStatus = m_iDesiredStatus;
- SetAllContactStatuses(ID_STATUS_OFFLINE);
+ setAllContactStatuses(ID_STATUS_OFFLINE);
+ SetChatStatus(ID_STATUS_OFFLINE);
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
}
@@ -342,7 +343,8 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM)
evt.flags = DETF_HISTORY | DETF_MSGWINDOW;
DbEvent_RegisterType(&evt);
- SetAllContactStatuses(ID_STATUS_OFFLINE); // In case we crashed last time
+ setAllContactStatuses(ID_STATUS_OFFLINE); // In case we crashed last time
+ SetChatStatus(ID_STATUS_OFFLINE);
return 0;
}
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h
index 8484917775..6ebf15a124 100644
--- a/protocols/Twitter/src/proto.h
+++ b/protocols/Twitter/src/proto.h
@@ -95,7 +95,6 @@ private:
bool IsMyContact(MCONTACT, bool include_chat = false);
MCONTACT UsernameToHContact(const char *);
MCONTACT AddToClientList(const char *, const char *);
- void SetAllContactStatuses(int);
static void CALLBACK APC_callback(ULONG_PTR p);