diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-03 16:02:14 +0200 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-03 16:02:14 +0200 |
commit | 3ad2582c4a4a6378f294f9256ecbcbdf0ae88e3a (patch) | |
tree | 412a28ef6a572efc7039df1c363bf47a3dec4b19 /protocols/FacebookRM | |
parent | 9a6f750a482d1d1ebf4281bb7bf8133e547ad438 (diff) |
mir_forkThread<typename> - stronger typizatioin for thread function parameter
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/src/chat.cpp | 8 | ||||
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/connection.cpp | 12 | ||||
-rw-r--r-- | protocols/FacebookRM/src/contacts.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/feeds.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 4 | ||||
-rw-r--r-- | protocols/FacebookRM/src/main.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/messages.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 4 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.cpp | 4 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.h | 4 |
11 files changed, 23 insertions, 23 deletions
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index 85aba15848..61c6fcd14a 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -57,7 +57,7 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char * GCEVENT gce = { m_szModuleName, tchat_id, GC_EVENT_MESSAGE }; gce.ptszText = ttext; - gce.time = timestamp ? timestamp : ::time(nullptr); + gce.time = timestamp ? timestamp : ::time(0); if (id != nullptr) gce.bIsMe = !mir_strcmp(id, facy.self_.user_id.c_str()); gce.dwFlags |= GCEF_ADDTOLOG; @@ -180,7 +180,7 @@ void FacebookProto::AddChatContact(const char *chat_id, const chatroom_participa gce.dwFlags = addToLog ? GCEF_ADDTOLOG : 0; gce.ptszNick = tnick; gce.ptszUID = tid; - gce.time = ::time(nullptr); + gce.time = ::time(0); gce.bIsMe = (user.role == ROLE_ME); if (user.is_former) { @@ -213,7 +213,7 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const gce.dwFlags = GCEF_ADDTOLOG; gce.ptszNick = tnick; gce.ptszUID = tid; - gce.time = ::time(nullptr); + gce.time = ::time(0); gce.bIsMe = false; Chat_Event(&gce); @@ -390,7 +390,7 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat GCEVENT gce = { m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_MESSAGE }; gce.ptszText = messageT; - gce.time = notification->time ? notification->time : ::time(nullptr); + gce.time = notification->time ? notification->time : ::time(0); gce.bIsMe = false; gce.dwFlags |= GCEF_ADDTOLOG; gce.ptszNick = TranslateT("Notifications"); diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index ee1049079f..de12e9075f 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -922,7 +922,7 @@ bool facebook_client::activity_ping() http::response resp = sendRequest(channelRequest(PING)); // Remember this last ping time - parent->m_pingTS = ::time(nullptr); + parent->m_pingTS = ::time(0); if (resp.data.empty() || resp.data.find("\"t\":\"pong\"") == resp.data.npos) { // Something went wrong diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index 4b54c41187..79a0f5e03b 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -108,7 +108,7 @@ void FacebookProto::ChangeStatus(void*) if (getByte(FACEBOOK_KEY_EVENT_ON_THIS_DAY_ENABLE, DEFAULT_EVENT_ON_THIS_DAY_ENABLE)) ForkThread(&FacebookProto::ProcessMemories, nullptr); - setDword(FACEBOOK_KEY_LOGON_TS, (DWORD)time(nullptr)); + setDword(FACEBOOK_KEY_LOGON_TS, (DWORD)time(0)); ForkThread(&FacebookProto::UpdateLoop, nullptr); ForkThread(&FacebookProto::MessageLoop, nullptr); @@ -146,7 +146,7 @@ void FacebookProto::ChangeStatus(void*) bool isAwayOrInvisible = (new_status == ID_STATUS_AWAY || new_status == ID_STATUS_INVISIBLE); if (!wasAwayOrInvisible && isAwayOrInvisible) { // Switching from "not-away" to "away" state, remember timestamp of this change (and if we are idle already, use the idle time) - m_awayTS = (m_idleTS > 0 ? m_idleTS : ::time(nullptr)); + m_awayTS = (m_idleTS > 0 ? m_idleTS : ::time(0)); } else if (wasAwayOrInvisible && !isAwayOrInvisible) { // Switching from "away" to "not-away" state, reset the timestamp @@ -182,7 +182,7 @@ bool FacebookProto::NegotiateConnection() password = mir_utf8encode(password); // Refresh last time of feeds update - facy.last_feeds_update_ = ::time(nullptr); + facy.last_feeds_update_ = ::time(0); // Generate random clientid for this connection facy.chat_clientid_ = utils::text::rand_string(8, "0123456789abcdef", &facy.random_); @@ -196,7 +196,7 @@ bool FacebookProto::NegotiateConnection() void FacebookProto::UpdateLoop(void *) { - time_t tim = ::time(nullptr); + time_t tim = ::time(0); debugLogA(">>> Entering Facebook::UpdateLoop[%d]", tim); for (int i = -1; !isOffline(); i = (i + 1) % 50) { @@ -216,7 +216,7 @@ void FacebookProto::UpdateLoop(void *) void FacebookProto::MessageLoop(void *) { - time_t tim = ::time(nullptr); + time_t tim = ::time(0); debugLogA(">>> Entering Facebook::MessageLoop[%d]", tim); while (facy.channel()) { @@ -224,7 +224,7 @@ void FacebookProto::MessageLoop(void *) break; // If we're not idle, send activity_ping every few minutes... - if (!m_idleTS && (::time(nullptr) - m_pingTS) > FACEBOOK_PING_TIME) { + if (!m_idleTS && (::time(0) - m_pingTS) > FACEBOOK_PING_TIME) { debugLogA("*** FacebookProto::MessageLoop[%d] pinging...", tim); facy.activity_ping(); } diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index e3b1bd553a..0fbb9a07ed 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -297,7 +297,7 @@ void FacebookProto::DeleteContactFromServer(void *data) if (hContact != 0) { setWord(hContact, "Status", ID_STATUS_OFFLINE); setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE); - setDword(hContact, FACEBOOK_KEY_DELETED, ::time(nullptr)); + setDword(hContact, FACEBOOK_KEY_DELETED, ::time(0)); } NotifyEvent(m_tszUserName, TranslateT("Contact was removed from your server list."), 0, EVENT_FRIENDSHIP); diff --git a/protocols/FacebookRM/src/feeds.cpp b/protocols/FacebookRM/src/feeds.cpp index 9f18df8ec7..e101944654 100644 --- a/protocols/FacebookRM/src/feeds.cpp +++ b/protocols/FacebookRM/src/feeds.cpp @@ -52,7 +52,7 @@ HttpRequest* facebook_client::memoriesRequest() << CHAR_PARAM("last_section_key", "regular_story") << INT_PARAM("__be", -1) << CHAR_PARAM("__pc", "PHASED:DEFAULT") - << INT64_PARAM("timestamp", ::time(nullptr) * 1000) + << INT64_PARAM("timestamp", ::time(0) * 1000) << CHAR_PARAM("__dyn", __dyn()) << CHAR_PARAM("__req", __req()) << CHAR_PARAM("__rev", __rev()) diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 7d6c1c207b..51112635f5 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -979,7 +979,7 @@ int FacebookProto::ParseMessages(std::string &pData, std::vector<facebook_messag if (!buddyList) continue; - time_t offlineThreshold = time(nullptr) - 15 * 60; // contacts last active more than 15 minutes will be marked offline + time_t offlineThreshold = time(0) - 15 * 60; // contacts last active more than 15 minutes will be marked offline for (auto &itNodes : buddyList) { // Facebook now sends info also about some nonfriends, so we just ignore status change of contacts we don't have in list @@ -1041,7 +1041,7 @@ int FacebookProto::ParseMessages(std::string &pData, std::vector<facebook_messag if (!overlay_) continue; - time_t offlineThreshold = time(nullptr) - 15 * 60; // contacts last active more than 15 minutes will be marked offline + time_t offlineThreshold = time(0) - 15 * 60; // contacts last active more than 15 minutes will be marked offline for (auto &itNodes : overlay_) { MCONTACT hContact = ContactIDToHContact(itNodes.name()); diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp index cb1d42f23b..c8b764ba09 100644 --- a/protocols/FacebookRM/src/main.cpp +++ b/protocols/FacebookRM/src/main.cpp @@ -81,7 +81,7 @@ extern "C" int __declspec(dllexport) Load(void) g_strUserAgent = agent.str();
// Initialize random generator (used only as fallback in utils)
- srand(::time(nullptr));
+ srand(::time(0));
return 0;
}
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index b502a1f471..4801f61a56 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -382,7 +382,7 @@ HttpRequest* facebook_client::exitThreadRequest(facebook_chatroom *fbc) << CHAR_PARAM("source", "source:chat:web") << CHAR_PARAM("thread_fbid", fbc->thread_id.substr(3).c_str()) << CHAR_PARAM("fb_dtsg", dtsg_.c_str()) - << INT64_PARAM("timestamp", ::time(nullptr) * 1000) + << INT64_PARAM("timestamp", ::time(0) * 1000) << CHAR_PARAM("__user", self_.user_id.c_str()) << CHAR_PARAM("__dyn", __dyn()) << CHAR_PARAM("__req", __req()) diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index f52f9087a6..47eba0b4b7 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -122,7 +122,7 @@ void FacebookProto::ProcessFriendList(void*) // Wasn't we already been notified about this contact? if (!getDword(hContact, FACEBOOK_KEY_DELETED, 0)) { - setDword(hContact, FACEBOOK_KEY_DELETED, ::time(nullptr)); + setDword(hContact, FACEBOOK_KEY_DELETED, ::time(0)); // Notify it, if user wants to be notified if (getByte(FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE, DEFAULT_EVENT_FRIENDSHIP_ENABLE)) { @@ -1019,7 +1019,7 @@ void FacebookProto::ProcessFriendRequests(void *p) DBEVENTINFO dbei = {}; dbei.szModule = m_szModuleName; - dbei.timestamp = ::time(nullptr); + dbei.timestamp = ::time(0); dbei.flags = DBEF_UTF; dbei.eventType = EVENTTYPE_AUTHREQUEST; dbei.cbBlob = blob.size(); diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index d494385cf4..e1c7f3764a 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -31,7 +31,7 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : update_loop_event = CreateEvent(nullptr, FALSE, FALSE, nullptr); // Initialize random seed for this client - facy.random_ = ::time(nullptr) + PtrToUint(&facy); + facy.random_ = ::time(0) + PtrToUint(&facy); m_enableChat = DEFAULT_ENABLE_CHATS; @@ -362,7 +362,7 @@ int FacebookProto::OnIdleChanged(WPARAM, LPARAM lParam) Idle_GetInfo(mii); // Compute time when user really became idle - m_idleTS = time(nullptr) - mii.idleTime * 60; + m_idleTS = time(0) - mii.idleTime * 60; setDword("IdleTS", m_idleTS); } else { diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index 6cef8a3e8a..56a834df6d 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -76,9 +76,9 @@ public: inline int IdleSeconds() { if ((m_iStatus == ID_STATUS_AWAY || m_iStatus == ID_STATUS_INVISIBLE) && m_awayTS) - return time(nullptr) - m_awayTS; + return time(0) - m_awayTS; - return m_idleTS ? time(nullptr) - m_idleTS : 0; + return m_idleTS ? time(0) - m_idleTS : 0; } bool m_invisible; |