summaryrefslogtreecommitdiff
path: root/protocols/Twitter/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-12-29 17:27:00 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-12-29 17:27:08 +0300
commitf16cf071e51f4768f20692c99414cb39521fa413 (patch)
tree7dd3cc512fe65fdd546f7753937261c518e5008c /protocols/Twitter/src
parent939048b7ebce6a70c8e243fec36983de7d931e8b (diff)
PROTO_INTERFACE::setAllContactStatuses - common code moved to the core
Diffstat (limited to 'protocols/Twitter/src')
-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
4 files changed, 6 insertions, 13 deletions
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);