From 3ad2582c4a4a6378f294f9256ecbcbdf0ae88e3a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 3 May 2018 16:02:14 +0200 Subject: mir_forkThread - stronger typizatioin for thread function parameter --- protocols/VKontakte/src/misc.cpp | 10 +++++----- protocols/VKontakte/src/vk_chats.cpp | 6 +++--- protocols/VKontakte/src/vk_feed.cpp | 30 +++++++++++++++--------------- protocols/VKontakte/src/vk_files.cpp | 2 +- protocols/VKontakte/src/vk_history.cpp | 2 +- protocols/VKontakte/src/vk_messages.cpp | 8 ++++---- protocols/VKontakte/src/vk_pollserver.cpp | 8 ++++---- protocols/VKontakte/src/vk_thread.cpp | 4 ++-- 8 files changed, 35 insertions(+), 35 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 78408b5e3e..54b9f87f8f 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -142,7 +142,7 @@ char* ExpUrlEncode(const char *szUrl, bool strict) void CVkProto::ClearAccessToken() { debugLogA("CVkProto::ClearAccessToken"); - setDword("LastAccessTokenTime", (DWORD)time(nullptr)); + setDword("LastAccessTokenTime", (DWORD)time(0)); m_szAccessToken = nullptr; delSetting("AccessToken"); ShutdownSession(); @@ -288,7 +288,7 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) break; } - if (time(nullptr) - getDword("LastAccessTokenTime", 0) > 60 * 60 * 24) { + if (time(0) - getDword("LastAccessTokenTime", 0) > 60 * 60 * 24) { debugLogA("CVkProto::CheckJsonResult VKERR_ACCESS_DENIED (AccessToken fail?)"); ClearAccessToken(); return false; @@ -583,7 +583,7 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact, bool added) DBEVENTINFO dbei = {}; dbei.szModule = m_szModuleName; - dbei.timestamp = (DWORD)time(nullptr); + dbei.timestamp = (DWORD)time(0); dbei.flags = DBEF_UTF; dbei.eventType = added ? EVENTTYPE_ADDED : EVENTTYPE_AUTHREQUEST; dbei.cbBlob = blob.size(); @@ -1372,7 +1372,7 @@ void CVkProto::SetInvisible(MCONTACT hContact) db_set_dw(hContact, "BuddyExpectator", "LastStatus", ID_STATUS_INVISIBLE); debugLogA("CVkProto::SetInvisible %d set ID_STATUS_INVISIBLE", getDword(hContact, "ID", VK_INVALID_USER)); } - time_t now = time(nullptr); + time_t now = time(0); db_set_dw(hContact, "BuddyExpectator", "LastSeen", (DWORD)now); setDword(hContact, "InvisibleTS", (DWORD)now); } @@ -1514,7 +1514,7 @@ void CVkProto::AddVkDeactivateEvent(MCONTACT hContact, CMStringW& wszType) DBEVENTINFO dbei = {}; dbei.szModule = m_szModuleName; - dbei.timestamp = time(nullptr); + dbei.timestamp = time(0); dbei.eventType = VK_USER_DEACTIVATE_ACTION; dbei.cbBlob = (DWORD)mir_strlen(vkDeactivateEvent[iDEIdx].szDescription) + 1; dbei.pBlob = (PBYTE)mir_strdup(vkDeactivateEvent[iDEIdx].szDescription); diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 08d89269d6..4d76ddf50e 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -185,7 +185,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe GCEVENT gce = { m_szModuleName, cc->m_wszId, GC_EVENT_PART }; gce.ptszUID = wszId; gce.dwFlags = GCEF_NOTNOTIFY; - gce.time = time(nullptr); + gce.time = time(0); gce.ptszNick = mir_wstrdup(CMStringW(FORMAT, L"%s (https://vk.com/id%s)", cu->m_wszNick, wszId)); Chat_Event(&gce); @@ -258,7 +258,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & bool bIsAction = false; int msgTime = jnMsg["date"].as_int(); - time_t now = time(nullptr); + time_t now = time(0); if (!msgTime || msgTime > now) msgTime = now; @@ -736,7 +736,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) gce.ptszUID = wszId; gce.ptszText = mir_wstrdup(wszNewNick); gce.dwFlags = GCEF_ADDTOLOG; - gce.time = time(nullptr); + gce.time = time(0); Chat_Event(&gce); cu->m_wszNick = mir_wstrdup(wszNewNick); diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 86884a79ce..87fea21168 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -544,7 +544,7 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLISTtDate = time(nullptr); + vkNotification->tDate = time(0); vkNotification->vkUser = GetVkUserInfo(iUserId, vkUsers); vkNotification->wszType = wszType; vkNotification->wszId = wszId; @@ -577,8 +577,8 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime) if (!IsOnline()) return; - time_t tLastNewsReqTime = getDword("LastNewsReqTime", time(nullptr) - 24 * 60 * 60); - if (time(nullptr) - tLastNewsReqTime < 3 * 60) + time_t tLastNewsReqTime = getDword("LastNewsReqTime", time(0) - 24 * 60 * 60); + if (time(0) - tLastNewsReqTime < 3 * 60) return; CMStringA szFilter; @@ -623,7 +623,7 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime) << CHAR_PARAM("filters", szFilter) << CHAR_PARAM("source_ids", szSource)); - setDword("LastNewsReqTime", (DWORD)time(nullptr)); + setDword("LastNewsReqTime", (DWORD)time(0)); } static int sttCompareVKNewsItems(const CVKNewsItem *p1, const CVKNewsItem *p2) @@ -688,7 +688,7 @@ void CVkProto::OnReceiveUnreadNews(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *p if (bNewsAdded) AddCListEvent(true); - setDword("LastNewsTime", time(nullptr)); + setDword("LastNewsTime", time(0)); vkNews.destroy(); vkUsers.destroy(); @@ -702,8 +702,8 @@ void CVkProto::RetrieveUnreadNotifications(time_t tLastNotificationsTime) if (!IsOnline()) return; - time_t tLastNotificationsReqTime = getDword("LastNotificationsReqTime", time(nullptr) - 24 * 60 * 60); - if (time(nullptr) - tLastNotificationsReqTime < 3 * 60) + time_t tLastNotificationsReqTime = getDword("LastNotificationsReqTime", time(0) - 24 * 60 * 60); + if (time(0) - tLastNotificationsReqTime < 3 * 60) return; CMStringW code(FORMAT, L"return{\"notifications\":API.notifications.get({\"count\": 100, \"start_time\":%d})%s", @@ -714,7 +714,7 @@ void CVkProto::RetrieveUnreadNotifications(time_t tLastNotificationsTime) << WCHAR_PARAM("code", code) ); - setDword("LastNotificationsReqTime", (DWORD)time(nullptr)); + setDword("LastNotificationsReqTime", (DWORD)time(0)); } bool CVkProto::FilterNotification(CVKNewsItem* vkNotificationItem, bool& isCommented) @@ -813,7 +813,7 @@ void CVkProto::OnReceiveUnreadNotifications(NETLIBHTTPREQUEST *reply, AsyncHttpR if (bNotificationAdded) AddCListEvent(false); - setDword("LastNotificationsTime", time(nullptr)); + setDword("LastNotificationsTime", time(0)); if (m_vkOptions.bNotificationsMarkAsViewed && bNotificationCommentAdded) NotificationMarkAsViewed(); @@ -827,12 +827,12 @@ void CVkProto::RetrieveUnreadEvents() if (!IsOnline() || (!m_vkOptions.bNotificationsEnabled && !m_vkOptions.bNewsEnabled)) return; - time_t tLastNotificationsTime = getDword("LastNotificationsTime", time(nullptr) - 24 * 60 * 60); - if (time(nullptr) - tLastNotificationsTime - m_vkOptions.iNotificationsInterval * 60 >= -3 && m_vkOptions.bNotificationsEnabled) + time_t tLastNotificationsTime = getDword("LastNotificationsTime", time(0) - 24 * 60 * 60); + if (time(0) - tLastNotificationsTime - m_vkOptions.iNotificationsInterval * 60 >= -3 && m_vkOptions.bNotificationsEnabled) RetrieveUnreadNotifications(tLastNotificationsTime); - time_t tLastNewsTime = getDword("LastNewsTime", time(nullptr) - 24 * 60 * 60); - if (time(nullptr) - tLastNewsTime - m_vkOptions.iNewsInterval * 60 >= -3 && m_vkOptions.bNewsEnabled) + time_t tLastNewsTime = getDword("LastNewsTime", time(0) - 24 * 60 * 60); + if (time(0) - tLastNewsTime - m_vkOptions.iNewsInterval * 60 >= -3 && m_vkOptions.bNewsEnabled) RetrieveUnreadNews(tLastNewsTime); NewsClearHistory(); @@ -849,7 +849,7 @@ INT_PTR CVkProto::SvcLoadVKNews(WPARAM, LPARAM) AddFeedSpecialUser(); } - time_t tLastNewsTime = getDword("LastNewsTime", time(nullptr) - 24 * 60 * 60); + time_t tLastNewsTime = getDword("LastNewsTime", time(0) - 24 * 60 * 60); RetrieveUnreadNews(tLastNewsTime); return 0; @@ -862,7 +862,7 @@ void CVkProto::NewsClearHistory() if (hContact == 0 || !m_vkOptions.bNewsAutoClearHistory) return; - time_t tTime = time(nullptr) - m_vkOptions.iNewsAutoClearHistoryInterval; + time_t tTime = time(0) - m_vkOptions.iNewsAutoClearHistoryInterval; MEVENT hDBEvent = db_event_first(hContact); while (hDBEvent) { MEVENT hDBEventNext = db_event_next(hContact, hDBEvent); diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index a3d62b62c6..68fbe7da09 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -176,7 +176,7 @@ void CVkProto::OnReciveUploadServer(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * // Boundary int iboundary; Utils_GetRandom(&iboundary, sizeof(iboundary)); - boundary.AppendFormat("Miranda%dNG%d", iboundary, time(nullptr)); + boundary.AppendFormat("Miranda%dNG%d", iboundary, time(0)); // Header header.AppendFormat("multipart/form-data; boundary=%s", boundary.c_str()); pUploadReq->AddHeader("Content-Type", header); diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 008afc32dd..c18fcd86af 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -102,7 +102,7 @@ void CVkProto::GetServerHistoryLastNDay(MCONTACT hContact, int NDay) return; setByte(hContact, "ActiveHistoryTask", 1); - time_t tTime = time(nullptr) - 60 * 60 * 24 * NDay; + time_t tTime = time(0) - 60 * 60 * 24 * NDay; MEVENT hDBEvent = db_event_first(hContact); while (hDBEvent) { diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 839066adb1..62d6168b67 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -49,7 +49,7 @@ int CVkProto::SendMsg(MCONTACT hContact, int, const char *szMsg) AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, bIsChat ? &CVkProto::OnSendChatMsg : &CVkProto::OnSendMessage, AsyncHttpRequest::rpHigh) << INT_PARAM(bIsChat ? "chat_id" : "peer_id", iUserID) - << INT_PARAM("random_id", ((LONG)time(nullptr)) * 100 + uMsgId % 100); + << INT_PARAM("random_id", ((LONG)time(0)) * 100 + uMsgId % 100); pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded"); if (StickerId) @@ -300,7 +300,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe recv.flags |= PREF_CREATEREAD; if (isOut) recv.flags |= PREF_SENT; - else if (m_vkOptions.bUserForceInvisibleOnActivity && time(nullptr) - datetime < 60 * m_vkOptions.iInvisibleInterval) + else if (m_vkOptions.bUserForceInvisibleOnActivity && time(0) - datetime < 60 * m_vkOptions.iInvisibleInterval) SetInvisible(hContact); bool bEdited = CheckMid(m_editedIds, mid); @@ -332,7 +332,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe } T2Utf pszBody(wszBody); - recv.timestamp = bEdited ? datetime : (m_vkOptions.bUseLocalTime ? time(nullptr) : datetime); + recv.timestamp = bEdited ? datetime : (m_vkOptions.bUseLocalTime ? time(0) : datetime); recv.szMessage = pszBody; recv.lParam = isOut; recv.pCustomData = szMid; @@ -351,7 +351,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe } else if (m_vkOptions.bLoadSentAttachments && !wszAttachmentDescr.IsEmpty() && isOut) { T2Utf pszAttach(wszAttachmentDescr); - recv.timestamp = time(nullptr); // only local time + recv.timestamp = time(0); // only local time recv.szMessage = pszAttach; ProtoChainRecvMsg(hContact, &recv); } diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index 49c9b017eb..8f92639ab8 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -93,9 +93,9 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates) hContact = FindUser(uid); if (hContact != 0 && (flags & VKFLAG_MSGUNREAD) && !CheckMid(m_incIds, msgid)) { - setDword(hContact, "LastMsgReadTime", time(nullptr)); + setDword(hContact, "LastMsgReadTime", time(0)); if (ServiceExists(MS_MESSAGESTATE_UPDATE)) { - MessageReadData data(time(nullptr), MRD_TYPE_READTIME); + MessageReadData data(time(0), MRD_TYPE_READTIME); CallService(MS_MESSAGESTATE_UPDATE, hContact, (LPARAM)&data); } else @@ -132,9 +132,9 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates) uid = jnChild[1].as_int(); hContact = FindUser(uid); if (hContact != 0) { - setDword(hContact, "LastMsgReadTime", time(nullptr)); + setDword(hContact, "LastMsgReadTime", time(0)); if (ServiceExists(MS_MESSAGESTATE_UPDATE)) { - MessageReadData data(time(nullptr), MRD_TYPE_READTIME); + MessageReadData data(time(0), MRD_TYPE_READTIME); CallService(MS_MESSAGESTATE_UPDATE, hContact, (LPARAM)&data); } else diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 1986b3a240..1c39094afd 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -371,7 +371,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, VKContactTy setWord(hContact, "Status", iNewStatus); if (iNewStatus == ID_STATUS_ONLINE) { - db_set_dw(hContact, "BuddyExpectator", "LastSeen", (DWORD)time(nullptr)); + db_set_dw(hContact, "BuddyExpectator", "LastSeen", (DWORD)time(0)); db_set_dw(hContact, "BuddyExpectator", "LastStatus", ID_STATUS_ONLINE); int online_app = _wtoi(jnItem["online_app"].as_mstring()); @@ -621,7 +621,7 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe int iContactStatus = getWord(cc, "Status", ID_STATUS_OFFLINE); if ((iContactStatus == ID_STATUS_ONLINE) - || (iContactStatus == ID_STATUS_INVISIBLE && time(nullptr) - getDword(cc, "InvisibleTS", 0) >= m_vkOptions.iInvisibleInterval * 60LL)) { + || (iContactStatus == ID_STATUS_INVISIBLE && time(0) - getDword(cc, "InvisibleTS", 0) >= m_vkOptions.iInvisibleInterval * 60LL)) { setWord(cc, "Status", ID_STATUS_OFFLINE); SetMirVer(cc, -1); db_unset(cc, m_szModuleName, "ListeningTo"); -- cgit v1.2.3