summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-03 16:02:14 +0200
committerGeorge Hazan <ghazan@miranda.im>2018-05-03 16:02:14 +0200
commit3ad2582c4a4a6378f294f9256ecbcbdf0ae88e3a (patch)
tree412a28ef6a572efc7039df1c363bf47a3dec4b19 /protocols
parent9a6f750a482d1d1ebf4281bb7bf8133e547ad438 (diff)
mir_forkThread<typename> - stronger typizatioin for thread function parameter
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/dispatch.cpp6
-rw-r--r--protocols/Discord/src/guilds.cpp4
-rw-r--r--protocols/Discord/src/utils.cpp4
-rw-r--r--protocols/EmLanProto/src/lan.cpp9
-rw-r--r--protocols/EmLanProto/src/mlan.cpp2
-rw-r--r--protocols/FacebookRM/src/chat.cpp8
-rw-r--r--protocols/FacebookRM/src/communication.cpp2
-rw-r--r--protocols/FacebookRM/src/connection.cpp12
-rw-r--r--protocols/FacebookRM/src/contacts.cpp2
-rw-r--r--protocols/FacebookRM/src/feeds.cpp2
-rw-r--r--protocols/FacebookRM/src/json.cpp4
-rw-r--r--protocols/FacebookRM/src/main.cpp2
-rw-r--r--protocols/FacebookRM/src/messages.cpp2
-rw-r--r--protocols/FacebookRM/src/process.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.h4
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp4
-rw-r--r--protocols/ICQCorp/src/protocol.cpp12
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp18
-rw-r--r--protocols/IRCG/src/input.cpp2
-rw-r--r--protocols/IRCG/src/irclib.cpp26
-rw-r--r--protocols/IRCG/src/scripting.cpp7
-rw-r--r--protocols/IRCG/src/tools.cpp2
-rw-r--r--protocols/IRCG/src/windows.cpp2
-rw-r--r--protocols/IcqOscarJ/src/chan_05ping.cpp4
-rw-r--r--protocols/IcqOscarJ/src/cookies.cpp6
-rw-r--r--protocols/IcqOscarJ/src/fam_01service.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_02location.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_03buddy.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_04message.cpp20
-rw-r--r--protocols/IcqOscarJ/src/fam_13servclist.cpp4
-rw-r--r--protocols/IcqOscarJ/src/fam_15icqserver.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.cpp6
-rw-r--r--protocols/IcqOscarJ/src/icq_direct.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_directmsg.cpp8
-rw-r--r--protocols/IcqOscarJ/src/icq_filerequests.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_infoupdate.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_rates.cpp5
-rw-r--r--protocols/IcqOscarJ/src/icq_server.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_servlist.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_xtraz.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icqosc_svcs.cpp2
-rw-r--r--protocols/IcqOscarJ/src/init.cpp2
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.cpp2
-rw-r--r--protocols/IcqOscarJ/src/stdpackets.cpp4
-rw-r--r--protocols/IcqOscarJ/src/utilities.cpp2
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp4
-rw-r--r--protocols/JabberG/src/jabber_events.cpp2
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp2
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp4
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_iqid.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_misc.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_omemo.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_opt.cpp582
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_util.cpp2
-rw-r--r--protocols/MRA/src/Mra_functions.cpp7
-rw-r--r--protocols/MSN/src/msn_auth.cpp8
-rw-r--r--protocols/MSN/src/msn_chat.cpp2
-rw-r--r--protocols/MSN/src/msn_commands.cpp14
-rw-r--r--protocols/MSN/src/msn_libstr.cpp2
-rw-r--r--protocols/MSN/src/msn_mail.cpp2
-rw-r--r--protocols/MSN/src/msn_misc.cpp4
-rw-r--r--protocols/MSN/src/stdafx.h2
-rw-r--r--protocols/MinecraftDynmap/src/chat.cpp6
-rw-r--r--protocols/MinecraftDynmap/src/communication.cpp4
-rw-r--r--protocols/MinecraftDynmap/src/proto.h2
-rw-r--r--protocols/Omegle/src/chat.cpp8
-rw-r--r--protocols/Omegle/src/communication.cpp2
-rw-r--r--protocols/Omegle/src/connection.cpp4
-rw-r--r--protocols/Sametime/src/conference.cpp6
-rw-r--r--protocols/Sametime/src/files.cpp21
-rw-r--r--protocols/Sametime/src/messaging.cpp2
-rw-r--r--protocols/Sametime/src/sametime.cpp12
-rw-r--r--protocols/Sametime/src/sametime.h15
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp8
-rw-r--r--protocols/Sametime/src/sametime_proto.h20
-rw-r--r--protocols/Sametime/src/sametime_session.cpp94
-rw-r--r--protocols/Sametime/src/userlist.cpp2
-rw-r--r--protocols/SkypeWeb/src/request_queue.cpp14
-rw-r--r--protocols/SkypeWeb/src/request_queue.h4
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp14
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_login.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_trouter.cpp6
-rw-r--r--protocols/Steam/src/stdafx.h2
-rw-r--r--protocols/Tox/libtox/src/toxcore/Messenger.c2
-rw-r--r--protocols/Tox/libtox/src/toxcore/util.c2
-rw-r--r--protocols/Tox/src/stdafx.h2
-rw-r--r--protocols/Twitter/src/chat.cpp4
-rw-r--r--protocols/VKontakte/src/misc.cpp10
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp6
-rw-r--r--protocols/VKontakte/src/vk_feed.cpp30
-rw-r--r--protocols/VKontakte/src/vk_files.cpp2
-rw-r--r--protocols/VKontakte/src/vk_history.cpp2
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp8
-rw-r--r--protocols/VKontakte/src/vk_pollserver.cpp8
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp4
105 files changed, 607 insertions, 639 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index 53c561aaf2..aa31c69f5f 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -144,7 +144,7 @@ void CDiscordProto::OnCommandChannelUpdated(const JSONNode &pRoot)
GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_TOPIC };
gce.ptszText = wszTopic;
- gce.time = time(nullptr);
+ gce.time = time(0);
Chat_Event(&gce);
}
}
@@ -226,7 +226,7 @@ void CDiscordProto::OnCommandGuildMemberRemoved(const JSONNode &pRoot)
continue;
GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_PART };
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszUID = wszUserId;
Chat_Event(&gce);
}
@@ -260,7 +260,7 @@ void CDiscordProto::OnCommandGuildMemberUpdated(const JSONNode &pRoot)
}
GCEVENT gce = { m_szModuleName, it->wszUsername, GC_EVENT_NICK };
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszUID = wszUserId;
gce.ptszNick = wszOldNick;
gce.ptszText = gm->wszNick;
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index 78eb0a1507..0bb61ed52a 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -114,7 +114,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
Chat_SetStatusbarText(m_szModuleName, wszChannelId, wszTopic);
GCEVENT gce = { m_szModuleName, wszChannelId, GC_EVENT_TOPIC };
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszText = wszTopic;
Chat_Event(&gce);
}
@@ -151,7 +151,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
void CDiscordProto::AddUserToChannel(const CDiscordUser &pChannel, const CDiscordGuildMember &pUser)
{
GCEVENT gce = { m_szModuleName, pChannel.wszUsername, GC_EVENT_JOIN };
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.dwFlags = GCEF_SILENT;
wchar_t wszUserId[100];
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp
index 5be21385ec..cd890f2514 100644
--- a/protocols/Discord/src/utils.cpp
+++ b/protocols/Discord/src/utils.cpp
@@ -37,7 +37,7 @@ time_t StringToDate(const CMStringW &str)
struct tm T = { 0 };
int boo;
if (swscanf(str, L"%04d-%02d-%02dT%02d:%02d:%02d.%d", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, &boo) != 7)
- return time(nullptr);
+ return time(0);
T.tm_year -= 1900;
T.tm_mon--;
@@ -241,7 +241,7 @@ void CDiscordProto::ProcessType(CDiscordUser *pUser, const JSONNode &pRoot)
DB_AUTH_BLOB blob(pUser->hContact, T2Utf(pUser->wszUsername), nullptr, nullptr, szId, nullptr);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.lParam = blob.size();
pre.szMessage = blob;
ProtoChainRecv(pUser->hContact, PSR_AUTH, 0, (LPARAM)&pre);
diff --git a/protocols/EmLanProto/src/lan.cpp b/protocols/EmLanProto/src/lan.cpp
index 301e2a8284..d7737b2479 100644
--- a/protocols/EmLanProto/src/lan.cpp
+++ b/protocols/EmLanProto/src/lan.cpp
@@ -131,8 +131,8 @@ void CLan::StartListen()
return;
}
- m_hListenThread = mir_forkthread(ListenProc, (void*)this);
- m_hAcceptTCPThread = mir_forkthread(AcceptTCPProc, (void*)this);
+ m_hListenThread = mir_forkthread(ListenProc, this);
+ m_hAcceptTCPThread = mir_forkthread(AcceptTCPProc, this);
if (m_hListenThread == nullptr || m_hAcceptTCPThread == nullptr) {
m_mode = LM_ON;
m_status = LS_CANT_CREATE_THREADS;
@@ -216,7 +216,7 @@ void CLan::AcceptTCP()
tcp_conn->m_addr = addrFrom.sin_addr.S_un.S_addr;
tcp_conn->m_lan = this;
tcp_conn->m_socket = in_socket;
- mir_forkthread(OnInTCPConnectionProc, (void*)tcp_conn);
+ mir_forkthread(OnInTCPConnectionProc, tcp_conn);
Sleep(100);
}
m_hAcceptTCPThread = nullptr;
@@ -252,8 +252,7 @@ SOCKET CLan::CreateTCPConnection(u_long addr, LPVOID lpParameter)
tcp_conn->m_lan = this;
tcp_conn->m_addr = addr;
tcp_conn->m_lpParameter = lpParameter;
-
- mir_forkthread(OnOutTCPConnectionProc, (void*)tcp_conn);
+ mir_forkthread(OnOutTCPConnectionProc, tcp_conn);
return out_socket;
}
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp
index e7e6b8963d..948f011e52 100644
--- a/protocols/EmLanProto/src/mlan.cpp
+++ b/protocols/EmLanProto/src/mlan.cpp
@@ -126,7 +126,7 @@ void CMLan::StartChecking()
for (TContact *cont = m_pRootContact; cont; cont = cont->m_prev)
cont->m_time = MLAN_CHECK + MLAN_TIMEOUT;
- m_hCheckThread = mir_forkthread(CheckProc, (void*)this);
+ m_hCheckThread = mir_forkthread(CheckProc, this);
StartListen();
RequestStatus(true);
}
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;
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index ca86944985..56d81d38fe 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -467,7 +467,7 @@ retry:
}
else {
// Successfully connected
- logonTime = time(nullptr);
+ logonTime = time(0);
setDword(GG_KEY_LOGONTIME, logonTime);
gg_EnterCriticalSection(&sess_mutex, "mainthread", 15, "sess_mutex", 1);
m_sess = local_sess;
@@ -636,7 +636,7 @@ retry:
mir_wstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_wstrlen(strFmt2));
}
if (__birthyear) {
- time_t t = time(nullptr);
+ time_t t = time(0);
struct tm *lt = localtime(&t);
int br = atoi(__birthyear);
@@ -698,7 +698,7 @@ retry:
delSetting(GG_KEY_PD_FAMILYCITY);
if (__birthyear) {
- time_t t = time(nullptr);
+ time_t t = time(0);
struct tm *lt = localtime(&t);
int br = atoi(__birthyear);
if (br > 0)
@@ -815,7 +815,7 @@ retry:
UIN2IDT(e->event.msg.sender, id);
GCEVENT gce = { m_szModuleName, chat, GC_EVENT_MESSAGE };
- time_t t = time(nullptr);
+ time_t t = time(0);
gce.ptszUID = id;
wchar_t* messageT = mir_utf8decodeW(e->event.msg.message);
gce.ptszText = messageT;
@@ -830,7 +830,7 @@ retry:
// Check if not empty message ( who needs it? )
else if (!e->event.msg.recipients_count && e->event.msg.message && *e->event.msg.message && mir_strcmp(e->event.msg.message, "\xA0\0")) {
PROTORECVEVENT pre = { 0 };
- time_t t = time(nullptr);
+ time_t t = time(0);
pre.timestamp = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
pre.szMessage = e->event.msg.message;
ProtoChainRecvMsg(getcontact(e->event.msg.sender, 1, 0, nullptr), &pre);
@@ -949,7 +949,7 @@ retry:
sessions_updatedlg();
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
{
- const wchar_t* szText = time(nullptr) - logonTime > 3
+ const wchar_t* szText = time(0) - logonTime > 3
? TranslateT("You have logged in at another location")
: TranslateT("You are logged in at another location");
for (i = 0; i < e->event.multilogon_info.count; i++)
@@ -1041,7 +1041,7 @@ retry:
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = filenameT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)dcc7;
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp
index eb25e14c6d..6a8ff9ee89 100644
--- a/protocols/Gadu-Gadu/src/filetransfer.cpp
+++ b/protocols/Gadu-Gadu/src/filetransfer.cpp
@@ -113,7 +113,7 @@ HANDLE ftfail(GaduProto *gg, MCONTACT hContact)
#ifdef DEBUGMODE
gg->debugLogA("ftfail(): Failing file transfer...");
#endif
- srand(time(nullptr));
+ srand(time(0));
ft->hProcess = (HANDLE)rand();
ft->hContact = hContact;
#ifdef DEBUGMODE
@@ -397,7 +397,7 @@ void __cdecl GaduProto::dccmainthread(void*)
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = filenameT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)local_dcc;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 513e99df61..cca61e74bb 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -414,7 +414,7 @@ HWND GaduProto::SearchAdvanced(HWND hwndDlg)
if (mir_wstrlen(text)) {
int yearTo = _tstoi(text);
int yearFrom;
- time_t t = time(nullptr);
+ time_t t = time(0);
struct tm *lt = localtime(&t);
int ay = lt->tm_year + 1900;
char age[16];
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index d46c8584df..1b76e3b09e 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -168,7 +168,7 @@ int GaduProto::gc_event(WPARAM, LPARAM lParam)
while (lc >= 0 && (gch->ptszText[lc] == '\n' || gch->ptszText[lc] == '\r'))
gch->ptszText[lc--] = 0;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.bIsMe = 1;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"gc_event(): Sending conference message to room %s, \"%s\".", gch->ptszID, gch->ptszText);
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index 2dc6c14b41..eb534d71b9 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -867,7 +867,7 @@ int GaduProto::img_displayasmsg(MCONTACT hContact, void *img)
T2Utf szMessage(image_msg);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.szMessage = szMessage;
ProtoChainRecvMsg(hContact, &pre);
debugLogW(L"img_displayasmsg(): Image saved to %s.", szPath);
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index caa854ff6a..400e7a5ed8 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -210,7 +210,7 @@ char* oauth_generate_nonce()
char randnum[16];
Utils_GetRandom(randnum, sizeof(randnum));
- CMStringA str(FORMAT, "%ld%s", time(nullptr), randnum);
+ CMStringA str(FORMAT, "%ld%s", time(0), randnum);
BYTE digest[16];
mir_md5_hash((BYTE*)str.GetString(), str.GetLength(), digest);
@@ -243,7 +243,7 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD
};
char timestamp[22];
- mir_snprintf(timestamp, "%ld", time(nullptr));
+ mir_snprintf(timestamp, "%ld", time(0));
oauth_setparam(oauth_parameters, "oauth_timestamp", timestamp);
oauth_setparam(oauth_parameters, "oauth_nonce", ptrA(oauth_generate_nonce()));
if (token != nullptr && *token)
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp
index 5a63f88825..821a94c7d0 100644
--- a/protocols/ICQCorp/src/protocol.cpp
+++ b/protocols/ICQCorp/src/protocol.cpp
@@ -696,7 +696,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
packet >> checkUin
>> newCommand;
- processSystemMessage(packet, checkUin, newCommand, time(nullptr));
+ processSystemMessage(packet, checkUin, newCommand, time(0));
break;
case ICQ_CMDxRCV_SYSxMSGxDONE: // end of system messages
@@ -777,7 +777,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet)
packet >> checkUin
>> newCommand;
- processSystemMessage(packet, checkUin, newCommand, time(nullptr));
+ processSystemMessage(packet, checkUin, newCommand, time(0));
break;
case ICQ_CMDxRCV_BROADCASTxDONE:
@@ -1773,7 +1773,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
packet >> theTCPSequence;
ackTCP(packet, u, newCommand, theTCPSequence);
- addMessage(u, message, time(nullptr));
+ addMessage(u, message, time(0));
break;
case ICQ_CMDxTCP_CHAT:
@@ -1794,7 +1794,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
packet >> theTCPSequence;
ackTCP(packet, u, newCommand, theTCPSequence);
- addUrl(u, message, time(nullptr));
+ addUrl(u, message, time(0));
break;
case ICQ_CMDxTCP_FILE:
@@ -1810,7 +1810,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
Netlib_Logf(hNetlibUser, "[tcp] file transfer request from %d (%d)\n", checkUin, theTCPSequence);
- addFileReq(u, message, fileName, size, theTCPSequence, time(nullptr));
+ addFileReq(u, message, fileName, size, theTCPSequence, time(0));
delete[] fileName;
break;
@@ -1894,7 +1894,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
case ICQ_CMDxTCP_READxDNDxMSG:
case ICQ_CMDxTCP_READxFREECHATxMSG:
packet >> theTCPSequence;
- addAwayMsg(u, message, theTCPSequence, time(nullptr));
+ addAwayMsg(u, message, theTCPSequence, time(0));
break;
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 52d369a5ba..081d6d6e0a 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -73,7 +73,7 @@ VOID CALLBACK KeepAliveTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
if (!ppro->m_info.sServerName.IsEmpty())
mir_snwprintf(temp2, L"PING %s", ppro->m_info.sServerName.c_str());
else
- mir_snwprintf(temp2, L"PING %u", time(nullptr));
+ mir_snwprintf(temp2, L"PING %u", time(0));
if (ppro->IsConnected())
ppro->SendIrcMessage(temp2, false);
@@ -226,7 +226,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, const wchar_t *msg)
DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.pBlob = (PBYTE)mir_utf8encodeW(S);
dbei.cbBlob = (DWORD)mir_strlen((char*)dbei.pBlob) + 1;
@@ -704,7 +704,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage *pmsg)
MCONTACT hContact = CList_AddContact(&user, false, true);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.szMessage = mir_utf8encodeW(mess);
setWString(hContact, "User", pmsg->prefix.sUser);
setWString(hContact, "Host", pmsg->prefix.sHost);
@@ -843,7 +843,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
// incoming TIME
else if (pmsg->m_bIncoming && command == L"time") {
wchar_t temp[300];
- time_t tim = time(nullptr);
+ time_t tim = time(0);
mir_wstrncpy(temp, _wctime(&tim), 25);
PostIrcMessage(L"/NOTICE %s \001TIME %s\001", pmsg->prefix.sNick.c_str(), temp);
@@ -1163,7 +1163,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.fileCount = 1;
pre.files.w = &tszTemp;
pre.lParam = (LPARAM)di;
@@ -1204,7 +1204,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
}
if (pmsg->m_bIncoming && command == L"ping") {
SetActiveWindow(m_whoisDlg->GetHwnd());
- int s = (int)time(nullptr) - (int)_wtol(GetWordAddress(mess, 1));
+ int s = (int)time(0) - (int)_wtol(GetWordAddress(mess, 1));
wchar_t szTmp[30];
if (s == 1)
mir_snwprintf(szTmp, TranslateT("%u second"), s);
@@ -1219,7 +1219,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
//... else show the reply in the current window
if (pmsg->m_bIncoming && command == L"ping") {
- int s = (int)time(nullptr) - (int)_wtol(GetWordAddress(mess, 1));
+ int s = (int)time(0) - (int)_wtol(GetWordAddress(mess, 1));
mir_snwprintf(szTemp, TranslateT("CTCP PING reply from %s: %u sec(s)"), pmsg->prefix.sNick.c_str(), s);
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, szTemp, nullptr, nullptr, NULL, true, false);
}
@@ -1316,7 +1316,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage *pmsg)
else
btOwnMode = 0;
}
- gce.time = gce.bIsMe ? time(nullptr) : 0;
+ gce.time = gce.bIsMe ? time(0) : 0;
Chat_Event(&gce);
DoEvent(GC_EVENT_SETCONTACTSTATUS, sChanName, sTemp, nullptr, nullptr, nullptr, ID_STATUS_ONLINE, FALSE, FALSE);
@@ -2393,7 +2393,7 @@ int CIrcProto::DoPerform(const char* event)
if (!my_strstri(dbv.ptszVal, L"/away"))
PostIrcMessageWnd(nullptr, NULL, dbv.ptszVal);
else
- mir_forkthread(AwayWarningThread, nullptr);
+ mir_forkthread(AwayWarningThread);
db_free(&dbv);
return 1;
}
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index 8b7bec22e7..169dbc4153 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -585,7 +585,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
// if it is not dcc or if it is dcc and a local ip exist
if (mir_wstrcmpi(two.c_str(), L"dcc") != 0 || ulAdr) {
if (mir_wstrcmpi(two.c_str(), L"ping") == 0)
- mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s %u\001", one.c_str(), two.c_str(), time(nullptr));
+ mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s %u\001", one.c_str(), two.c_str(), time(0));
else
mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s\001", one.c_str(), GetWordAddress(text.c_str(), 2));
PostIrcMessageWnd(window, hContact, szTemp);
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index 5ffb9c22f1..04b56f2c6a 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -574,11 +574,11 @@ void CIrcProto::CheckDCCTimeout(void)
mir_cslock lck(m_dcc);
for (auto &p : m_dcc_chats)
- if (time(nullptr) > p->tLastActivity + DCCCHATTIMEOUT)
+ if (time(0) > p->tLastActivity + DCCCHATTIMEOUT)
p->Disconnect();
for (auto &p : m_dcc_xfers)
- if (time(nullptr) > p->tLastActivity + DCCSENDTIMEOUT)
+ if (time(0) > p->tLastActivity + DCCSENDTIMEOUT)
p->Disconnect();
}
@@ -719,7 +719,7 @@ CDccSession::CDccSession(CIrcProto* _pro, DCCINFO *pdci) :
con(nullptr),
hBindPort(nullptr)
{
- tLastActivity = time(nullptr);
+ tLastActivity = time(0);
di = pdci; // Setup values passed to the constructor
@@ -783,7 +783,7 @@ CDccSession::~CDccSession() // destroy all that needs destroying
int CDccSession::NLSend(const unsigned char* buf, int cbBuf)
{
- tLastActivity = time(nullptr);
+ tLastActivity = time(0);
if (con)
return Netlib_Send(con, (const char*)buf, cbBuf, di->iType == DCC_CHAT ? MSG_DUMPASTEXT : MSG_NODUMP);
@@ -798,7 +798,7 @@ int CDccSession::NLReceive(const unsigned char* buf, int cbBuf)
if (con)
n = Netlib_Recv(con, (char*)buf, cbBuf, di->iType == DCC_CHAT ? MSG_DUMPASTEXT : MSG_NODUMP);
- tLastActivity = time(nullptr);
+ tLastActivity = time(0);
return n;
}
@@ -863,7 +863,7 @@ int CDccSession::SetupConnection()
pfts.pszFiles.w = file;
pfts.totalProgress = 0;
pfts.currentFileProgress = 0;
- pfts.currentFileTime = (unsigned long)time(nullptr);
+ pfts.currentFileTime = (unsigned long)time(0);
}
// create a listening socket for outgoing chat/send requests. The remote computer connects to this computer. Used for both chat and filetransfer.
@@ -1084,7 +1084,7 @@ void CDccSession::DoSendFile()
// initial ack to set the 'percentage-ready meter' to the correct value
ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts);
- tLastActivity = time(nullptr);
+ tLastActivity = time(0);
// create a packet receiver to handle receiving ack's from the remote computer.
HANDLE hPackrcver = Netlib_CreatePacketReceiver(con, sizeof(DWORD));
@@ -1155,8 +1155,8 @@ void CDccSession::DoSendFile()
}
// update the filetransfer dialog's 'percentage-ready meter' once per second only to save cpu
- if (tLastPercentageUpdate < time(nullptr)) {
- tLastPercentageUpdate = time(nullptr);
+ if (tLastPercentageUpdate < time(0)) {
+ tLastPercentageUpdate = time(0);
pfts.totalProgress = dwTotal;
pfts.currentFileProgress = dwTotal;
ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts);
@@ -1177,7 +1177,7 @@ void CDccSession::DoSendFile()
}
// ack the progress one final time
- tLastActivity = time(nullptr);
+ tLastActivity = time(0);
pfts.totalProgress = dwTotal;
pfts.currentFileProgress = dwTotal;
ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts);
@@ -1252,8 +1252,8 @@ void CDccSession::DoReceiveFile()
// sets the 'last update time' to check for timed out connections, and also make sure we only
// ack the 'percentage-ready meter' only once a second to save CPU.
- if (tLastPercentageUpdate < time(nullptr)) {
- tLastPercentageUpdate = time(nullptr);
+ if (tLastPercentageUpdate < time(0)) {
+ tLastPercentageUpdate = time(0);
pfts.totalProgress = dwTotal;
pfts.currentFileProgress = dwTotal;
ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts);
@@ -1323,7 +1323,7 @@ void CDccSession::DoChatReceive()
if (*pStart) {
// send it off to some messaging module
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.szMessage = pStart;
ProtoChainRecvMsg(di->hContact, &pre);
}
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp
index ee3c57ab90..8de2060953 100644
--- a/protocols/IRCG/src/scripting.cpp
+++ b/protocols/IRCG/src/scripting.cpp
@@ -64,11 +64,10 @@ static void __stdcall OnHook(void * pi)
delete gch;
}
-static void __cdecl GuiOutThread(LPVOID di)
+static void __cdecl GuiOutThread(GCHOOK *gch)
{
Thread_SetName("IRC: GuiOutThread");
- GCHOOK* gch = (GCHOOK*)di;
- CallFunctionAsync(OnHook, (void*)gch);
+ CallFunctionAsync(OnHook, gch);
}
INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam)
@@ -100,7 +99,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam)
else
gchook->pszModule = nullptr;
- mir_forkthread(GuiOutThread, gchook);
+ mir_forkThread<GCHOOK>(GuiOutThread, gchook);
return 0;
}
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index 96434c7150..311e5bf494 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -395,7 +395,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t*
gce.dwItemData = dwItemData;
if (timestamp == 1)
- gce.time = time(nullptr);
+ gce.time = time(0);
else
gce.time = timestamp;
gce.bIsMe = bIsMe;
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index 0529e63153..72831b3a3c 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -126,7 +126,7 @@ void CWhoisDlg::OnPing(CCtrlButton*)
wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
- m_proto->PostIrcMessage(L"/PRIVMSG %s \001PING %u\001", szTemp, time(nullptr));
+ m_proto->PostIrcMessage(L"/PRIVMSG %s \001PING %u\001", szTemp, time(0));
}
void CWhoisDlg::OnUserInfo(CCtrlButton*)
diff --git a/protocols/IcqOscarJ/src/chan_05ping.cpp b/protocols/IcqOscarJ/src/chan_05ping.cpp
index 41e3046a55..05cbc27d74 100644
--- a/protocols/IcqOscarJ/src/chan_05ping.cpp
+++ b/protocols/IcqOscarJ/src/chan_05ping.cpp
@@ -33,7 +33,7 @@ void CIcqProto::handlePingChannel(BYTE*, size_t)
void CIcqProto::StartKeepAlive(serverthread_info *info)
{
if (getByte("KeepAlive", DEFAULT_KEEPALIVE_ENABLED))
- info->tmPing = time(nullptr) + KEEPALIVE_INTERVAL;
+ info->tmPing = time(0) + KEEPALIVE_INTERVAL;
else
info->tmPing = -1;
}
@@ -48,7 +48,7 @@ void CIcqProto::CheckKeepAlive(serverthread_info *info)
if (info->tmPing == -1)
return;
- if (time(nullptr) >= info->tmPing) {
+ if (time(0) >= info->tmPing) {
// Send a keep alive packet to server
icq_packet packet = { 0 };
write_flap(&packet, ICQ_PING_CHAN);
diff --git a/protocols/IcqOscarJ/src/cookies.cpp b/protocols/IcqOscarJ/src/cookies.cpp
index 0eb4dcc2fd..f63b6d35c8 100644
--- a/protocols/IcqOscarJ/src/cookies.cpp
+++ b/protocols/IcqOscarJ/src/cookies.cpp
@@ -31,7 +31,7 @@
void CIcqProto::RemoveExpiredCookies()
{
- time_t tNow = time(nullptr);
+ time_t tNow = time(0);
auto T = cookies.rev_iter();
for (auto &it : T)
@@ -53,7 +53,7 @@ DWORD CIcqProto::AllocateCookie(BYTE bType, WORD wIdent, MCONTACT hContact, void
p->dwCookie = dwThisSeq;
p->hContact = hContact;
p->pvExtra = pvExtra;
- p->dwTime = time(nullptr);
+ p->dwTime = time(0);
cookies.insert(p);
return dwThisSeq;
@@ -210,7 +210,7 @@ void CIcqProto::InitMessageCookie(cookie_message_data *pCookie)
do {
// ensure that message ids are unique
- dwMsgID1 = time(nullptr);
+ dwMsgID1 = time(0);
dwMsgID2 = RandRange(0, 0x0FFFF);
}
while (FindMessageCookie(dwMsgID1, dwMsgID2, nullptr, nullptr, nullptr));
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp
index c77b939f51..9d1c54a498 100644
--- a/protocols/IcqOscarJ/src/fam_01service.cpp
+++ b/protocols/IcqOscarJ/src/fam_01service.cpp
@@ -272,7 +272,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade
if (dwValue) setDword("MemberTS", dwValue);
dwValue = chain->getDWord(0x03, 1);
- setDword("LogonTS", dwValue ? dwValue : time(nullptr));
+ setDword("LogonTS", dwValue ? dwValue : time(0));
disposeChain(&chain);
diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp
index 60ce774fd8..b1ba4e3b0b 100644
--- a/protocols/IcqOscarJ/src/fam_02location.cpp
+++ b/protocols/IcqOscarJ/src/fam_02location.cpp
@@ -248,7 +248,7 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, size_t wLen, DWORD dwCook
PROTORECVEVENT pre = { 0 };
pre.szMessage = szMsg ? szMsg : (char *)"";
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.lParam = dwCookie;
ProtoChainRecv(hContact, PSR_AWAYMSG, status, (LPARAM)&pre);
diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp
index 19fcabec05..403e515182 100644
--- a/protocols/IcqOscarJ/src/fam_03buddy.cpp
+++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp
@@ -624,7 +624,7 @@ void CIcqProto::handleUserOffline(BYTE *buf, size_t wLen)
void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, oscar_tlv_chain *pChain)
{
- DWORD dwStatusNoteTS = time(nullptr);
+ DWORD dwStatusNoteTS = time(0);
BYTE *pStatusNoteTS, *pStatusNote;
WORD wStatusNoteTSLen, wStatusNoteLen;
BYTE bStatusNoteFlags;
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp
index 71ac7a1a8e..5f56395682 100644
--- a/protocols/IcqOscarJ/src/fam_04message.cpp
+++ b/protocols/IcqOscarJ/src/fam_04message.cpp
@@ -318,7 +318,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char
}
}
- dwRecvTime = (DWORD)time(nullptr);
+ dwRecvTime = (DWORD)time(0);
{ // Check if the message was received as offline
cookie_offline_messages *cookie;
@@ -346,7 +346,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char
debugLogA("Message (format 1) received");
// Save tick value
- setDword(hContact, "TickTS", time(nullptr) - (dwMsgID1 / 1000));
+ setDword(hContact, "TickTS", time(0) - (dwMsgID1 / 1000));
}
else debugLogA("Message (format %u) - Ignoring empty message", 1);
@@ -457,7 +457,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, size_t wLen, DWORD dwUin, char
// Save tick value
BYTE bClientID = getByte(hContact, "ClientID", 0);
if (bClientID == CLID_GENERIC || bClientID == CLID_ICQ6)
- setDword(hContact, "TickTS", time(nullptr) - (dwMsgID1 / 1000));
+ setDword(hContact, "TickTS", time(0) - (dwMsgID1 / 1000));
else
setDword(hContact, "TickTS", 0);
}
@@ -687,7 +687,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, size_t wLen, MCONTACT hContac
pMsgAck.wCookie = wCookie;
pMsgAck.msgType = bMsgType;
pMsgAck.bFlags = bFlags;
- handleMessageTypes(dwUin, szUID, time(nullptr), dwMsgID1, dwMsgID2, wCookie, wVersion, bMsgType, bFlags, wAckType, wLen, wMsgLen, (char*)pDataBuf, 0, &pMsgAck);
+ handleMessageTypes(dwUin, szUID, time(0), dwMsgID1, dwMsgID2, wCookie, wVersion, bMsgType, bFlags, wAckType, wLen, wMsgLen, (char*)pDataBuf, 0, &pMsgAck);
break;
}
}
@@ -852,7 +852,7 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, DWORD dwUi
if (m_iStatus == ID_STATUS_NA)
nMsgType = MTYPE_AUTONA;
}
- handleMessageTypes(dwUin, szUID, time(nullptr), dwMsgID1, dwMsgID2, wCookie, wVersion, nMsgType, bFlags, wAckType, dwLengthToEnd, 0, (char*)pDataBuf, MTF_PLUGIN | MTF_STATUS_EXTENDED, nullptr);
+ handleMessageTypes(dwUin, szUID, time(0), dwMsgID1, dwMsgID2, wCookie, wVersion, nMsgType, bFlags, wAckType, dwLengthToEnd, 0, (char*)pDataBuf, MTF_PLUGIN | MTF_STATUS_EXTENDED, nullptr);
}
else if (nTypeId) {
if (!dwUin) { // AIM cannot send this, just sanity
@@ -868,7 +868,7 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, DWORD dwUi
pMsgAck.wCookie = wCookie;
pMsgAck.msgType = nTypeId;
pMsgAck.bFlags = bFlags;
- handleMessageTypes(dwUin, szUID, time(nullptr), dwMsgID1, dwMsgID2, wCookie, wVersion, nTypeId, bFlags, wAckType, dwLengthToEnd, dwDataLen, (char*)pDataBuf, MTF_PLUGIN, &pMsgAck);
+ handleMessageTypes(dwUin, szUID, time(0), dwMsgID1, dwMsgID2, wCookie, wVersion, nTypeId, bFlags, wAckType, dwLengthToEnd, dwDataLen, (char*)pDataBuf, MTF_PLUGIN, &pMsgAck);
}
else debugLogA("Unsupported plugin message type %d", nTypeId);
}
@@ -1035,7 +1035,7 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c
icq_sendContactsAck(dwUin, szUID, dwID1, dwID2);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.szMessage = (char *)contacts;
pre.lParam = nContacts;
ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
@@ -1105,7 +1105,7 @@ void CIcqProto::handleRecvServMsgType4(BYTE *buf, size_t wLen, DWORD dwUin, char
debugLogA("User %u probably checks his ignore state.", dwUin);
else {
cookie_offline_messages *cookie;
- DWORD dwRecvTime = (DWORD)time(nullptr);
+ DWORD dwRecvTime = (DWORD)time(0);
if (!(dwRef & 0x80000000) && FindCookie(dwRef, nullptr, (void**)&cookie)) {
WORD wTimeTLVType;
@@ -1414,7 +1414,7 @@ void CIcqProto::handleStatusMsgReply(const char *szPrefix, MCONTACT hContact, DW
// it is probably UTF-8 status reply
PROTORECVEVENT pre = { 0 };
pre.szMessage = (char*)szMsg;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.lParam = wCookie;
ProtoChainRecv(hContact, PSR_AWAYMSG, status, (LPARAM)&pre);
}
@@ -2496,7 +2496,7 @@ void CIcqProto::handleMissedMsg(BYTE *buf, size_t wLen)
// Create event to notify user
int bAdded;
- AddEvent(HContactFromUID(dwUin, szUid, &bAdded), ICQEVENTTYPE_MISSEDMESSAGE, time(nullptr), 0, sizeof(wError), (PBYTE)&wError);
+ AddEvent(HContactFromUID(dwUin, szUid, &bAdded), ICQEVENTTYPE_MISSEDMESSAGE, time(0), 0, sizeof(wError), (PBYTE)&wError);
}
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp
index 55053359fb..823156c3b1 100644
--- a/protocols/IcqOscarJ/src/fam_13servclist.cpp
+++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp
@@ -1398,7 +1398,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, size_t wLen)
// TODO: Change for new auth system, include all known informations
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.lParam = blob.size();
pre.szMessage = blob;
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
@@ -1458,7 +1458,7 @@ void CIcqProto::handleRecvAdded(unsigned char *buf, size_t wLen)
*(char*)pCurBlob = 0;
// TODO: Change for new auth system
- AddEvent(NULL, EVENTTYPE_ADDED, time(nullptr), 0, cbBlob, pBlob);
+ AddEvent(NULL, EVENTTYPE_ADDED, time(0), 0, cbBlob, pBlob);
}
void CIcqProto::handleRecvAuthResponse(unsigned char *buf, size_t wLen)
diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
index 3a58297543..d21d3de17f 100644
--- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp
+++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
@@ -910,7 +910,7 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain
else if (bHasMetaToken || !hContact)
writeDbInfoSettingTLVDouble(hContact, DBSETTING_METAINFO_SAVED, cDetails, 0x1CC);
else
- setDword(hContact, DBSETTING_METAINFO_SAVED, time(nullptr));
+ setDword(hContact, DBSETTING_METAINFO_SAVED, time(0));
}
if (wReplySubType == META_DIRECTORY_RESPONSE)
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp
index c3d6b5792f..d05ed0d772 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.cpp
+++ b/protocols/IcqOscarJ/src/icq_avatar.cpp
@@ -875,7 +875,7 @@ void avatars_server_connection::checkRequestQueue()
void avatars_server_connection::connectionThread()
{
// This is the "infinite" loop that receives the packets from the ICQ avatar server
- DWORD dwLastKeepAlive = time(nullptr) + KEEPALIVE_INTERVAL;
+ DWORD dwLastKeepAlive = time(0) + KEEPALIVE_INTERVAL;
hPacketRecver = Netlib_CreatePacketReceiver(hConnection, 65536);
@@ -893,14 +893,14 @@ void avatars_server_connection::connectionThread()
if (Miranda_IsTerminated())
break;
- if (time(nullptr) >= dwLastKeepAlive) { // limit frequency (HACK: on some systems select() does not work well)
+ if (time(0) >= dwLastKeepAlive) { // limit frequency (HACK: on some systems select() does not work well)
if (!ppro->m_bGatewayMode && ppro->getByte("KeepAlive", DEFAULT_KEEPALIVE_ENABLED)) { // send keep-alive packet
icq_packet packet;
packet.wLen = 0;
write_flap(&packet, ICQ_PING_CHAN);
sendServerPacket(&packet);
}
- dwLastKeepAlive = time(nullptr) + KEEPALIVE_INTERVAL;
+ dwLastKeepAlive = time(0) + KEEPALIVE_INTERVAL;
}
// check if we got something to request
diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp
index 9872dbd9d6..77f34665a0 100644
--- a/protocols/IcqOscarJ/src/icq_direct.cpp
+++ b/protocols/IcqOscarJ/src/icq_direct.cpp
@@ -190,7 +190,7 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi)
size_t nSkipPacketBytes = 0;
DWORD dwReqMsgID1 = 0, dwReqMsgID2 = 0;
- srand(time(nullptr));
+ srand(time(0));
{
// add to DC connection list
mir_cslock l(directConnListMutex);
diff --git a/protocols/IcqOscarJ/src/icq_directmsg.cpp b/protocols/IcqOscarJ/src/icq_directmsg.cpp
index 2b880cfb58..60c056c866 100644
--- a/protocols/IcqOscarJ/src/icq_directmsg.cpp
+++ b/protocols/IcqOscarJ/src/icq_directmsg.cpp
@@ -136,7 +136,7 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen)
pMsgAck.wCookie = wCookie;
pMsgAck.msgType = bMsgType;
pMsgAck.bFlags = bMsgFlags;
- handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 0, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, &pMsgAck);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(0), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 0, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, &pMsgAck);
break;
}
}
@@ -148,7 +148,7 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen)
buf -= wTextLen;
wLen += wTextLen;
- handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 2, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, nullptr);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(0), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 2, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, nullptr);
}
else {
MCONTACT hCookieContact;
@@ -251,7 +251,7 @@ void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t
pMsgAck.pDC = dc;
pMsgAck.wCookie = wCookie;
pMsgAck.msgType = typeId;
- handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 0, 0, wCookie, dc->wVersion, typeId, 0, 0, dwLengthToEnd, dwDataLength, (char*)buf, MTF_PLUGIN | MTF_DIRECT, &pMsgAck);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(0), 0, 0, wCookie, dc->wVersion, typeId, 0, 0, dwLengthToEnd, dwDataLength, (char*)buf, MTF_PLUGIN | MTF_DIRECT, &pMsgAck);
}
else if (typeId == MTYPE_STATUSMSGEXT && wCommand == DIRECT_ACK) { // especially for icq2003b
NetLog_Direct("This is extended status reply");
@@ -261,7 +261,7 @@ void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t
szMsg[dwDataLength] = '\0';
uid_str szUID;
- handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 0, 0, wCookie, dc->wVersion, (int)(qt + 0xE7), 3, 2, wLen, dwDataLength, szMsg, MTF_PLUGIN | MTF_DIRECT, nullptr);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(0), 0, 0, wCookie, dc->wVersion, (int)(qt + 0xE7), 3, 2, wLen, dwDataLength, szMsg, MTF_PLUGIN | MTF_DIRECT, nullptr);
}
else if (typeId && wCommand == DIRECT_ACK) {
MCONTACT hCookieContact;
diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp
index 9af0b9203c..c6452896f3 100644
--- a/protocols/IcqOscarJ/src/icq_filerequests.cpp
+++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp
@@ -157,7 +157,7 @@ void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = mir_utf8decodeW(pszDescription);
pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
diff --git a/protocols/IcqOscarJ/src/icq_infoupdate.cpp b/protocols/IcqOscarJ/src/icq_infoupdate.cpp
index 4bfafdb33c..518e496b92 100644
--- a/protocols/IcqOscarJ/src/icq_infoupdate.cpp
+++ b/protocols/IcqOscarJ/src/icq_infoupdate.cpp
@@ -81,7 +81,7 @@ BOOL CIcqProto::icq_QueueUser(MCONTACT hContact)
if (dwUin) {
m_infoUpdateList[nFirstFree].dwUin = dwUin;
m_infoUpdateList[nFirstFree].hContact = hContact;
- m_infoUpdateList[nFirstFree].queued = time(nullptr);
+ m_infoUpdateList[nFirstFree].queued = time(0);
nInfoUserCount++;
debugLogA("Queued user %u, place %u, count %u", dwUin, nFirstFree, nInfoUserCount);
@@ -179,7 +179,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* )
continue; // we can't send requests now
if (nInfoUserCount && icqOnline()) {
- time_t now = time(nullptr);
+ time_t now = time(0);
BOOL bNotReady = FALSE, bTimeOuted = FALSE;
// Check the list, take only users that were there for at least 5sec
diff --git a/protocols/IcqOscarJ/src/icq_rates.cpp b/protocols/IcqOscarJ/src/icq_rates.cpp
index dfc42bbe7c..c34acddfc8 100644
--- a/protocols/IcqOscarJ/src/icq_rates.cpp
+++ b/protocols/IcqOscarJ/src/icq_rates.cpp
@@ -299,10 +299,9 @@ rates_queue::~rates_queue()
cleanup();
}
-static void rateDelayThread(void *param)
+static void rateDelayThread(rates_queue *pQueue)
{
Thread_SetName("ICQ: rateDelayThread");
- rates_queue *pQueue = (rates_queue*)param;
pQueue->handleDelay();
}
@@ -311,7 +310,7 @@ void rates_queue::initDelay(int nDelay)
ppro->debugLogA("Rates: Delay %dms", nDelay);
scheduledDelay = nDelay;
- mir_forkthread(rateDelayThread, this);
+ mir_forkThread<rates_queue>(rateDelayThread, this);
}
void rates_queue::handleDelay()
diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp
index 2839d7c435..942a9e0d73 100644
--- a/protocols/IcqOscarJ/src/icq_server.cpp
+++ b/protocols/IcqOscarJ/src/icq_server.cpp
@@ -45,7 +45,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
// store server port
info.wServerPort = infoParam->nloc.wPort;
- srand(time(nullptr));
+ srand(time(0));
ResetSettingsOnConnect();
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp
index 1720be39bb..9e9bb3ad6b 100644
--- a/protocols/IcqOscarJ/src/icq_servlist.cpp
+++ b/protocols/IcqOscarJ/src/icq_servlist.cpp
@@ -84,7 +84,7 @@ void __cdecl CIcqProto::servlistQueueThread(void *param)
// first check if the state is calm
while (*queueState) {
int i;
- time_t tNow = time(nullptr);
+ time_t tNow = time(0);
int bFound = FALSE;
for (i = 0; i < servlistQueueCount; i++) { // check if we do not have some expired items to handle, otherwise keep sleeping
@@ -285,7 +285,7 @@ void CIcqProto::servlistQueueAddGroupItem(servlistgroupitem* pGroupItem, int dwT
}
if (!pItem) { // compatible item was not found, create new one, add to queue
pItem = (ssiqueueditems*)SAFE_MALLOC(sizeof(ssiqueueditems));
- pItem->tAdded = time(nullptr);
+ pItem->tAdded = time(0);
pItem->dwTimeout = dwTimeout;
if (servlistQueueCount == servlistQueueSize) { // resize the queue - it is too small
diff --git a/protocols/IcqOscarJ/src/icq_xtraz.cpp b/protocols/IcqOscarJ/src/icq_xtraz.cpp
index 0782eedecd..960a0baa9a 100644
--- a/protocols/IcqOscarJ/src/icq_xtraz.cpp
+++ b/protocols/IcqOscarJ/src/icq_xtraz.cpp
@@ -330,7 +330,7 @@ void CIcqProto::handleXtrazData(DWORD dwUin, char* szMsg, BOOL bThruDC)
// Create message to notify user
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.szMessage = szWork;
int bAdded;
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp
index 3dc43813fe..1a5f54c28b 100644
--- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp
+++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp
@@ -425,7 +425,7 @@ int CIcqProto::OnIdleChanged(WPARAM, LPARAM lParam)
if (bPrivacy)
return 0;
- setDword("IdleTS", bIdle ? time(nullptr) : 0);
+ setDword("IdleTS", bIdle ? time(0) : 0);
if (m_bTempVisListEnabled) // remove temporary visible users
sendEntireListServ(ICQ_BOS_FAMILY, ICQ_CLI_REMOVETEMPVISIBLE, BUL_TEMPVISIBLE);
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp
index bf88320592..3f6a516c70 100644
--- a/protocols/IcqOscarJ/src/init.cpp
+++ b/protocols/IcqOscarJ/src/init.cpp
@@ -78,7 +78,7 @@ extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
- srand(time(nullptr));
+ srand(time(0));
_tzset();
// Initialize charset conversion routines
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
index 22e6d6dcd1..4c1d7cc317 100644
--- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
+++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
@@ -479,7 +479,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char *
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = mir_utf8decodeW(pszDescription);
pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp
index b9b97b89a8..f098af95cb 100644
--- a/protocols/IcqOscarJ/src/stdpackets.cpp
+++ b/protocols/IcqOscarJ/src/stdpackets.cpp
@@ -1342,7 +1342,7 @@ DWORD CIcqProto::icq_sendSMSServ(const char *szPhoneNumber, const char *szMsg)
WORD wBufferLen;
char *szBuffer = nullptr;
char szTime[30];
- time_t now = time(nullptr);
+ time_t now = time(0);
strftime(szTime, sizeof(szTime), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&now));
/* Sun, 00 Jan 0000 00:00:00 GMT */
@@ -1571,7 +1571,7 @@ void CIcqProto::icq_sendAuthResponseServ(DWORD dwUin, char* szUid, int auth, con
void CIcqProto::icq_sendYouWereAddedServ(DWORD dwUin, DWORD dwMyUin)
{
- DWORD dwID1 = time(nullptr);
+ DWORD dwID1 = time(0);
DWORD dwID2 = RandRange(0, 0x00FF);
icq_packet packet;
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp
index cc3ce357b1..9e6c898bd1 100644
--- a/protocols/IcqOscarJ/src/utilities.cpp
+++ b/protocols/IcqOscarJ/src/utilities.cpp
@@ -946,7 +946,7 @@ int CIcqProto::IsMetaInfoChanged(MCONTACT hContact)
db_free(&infoSaved);
- if ((time(nullptr) - dwInfoTime) > 14 * 3600 * 24) {
+ if ((time(0) - dwInfoTime) > 14 * 3600 * 24) {
res = 3; // threshold exceeded
}
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index e989a1e4d3..c7a739b642 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -234,7 +234,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus
gce.ptszUID = user->m_tszResourceName;
gce.ptszText = buf;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = time(nullptr);
+ gce.time = time(0);
Chat_Event(&gce);
}
}
@@ -263,7 +263,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t
gce.ptszText = szReason;
if (item->bChatActive == 2) {
gce.dwFlags |= GCEF_ADDTOLOG;
- gce.time = time(nullptr);
+ gce.time = time(0);
}
switch (gce.iType = action) {
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index 3316875e72..f8bf39701c 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -189,7 +189,7 @@ int CJabberProto::OnIdleChanged(WPARAM, LPARAM lParam)
if (lParam & IDF_ISIDLE) {
MIRANDA_IDLE_INFO mii;
Idle_GetInfo(mii);
- m_tmJabberIdleStartTime = time(nullptr) - mii.idleTime * 60;
+ m_tmJabberIdleStartTime = time(0) - mii.idleTime * 60;
}
else m_tmJabberIdleStartTime = 0;
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index b729e79206..698248a5f3 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -377,7 +377,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.files.w = (wchar_t**)&filename;
pre.lParam = (LPARAM)ft;
if ((n = XmlGetChild(fileNode, "desc")) != nullptr)
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 89c1f215ed..4deab1e08d 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -800,7 +800,7 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t *
GCEVENT gce = { m_szModuleName, item->jid, GC_EVENT_NICK };
if (jid != nullptr)
gce.ptszUserInfo = jid;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszNick = oldNick;
gce.ptszUID = newNick;
gce.ptszText = newNick;
@@ -1095,7 +1095,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
}
bool isHistory = msgTime != 0;
- time_t now = time(nullptr);
+ time_t now = time(0);
if (!msgTime || msgTime > now)
msgTime = now;
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index 92f4492ee4..942e257746 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -57,7 +57,7 @@ BOOL CJabberProto::OnIqRequestLastActivity(HXML, CJabberIqInfo *pInfo)
{
m_ThreadInfo->send(
XmlNodeIq(L"result", pInfo) << XQUERY(JABBER_FEAT_LAST_ACTIVITY)
- << XATTRI(L"seconds", m_tmJabberIdleStartTime ? time(nullptr) - m_tmJabberIdleStartTime : 0));
+ << XATTRI(L"seconds", m_tmJabberIdleStartTime ? time(0) - m_tmJabberIdleStartTime : 0));
return TRUE;
}
@@ -376,7 +376,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
PROTORECVFILE pre;
pre.dwFlags = PRFF_UNICODE;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = desc;
pre.files.w = &str2;
pre.fileCount = 1;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index e98ae24c1e..099b8b8d7f 100755
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -174,7 +174,7 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq)
void CJabberProto::OnLoggedIn()
{
m_bJabberOnline = true;
- m_tmJabberLoggedInTime = time(nullptr);
+ m_tmJabberLoggedInTime = time(0);
m_ThreadInfo->dwLoginRqs = 0;
@@ -1587,7 +1587,7 @@ void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo *pInfo)
if (szSeconds) {
int nSeconds = _wtoi(szSeconds);
if (nSeconds > 0)
- lastActivity = time(nullptr) - nSeconds;
+ lastActivity = time(0) - nSeconds;
}
const wchar_t *szLastStatusMessage = XPathT(iqNode, "query[@xmlns='jabber:iq:last']");
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 440cf657cf..d3a9570255 100755
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -52,7 +52,7 @@ void CJabberProto::DBAddAuthRequest(const wchar_t *jid, const wchar_t *nick)
DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.flags = DBEF_UTF;
dbei.eventType = EVENTTYPE_AUTHREQUEST;
dbei.cbBlob = blob.size();
@@ -123,7 +123,7 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType)
dbei.cbBlob = sizeof(btEventType);
dbei.eventType = EVENTTYPE_JABBER_PRESENCE;
dbei.flags = DBEF_READ;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.szModule = m_szModuleName;
db_event_add(hContact, &dbei);
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp
index f03d80d3fb..f52b0340fc 100755
--- a/protocols/JabberG/src/jabber_omemo.cpp
+++ b/protocols/JabberG/src/jabber_omemo.cpp
@@ -590,7 +590,7 @@ namespace omemo {
session_signed_pre_key* signed_pre_key;
{
const unsigned int signed_pre_key_id = 1;
- signal_protocol_key_helper_generate_signed_pre_key(&signed_pre_key, new_dev->device_key, signed_pre_key_id, time(nullptr), global_context);
+ signal_protocol_key_helper_generate_signed_pre_key(&signed_pre_key, new_dev->device_key, signed_pre_key_id, time(0), global_context);
SIGNAL_UNREF(new_dev->device_key);
signal_buffer *serialized_signed_pre_key;
session_signed_pre_key_serialize(&serialized_signed_pre_key, signed_pre_key);
@@ -1868,7 +1868,7 @@ bool CJabberProto::OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime)
}
}
- time_t now = time(nullptr);
+ time_t now = time(0);
if (!msgTime)
msgTime = now;
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 9ea5605e9c..1808615c7e 100755
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -590,7 +590,7 @@ private:
void cbServer_OnDropdown(CCtrlCombo*)
{
if (!m_gotservers)
- mir_forkthread(QueryServerListThread, this);
+ mir_forkThread<CDlgOptAccount>(QueryServerListThread, this);
}
void chkManualHost_OnChange(CCtrlData *sender)
@@ -710,11 +710,10 @@ private:
mir_free(server);
}
- static void QueryServerListThread(void *arg)
+ static void __cdecl QueryServerListThread(CDlgOptAccount *wnd)
{
Thread_SetName("Jabber: QueryServerListThread");
- CDlgOptAccount *wnd = (CDlgOptAccount *)arg;
HWND hwnd = wnd->GetHwnd();
bool bIsError = true;
@@ -1853,7 +1852,7 @@ private:
void cbServer_OnDropdown(CCtrlCombo*)
{
if (!m_gotservers)
- mir_forkthread(QueryServerListThread, this);
+ mir_forkThread<CJabberDlgAccMgrUI>(QueryServerListThread, this);
}
void cbType_OnChange(CCtrlData *sender)
@@ -1897,334 +1896,315 @@ private:
}
}
- void CheckRegistration();
- void setupConnection(int type);
- void setupPublic();
- void setupSecure();
- void setupSecureSSL();
- void setupGoogle();
- void setupHipchat();
- void setupLJ();
- void setupLOLEN();
- void setupLOLEW();
- void setupLOLOC();
- void setupLOLUS();
- void setupOK();
- void setupSMS();
- void RefreshServers(HXML node);
- static void QueryServerListThread(void *arg);
-};
+ void CheckRegistration()
+ {
+ if (!m_canregister) {
+ m_btnRegister.Disable();
+ return;
+ }
-void CJabberDlgAccMgrUI::CheckRegistration()
-{
- if (!m_canregister) {
- m_btnRegister.Disable();
- return;
+ JABBER_CONN_DATA regInfo;
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
+ regInfo.port = m_txtPort.GetInt();
+ if (m_chkManualHost.GetState() == BST_CHECKED)
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
+ else
+ regInfo.manualHost[0] = '\0';
+
+ if (regInfo.username[0] && regInfo.password[0] && regInfo.server[0] && regInfo.port > 0 && ((m_chkManualHost.GetState() != BST_CHECKED) || regInfo.manualHost[0]))
+ m_btnRegister.Enable();
+ else
+ m_btnRegister.Disable();
}
- JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
- m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
- regInfo.port = m_txtPort.GetInt();
- if (m_chkManualHost.GetState() == BST_CHECKED)
- m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
- else
- regInfo.manualHost[0] = '\0';
+ void setupConnection(int type)
+ {
+ switch (type) {
+ case ACC_PUBLIC: setupPublic(); break;
+ case ACC_TLS: setupSecure(); break;
+ case ACC_SSL: setupSecureSSL(); break;
+ case ACC_GTALK: setupGoogle(); break;
+ case ACC_HIPCHAT: setupHipchat(); break;
+ case ACC_LJTALK: setupLJ(); break;
+ case ACC_LOL_EN: setupLOLEN(); break;
+ case ACC_LOL_EW: setupLOLEW(); break;
+ case ACC_LOL_OC: setupLOLOC(); break;
+ case ACC_LOL_US: setupLOLUS(); break;
+ case ACC_OK: setupOK(); break;
+ case ACC_SMS: setupSMS(); break;
+ }
+ }
- if (regInfo.username[0] && regInfo.password[0] && regInfo.server[0] && regInfo.port > 0 && ((m_chkManualHost.GetState() != BST_CHECKED) || regInfo.manualHost[0]))
+ void setupPublic()
+ {
+ m_canregister = true;
+ m_gotservers = false;
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Enable();
+ m_chkManualHost.Enable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
m_btnRegister.Enable();
- else
- m_btnRegister.Disable();
-}
+ }
-void CJabberDlgAccMgrUI::setupConnection(int type)
-{
- switch (type) {
- case ACC_PUBLIC: setupPublic(); break;
- case ACC_TLS: setupSecure(); break;
- case ACC_SSL: setupSecureSSL(); break;
- case ACC_GTALK: setupGoogle(); break;
- case ACC_HIPCHAT: setupHipchat(); break;
- case ACC_LJTALK: setupLJ(); break;
- case ACC_LOL_EN: setupLOLEN(); break;
- case ACC_LOL_EW: setupLOLEW(); break;
- case ACC_LOL_OC: setupLOLOC(); break;
- case ACC_LOL_US: setupLOLUS(); break;
- case ACC_OK: setupOK(); break;
- case ACC_SMS: setupSMS(); break;
+ void setupSecure()
+ {
+ m_canregister = true;
+ m_gotservers = false;
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Enable();
+ m_chkManualHost.Enable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Enable();
}
-}
-void CJabberDlgAccMgrUI::setupPublic()
-{
- m_canregister = true;
- m_gotservers = false;
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Enable();
- m_chkManualHost.Enable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Enable();
-}
+ void setupSecureSSL()
+ {
+ m_canregister = true;
+ m_gotservers = false;
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5223);
+
+ m_cbServer.Enable();
+ m_chkManualHost.Enable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Enable();
+ }
-void CJabberDlgAccMgrUI::setupSecure()
-{
- m_canregister = true;
- m_gotservers = false;
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Enable();
- m_chkManualHost.Enable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Enable();
-}
+ void setupGoogle()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.AddStringA("gmail.com");
+ m_cbServer.AddStringA("googlemail.com");
+ m_cbServer.SetTextA("gmail.com");
+ m_chkManualHost.SetState(BST_CHECKED);
+ m_txtManualHost.SetTextA("talk.google.com");
+ m_txtPort.SetInt(443);
+
+ m_cbServer.Enable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupSecureSSL()
-{
- m_canregister = true;
- m_gotservers = false;
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5223);
-
- m_cbServer.Enable();
- m_chkManualHost.Enable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Enable();
-}
+ void setupHipchat()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("chat.hipchat.com");
+ m_cbServer.AddStringA("chat.hipchat.com");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupGoogle()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.AddStringA("gmail.com");
- m_cbServer.AddStringA("googlemail.com");
- m_cbServer.SetTextA("gmail.com");
- m_chkManualHost.SetState(BST_CHECKED);
- m_txtManualHost.SetTextA("talk.google.com");
- m_txtPort.SetInt(443);
-
- m_cbServer.Enable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- //m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupLJ()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("livejournal.com");
+ m_cbServer.AddStringA("livejournal.com");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupHipchat()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("chat.hipchat.com");
- m_cbServer.AddStringA("chat.hipchat.com");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupLOLEN()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("pvp.net");
+ m_cbServer.AddStringA("pvp.net");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("chat.eun1.lol.riotgames.com");
+ m_txtPort.SetInt(5223);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupLJ()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("livejournal.com");
- m_cbServer.AddStringA("livejournal.com");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupLOLEW()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("pvp.net");
+ m_cbServer.AddStringA("pvp.net");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("chat.euw1.lol.riotgames.com");
+ m_txtPort.SetInt(5223);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupLOLEN()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("pvp.net");
- m_cbServer.AddStringA("pvp.net");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("chat.eun1.lol.riotgames.com");
- m_txtPort.SetInt(5223);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupLOLOC()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("pvp.net");
+ m_cbServer.AddStringA("pvp.net");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("chat.oc1.lol.riotgames.com");
+ m_txtPort.SetInt(5223);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupLOLEW()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("pvp.net");
- m_cbServer.AddStringA("pvp.net");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("chat.euw1.lol.riotgames.com");
- m_txtPort.SetInt(5223);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupLOLUS()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("pvp.net");
+ m_cbServer.AddStringA("pvp.net");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("chat.na2.lol.riotgames.com");
+ m_txtPort.SetInt(5223);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupLOLOC()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("pvp.net");
- m_cbServer.AddStringA("pvp.net");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("chat.oc1.lol.riotgames.com");
- m_txtPort.SetInt(5223);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupOK()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("xmpp.odnoklassniki.ru");
+ m_cbServer.AddStringA("xmpp.odnoklassniki.ru");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupLOLUS()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("pvp.net");
- m_cbServer.AddStringA("pvp.net");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("chat.na2.lol.riotgames.com");
- m_txtPort.SetInt(5223);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void setupSMS()
+ {
+ m_canregister = false;
+ m_gotservers = true;
+ m_cbServer.ResetContent();
+ m_cbServer.SetTextA("S.ms");
+ m_cbServer.AddStringA("S.ms");
+ m_chkManualHost.SetState(BST_UNCHECKED);
+ m_txtManualHost.SetTextA("");
+ m_txtPort.SetInt(5222);
+
+ m_cbServer.Disable();
+ m_chkManualHost.Disable();
+ m_txtManualHost.Disable();
+ m_txtPort.Disable();
+ m_btnRegister.Disable();
+ }
-void CJabberDlgAccMgrUI::setupOK()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("xmpp.odnoklassniki.ru");
- m_cbServer.AddStringA("xmpp.odnoklassniki.ru");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ void RefreshServers(HXML node)
+ {
+ m_gotservers = node != nullptr;
-void CJabberDlgAccMgrUI::setupSMS()
-{
- m_canregister = false;
- m_gotservers = true;
- m_cbServer.ResetContent();
- m_cbServer.SetTextA("S.ms");
- m_cbServer.AddStringA("S.ms");
- m_chkManualHost.SetState(BST_UNCHECKED);
- m_txtManualHost.SetTextA("");
- m_txtPort.SetInt(5222);
-
- m_cbServer.Disable();
- m_chkManualHost.Disable();
- m_txtManualHost.Disable();
- m_txtPort.Disable();
- m_btnRegister.Disable();
-}
+ wchar_t *server = m_cbServer.GetText();
+ bool bDropdown = m_cbServer.GetDroppedState();
+ if (bDropdown) m_cbServer.ShowDropdown(false);
-void CJabberDlgAccMgrUI::RefreshServers(HXML node)
-{
- m_gotservers = node != nullptr;
+ m_cbServer.ResetContent();
+ if (node) {
+ for (int i = 0;; i++) {
+ HXML n = XmlGetChild(node, i);
+ if (!n)
+ break;
- wchar_t *server = m_cbServer.GetText();
- bool bDropdown = m_cbServer.GetDroppedState();
- if (bDropdown) m_cbServer.ShowDropdown(false);
+ if (!mir_wstrcmp(XmlGetName(n), L"item"))
+ if (const wchar_t *jid = XmlGetAttrValue(n, L"jid"))
+ if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
+ m_cbServer.AddString(jid);
+ }
+ }
- m_cbServer.ResetContent();
- if (node) {
- for (int i = 0;; i++) {
- HXML n = XmlGetChild(node, i);
- if (!n)
- break;
+ m_cbServer.SetText(server);
- if (!mir_wstrcmp(XmlGetName(n), L"item"))
- if (const wchar_t *jid = XmlGetAttrValue(n, L"jid"))
- if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
- m_cbServer.AddString(jid);
- }
+ if (bDropdown) m_cbServer.ShowDropdown();
+ mir_free(server);
}
- m_cbServer.SetText(server);
+ static void __cdecl QueryServerListThread(CJabberDlgAccMgrUI *wnd)
+ {
+ HWND hwnd = wnd->GetHwnd();
+ bool bIsError = true;
- if (bDropdown) m_cbServer.ShowDropdown();
- mir_free(server);
-}
+ NETLIBHTTPREQUEST request = { 0 };
+ request.cbSize = sizeof(request);
+ request.requestType = REQUEST_GET;
+ request.flags = NLHRF_HTTP11;
+ request.szUrl = JABBER_SERVER_URL;
-void CJabberDlgAccMgrUI::QueryServerListThread(void *arg)
-{
- CDlgOptAccount *wnd = (CDlgOptAccount *)arg;
- HWND hwnd = wnd->GetHwnd();
- bool bIsError = true;
-
- NETLIBHTTPREQUEST request = { 0 };
- request.cbSize = sizeof(request);
- request.requestType = REQUEST_GET;
- request.flags = NLHRF_HTTP11;
- request.szUrl = JABBER_SERVER_URL;
-
- NETLIBHTTPREQUEST *result = Netlib_HttpTransaction(wnd->GetProto()->m_hNetlibUser, &request);
- if (result && IsWindow(hwnd)) {
- if ((result->resultCode == 200) && result->dataLength && result->pData) {
- wchar_t *ptszText = mir_a2u(result->pData);
- XmlNode node(ptszText, nullptr, nullptr);
- if (node) {
- HXML queryNode = XmlGetChild(node, L"query");
- if (queryNode && IsWindow(hwnd)) {
- SendMessage(hwnd, WM_JABBER_REFRESH, 0, (LPARAM)queryNode);
- bIsError = false;
+ NETLIBHTTPREQUEST *result = Netlib_HttpTransaction(wnd->GetProto()->m_hNetlibUser, &request);
+ if (result && IsWindow(hwnd)) {
+ if ((result->resultCode == 200) && result->dataLength && result->pData) {
+ wchar_t *ptszText = mir_a2u(result->pData);
+ XmlNode node(ptszText, nullptr, nullptr);
+ if (node) {
+ HXML queryNode = XmlGetChild(node, L"query");
+ if (queryNode && IsWindow(hwnd)) {
+ SendMessage(hwnd, WM_JABBER_REFRESH, 0, (LPARAM)queryNode);
+ bIsError = false;
+ }
}
+ mir_free(ptszText);
}
- mir_free(ptszText);
}
- }
- if (result)
- Netlib_FreeHttpRequest(result);
- if (bIsError)
- SendMessage(hwnd, WM_JABBER_REFRESH, 0, 0);
-}
+ if (result)
+ Netlib_FreeHttpRequest(result);
+ if (bIsError)
+ SendMessage(hwnd, WM_JABBER_REFRESH, 0, 0);
+ }
+};
INT_PTR CJabberProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index de7141ecf6..38aae073ee 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1238,7 +1238,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
dbei.cbBlob = 1;
dbei.eventType = EVENTTYPE_JABBER_CHATSTATES;
dbei.flags = DBEF_READ;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.szModule = m_szModuleName;
db_event_add(hContact, &dbei);
}
@@ -1490,7 +1490,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
hContact = CreateTemporaryContact(from, chatItem);
CallService(MS_PROTO_CONTACTISTYPING, hContact, PROTOTYPE_CONTACTTYPING_OFF);
- time_t now = time(nullptr);
+ time_t now = time(0);
if (!msgTime)
msgTime = now;
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 9679ee23ca..b4b4537de5 100755
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -447,7 +447,7 @@ void CJabberProto::SendPresenceTo(int status, const wchar_t* to, HXML extra, con
}
if (m_tmJabberIdleStartTime)
- p << XQUERY(JABBER_FEAT_LAST_ACTIVITY) << XATTRI(L"seconds", time(nullptr) - m_tmJabberIdleStartTime);
+ p << XQUERY(JABBER_FEAT_LAST_ACTIVITY) << XATTRI(L"seconds", time(0) - m_tmJabberIdleStartTime);
if (m_bEnableAvatars) {
HXML x = p << XCHILDNS(L"x", L"vcard-temp:x:update");
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 1b2ec046c2..91dd706532 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -872,14 +872,13 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode
/////////////////////////////////////////////////////////////////////////////////////////
-static void FakeThread(void* param)
+static void __cdecl FakeThread(ACKDATA *ack)
{
Thread_SetName("MRA: ProtoBroadcastAckAsync");
Sleep(100);
- ACKDATA *ack = (ACKDATA*)param;
ProtoBroadcastAck(ack->szModule, ack->hContact, ack->type, ack->result, ack->hProcess, ack->lParam);
- mir_free(param);
+ mir_free(ack);
}
DWORD CMraProto::ProtoBroadcastAckAsync(MCONTACT hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam)
@@ -891,7 +890,7 @@ DWORD CMraProto::ProtoBroadcastAckAsync(MCONTACT hContact, int type, int hResult
ack->result = hResult;
ack->hProcess = hProcess;
ack->lParam = lParam;
- mir_forkthread(FakeThread, ack);
+ mir_forkThread<ACKDATA>(FakeThread, ack);
return 0;
}
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp
index 135ffaf6c1..e8c1fa4602 100644
--- a/protocols/MSN/src/msn_auth.cpp
+++ b/protocols/MSN/src/msn_auth.cpp
@@ -302,7 +302,7 @@ bool SkypeToken::Refresh(bool bForce)
time_t tExpires = (*root)["expiresIn"].as_int();
if (tExpires == 0)
tExpires = 86400;
- SetToken("skype_token " + szToken, time(nullptr) + tExpires);
+ SetToken("skype_token " + szToken, time(0) + tExpires);
bRet = true;
}
}
@@ -353,7 +353,7 @@ int CMsnProto::MSN_GetPassportAuth(void)
szPassword[99] = 0;
- time_t ts = time(nullptr);
+ time_t ts = time(0);
wchar_t szTs1[64], szTs2[64];
TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, L"I", szTs1, _countof(szTs1), 0);
@@ -404,7 +404,7 @@ int CMsnProto::MSN_GetPassportAuth(void)
ezxml_t xml_expires = ezxml_get(tokr, "wst:Lifetime", 0, "wsu:Expires", -1);
time_t expires;
- expires = xml_expires ? IsoToUnixTime(ezxml_txt(xml_expires)) : time(nullptr) + 86400;
+ expires = xml_expires ? IsoToUnixTime(ezxml_txt(xml_expires)) : time(0) + 86400;
if (mir_strcmp(addr, "http://Passport.NET/tb") == 0) {
@@ -722,7 +722,7 @@ bool CMsnProto::RefreshOAuth(const char *pszRefreshToken, const char *pszService
if (*ptExpires == 0)
bRet = false;
else
- *ptExpires += time(nullptr);
+ *ptExpires += time(0);
}
}
}
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index 61397d677b..681a931702 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -482,7 +482,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = bError ? L"" : dbv.ptszVal;
gce.ptszUID = mir_a2u(MyOptions.szEmail);
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.ptszText = gch->ptszText;
gce.bIsMe = TRUE;
Chat_Event(&gce);
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index 5b0e0cd946..088e9acba3 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -233,7 +233,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
}
if (cnt) {
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.szMessage = (char *)psr;
pre.lParam = cnt;
ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
@@ -283,7 +283,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
ezxml_free(xmli);
}
}
- else MSN_GCAddMessage(mChatID, hContact, email, time(nullptr), sentMsg, msgBody);
+ else MSN_GCAddMessage(mChatID, hContact, email, time(0), sentMsg, msgBody);
}
else if (hContact) {
if (!sentMsg) {
@@ -292,7 +292,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
PROTORECVEVENT pre = { 0 };
pre.szMessage = (char*)msgBody;
pre.flags = (isRtl ? PREF_RTL : 0);
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.lParam = 0;
ProtoChainRecvMsg(hContact, &pre);
}
@@ -303,7 +303,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF | (haveWnd ? 0 : DBEF_READ) | (isRtl ? DBEF_RTL : 0);
dbei.szModule = m_szModuleName;
- dbei.timestamp = time(nullptr);
+ dbei.timestamp = time(0);
dbei.cbBlob = (unsigned)mir_strlen(msgBody) + 1;
dbei.pBlob = (PBYTE)msgBody;
db_event_add(hContact, &dbei);
@@ -459,7 +459,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli)
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeW(desc->txt):tComment;
pre.files.w = &ft->std.szCurrentFile.w;
pre.lParam = (LPARAM)ft;
@@ -477,7 +477,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli)
ezxml_t urllnk;
if (urllnk=ezxml_child(xmli, "a")) msgtxt.AppendFormat(" %s", ezxml_txt(urllnk));
pre.szMessage = (char*)(const char*)msgtxt;
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
ProtoChainRecvMsg(hContact, &pre);
}
}
@@ -579,7 +579,7 @@ void CMsnProto::MSN_ProcessNLN(const char *userStatus, const char *wlid, char *u
int newStatus = MSNStatusToMiranda(userStatus);
setWord(hContact, "Status", newStatus != ID_STATUS_IDLE ? newStatus : ID_STATUS_AWAY);
- setDword(hContact, "IdleTS", newStatus != ID_STATUS_IDLE ? 0 : time(nullptr));
+ setDword(hContact, "IdleTS", newStatus != ID_STATUS_IDLE ? 0 : time(0));
}
if (cont) {
diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp
index 5ff16d857c..c8780d771a 100644
--- a/protocols/MSN/src/msn_libstr.cpp
+++ b/protocols/MSN/src/msn_libstr.cpp
@@ -403,7 +403,7 @@ time_t MsnTSToUnixtime(const char *pszTS)
{
char szTS[16];
- if (!*pszTS) return time(nullptr);
+ if (!*pszTS) return time(0);
strncpy(szTS, pszTS, 10);
return (time_t)atoi(szTS);
}
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp
index 7673fd7a9f..30262e49c5 100644
--- a/protocols/MSN/src/msn_mail.cpp
+++ b/protocols/MSN/src/msn_mail.cpp
@@ -94,7 +94,7 @@ void CMsnProto::getOIMs(ezxml_t xmli)
MimeHeaders mailInfo;
const char* mailbody = mailInfo.readFromBuffer((char*)ezxml_txt(body));
- time_t evtm = time(nullptr);
+ time_t evtm = time(0);
const char* arrTime = mailInfo["X-OriginalArrivalTime"];
if (arrTime != nullptr) {
char szTime[32], *p;
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 4e09b187f7..8912cc133a 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -86,7 +86,7 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const ch
DB_AUTH_BLOB blob(hContact, nick, nullptr, nullptr, email, reason);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(nullptr);
+ pre.timestamp = (DWORD)time(0);
pre.lParam = blob.size();
pre.szMessage = blob;
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
@@ -710,7 +710,7 @@ void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url)
if (p)
*p = 0;
- CMStringA post = HotmailLogin(CMStringA().Format(postdata, (unsigned)time(nullptr), ptrA(mir_urlEncode(url))));
+ CMStringA post = HotmailLogin(CMStringA().Format(postdata, (unsigned)time(0), ptrA(mir_urlEncode(url))));
if (!post.IsEmpty()) {
CMStringA hippy(passport);
hippy.AppendFormat("/ppsecure/sha1auth.srf?lc=%d&token=%s", itoa(langpref, passport, 10), ptrA(mir_urlEncode(post)));
diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h
index dc4567fc45..a96e8a8efa 100644
--- a/protocols/MSN/src/stdafx.h
+++ b/protocols/MSN/src/stdafx.h
@@ -692,7 +692,7 @@ public:
bool Load();
void Save();
virtual bool Refresh(bool = false) { return false; }
- bool Expired(time_t t = time(nullptr));
+ bool Expired(time_t t = time(0));
void Clear();
const char *Token();
__forceinline operator char*() const { return m_pszToken; }
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp
index 7fd96f73e2..8fbb976428 100644
--- a/protocols/MinecraftDynmap/src/chat.cpp
+++ b/protocols/MinecraftDynmap/src/chat.cpp
@@ -90,7 +90,7 @@ void MinecraftDynmapProto::AddChatContact(const char *name)
ptrW tname(mir_a2u_cp(name, CP_UTF8));
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tname;
gce.ptszUID = gce.ptszNick;
@@ -112,7 +112,7 @@ void MinecraftDynmapProto::DeleteChatContact(const char *name)
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tname;
gce.ptszUID = gce.ptszNick;
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
gce.bIsMe = (m_nick == name);
Chat_Event(&gce);
@@ -144,7 +144,7 @@ void MinecraftDynmapProto::SetTopic(const char *topic)
ptrW ttopic(mir_a2u_cp(topic, CP_UTF8));
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
- gce.time = ::time(nullptr);
+ gce.time = ::time(0);
gce.ptszText = ttopic;
Chat_Event( &gce);
diff --git a/protocols/MinecraftDynmap/src/communication.cpp b/protocols/MinecraftDynmap/src/communication.cpp
index 0c9109fa9c..2124715301 100644
--- a/protocols/MinecraftDynmap/src/communication.cpp
+++ b/protocols/MinecraftDynmap/src/communication.cpp
@@ -372,7 +372,7 @@ void MinecraftDynmapProto::SignOnWorker(void*)
m_iStatus = m_iDesiredStatus;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
- setDword("LogonTS", (DWORD)time(nullptr));
+ setDword("LogonTS", (DWORD)time(0));
ClearChat();
OnJoinChat(0, false);
@@ -422,7 +422,7 @@ void MinecraftDynmapProto::EventsLoop(void *)
{
ScopedLock s(events_loop_lock_);
- time_t tim = ::time(nullptr);
+ time_t tim = ::time(0);
debugLogA(">>>>> Entering %s[%d]", __FUNCTION__, tim);
while (doEvents())
diff --git a/protocols/MinecraftDynmap/src/proto.h b/protocols/MinecraftDynmap/src/proto.h
index 9979e62ed8..00e7803932 100644
--- a/protocols/MinecraftDynmap/src/proto.h
+++ b/protocols/MinecraftDynmap/src/proto.h
@@ -66,7 +66,7 @@ public:
// Chat handling
void AddChat(const char *id, const char *name);
- void UpdateChat(const char *name, const char *message, const time_t timestamp = time(nullptr), bool addtochat = true);
+ void UpdateChat(const char *name, const char *message, const time_t timestamp = time(0), bool addtochat = true);
void AddChatContact(const char *nick);
void DeleteChatContact(const char *name);
void SetChatStatus(int);
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp
index 5af8301681..a65ac5b839 100644
--- a/protocols/Omegle/src/chat.cpp
+++ b/protocols/Omegle/src/chat.cpp
@@ -28,7 +28,7 @@ void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool a
utils::text::treplace_all(&smessage, L"%", L"%%");
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
- gce.time = ::time(nullptr);
+ gce.time = ::time(0);
gce.ptszText = smessage.c_str();
if (name == nullptr) {
@@ -227,7 +227,7 @@ Chat_Event(WINDOW_CLEARLOG,&gce);
void OmegleProto::AddChatContact(const wchar_t *name)
{
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
@@ -251,7 +251,7 @@ void OmegleProto::DeleteChatContact(const wchar_t *name)
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
if (name == nullptr)
gce.bIsMe = false;
else
@@ -284,7 +284,7 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
void OmegleProto::SetTopic(const wchar_t *topic)
{
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
- gce.time = ::time(nullptr);
+ gce.time = ::time(0);
if (topic == nullptr)
gce.ptszText = TranslateT("Omegle is a great way of meeting new friends!");
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp
index bd05f3e174..096656e31a 100644
--- a/protocols/Omegle/src/communication.cpp
+++ b/protocols/Omegle/src/communication.cpp
@@ -172,7 +172,7 @@ std::string Omegle_client::get_server(bool not_last)
server = 0;
if (server == 0) {
- srand(::time(nullptr));
+ srand(::time(0));
server = (rand() % (_countof(servers) - 1 - q)) + 1;
}
diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp
index 5f04a00bed..b8e71ab95d 100644
--- a/protocols/Omegle/src/connection.cpp
+++ b/protocols/Omegle/src/connection.cpp
@@ -34,7 +34,7 @@ void OmegleProto::SignOn(void*)
m_iStatus = m_iDesiredStatus;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
- setDword("LogonTS", (DWORD)time(nullptr));
+ setDword("LogonTS", (DWORD)time(0));
ClearChat();
OnJoinChat(0, false);
@@ -172,7 +172,7 @@ void OmegleProto::EventsLoop(void *)
{
ScopedLock s(events_loop_lock_);
- time_t tim = ::time(nullptr);
+ time_t tim = ::time(0);
debugLogA(">>>>> Entering Omegle::EventsLoop[%d]", tim);
while (facy.events())
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp
index d96ca4e66d..1df4c0570f 100644
--- a/protocols/Sametime/src/conference.cpp
+++ b/protocols/Sametime/src/conference.cpp
@@ -184,7 +184,7 @@ void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user)
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
gce.ptszStatus = L"Normal";
- gce.time = (DWORD)time(nullptr);
+ gce.time = (DWORD)time(0);
Chat_Event( &gce);
@@ -209,7 +209,7 @@ void mwServiceConf_on_peer_parted(mwConference* conf, mwLoginInfo* user)
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
gce.ptszStatus = L"Normal";
- gce.time = (DWORD)time(nullptr);
+ gce.time = (DWORD)time(0);
Chat_Event(&gce);
}
@@ -229,7 +229,7 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh
gce.ptszText = textT;
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
- gce.time = (DWORD)time(nullptr);
+ gce.time = (DWORD)time(0);
Chat_Event(&gce);
}
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp
index e7d206c4fc..080e23fcc4 100644
--- a/protocols/Sametime/src/files.cpp
+++ b/protocols/Sametime/src/files.cpp
@@ -41,7 +41,7 @@ void mwFileTransfer_offered(mwFileTransfer* ft)
PROTORECVFILE pre = {0};
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.descr.w = descriptionT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
@@ -52,12 +52,12 @@ void mwFileTransfer_offered(mwFileTransfer* ft)
}
//returns 0 if finished with current file
-int SendFileChunk(CSametimeProto* proto, mwFileTransfer* ft, FileTransferClientData* ftcd) {
- DWORD bytes_read;
-
+int SendFileChunk(CSametimeProto* proto, mwFileTransfer* ft, FileTransferClientData* ftcd)
+{
if (!ftcd || !ftcd->buffer)
return 0;
+ DWORD bytes_read;
if (!ReadFile(ftcd->hFile, ftcd->buffer, FILE_BUFF_SIZE, &bytes_read, nullptr)) {
proto->debugLogW(L"Sametime closing file transfer (SendFileChunk)");
mwFileTransfer_close(ft, mwFileTransfer_SUCCESS);
@@ -72,9 +72,8 @@ int SendFileChunk(CSametimeProto* proto, mwFileTransfer* ft, FileTransferClientD
return bytes_read;
}
-void __cdecl SendThread(LPVOID param) {
-
- mwFileTransfer* ft = (mwFileTransfer*)param;
+void __cdecl SendThread(mwFileTransfer* ft)
+{
if (!ft) return;
CSametimeProto* proto = getProtoFromMwFileTransfer(ft);
FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft);
@@ -113,7 +112,6 @@ void __cdecl SendThread(LPVOID param) {
delete ftcd;
proto->debugLogW(L"SendThread() end");
- return;
}
/** a file transfer has been fully initiated */
@@ -124,10 +122,9 @@ void mwFileTransfer_opened(mwFileTransfer* ft)
proto->debugLogW(L"Sametime mwFileTransfer_opened start");
- if (ftcd->sending) {
- // create a thread to send chunks - since it seems not all clients send acks for each of our chunks!
- mir_forkthread(SendThread, ft);
- }
+ // create a thread to send chunks - since it seems not all clients send acks for each of our chunks!
+ if (ftcd->sending)
+ mir_forkThread<mwFileTransfer>(SendThread, ft);
}
/** a file transfer has been closed. Check the status of the file
diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp
index 9b0fa0b9fb..cc79c8b9dc 100644
--- a/protocols/Sametime/src/messaging.cpp
+++ b/protocols/Sametime/src/messaging.cpp
@@ -82,7 +82,7 @@ void mwIm_conversation_recv(mwConversation* conv, mwImSendType type, gconstpoint
return;
PROTORECVEVENT pre = { 0 };
- time_t t = time(nullptr);
+ time_t t = time(0);
pre.timestamp = t;
pre.szMessage = (char*)msg;
ProtoChainRecvMsg(hContact, &pre);
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp
index 3246dccc53..3c67736302 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -111,9 +111,8 @@ void ReleaseIconEx(const char* name, bool big)
}
// Copied from MSN plugin - sent acks need to be from different thread
-void __cdecl sttFakeAckInfoSuccessThread(void *param)
+void __cdecl sttFakeAckInfoSuccessThread(TFakeAckParams* tParam)
{
- TFakeAckParams* tParam = (TFakeAckParams*)param;
CSametimeProto* proto = tParam->proto;
proto->debugLogW(L"sttFakeAckInfoSuccessThread() start");
@@ -124,9 +123,8 @@ void __cdecl sttFakeAckInfoSuccessThread(void *param)
mir_free(tParam);
}
-void __cdecl sttFakeAckMessageSuccessThread(void *param)
+void __cdecl sttFakeAckMessageSuccessThread(TFakeAckParams* tParam)
{
- TFakeAckParams* tParam = (TFakeAckParams*)param;
CSametimeProto* proto = tParam->proto;
proto->debugLogW(L"sttFakeAckMessageSuccessThread() start");
@@ -137,9 +135,8 @@ void __cdecl sttFakeAckMessageSuccessThread(void *param)
mir_free(tParam);
}
-void __cdecl sttFakeAckMessageFailedThread(void *param)
+void __cdecl sttFakeAckMessageFailedThread(TFakeAckParams* tParam)
{
- TFakeAckParams* tParam = (TFakeAckParams*)param;
CSametimeProto* proto = tParam->proto;
proto->debugLogW(L"sttFakeAckMessageFailedThread() start");
@@ -150,9 +147,8 @@ void __cdecl sttFakeAckMessageFailedThread(void *param)
mir_free(tParam);
}
-void __cdecl sttRecvAwayThread(void *param)
+void __cdecl sttRecvAwayThread(TFakeAckParams* tParam)
{
- TFakeAckParams* tParam = (TFakeAckParams*)param;
CSametimeProto* proto = tParam->proto;
proto->debugLogW(L"sttRecvAwayThread() start");
diff --git a/protocols/Sametime/src/sametime.h b/protocols/Sametime/src/sametime.h
index b0e807489b..ccf1c920e8 100644
--- a/protocols/Sametime/src/sametime.h
+++ b/protocols/Sametime/src/sametime.h
@@ -47,10 +47,17 @@ void ReleaseIconEx(const char* name, bool big);
// services (async thread functions)
-void __cdecl sttFakeAckInfoSuccessThread(void* param);
-void __cdecl sttFakeAckMessageFailedThread(void* param);
-void __cdecl sttFakeAckMessageSuccessThread(void* param);
-void __cdecl sttRecvAwayThread(void* param);
+struct TFakeAckParams
+{
+ struct CSametimeProto* proto;
+ MCONTACT hContact;
+ LPARAM lParam;
+};
+
+void __cdecl sttFakeAckInfoSuccessThread(TFakeAckParams* tParam);
+void __cdecl sttFakeAckMessageFailedThread(TFakeAckParams* tParam);
+void __cdecl sttFakeAckMessageSuccessThread(TFakeAckParams* tParam);
+void __cdecl sttRecvAwayThread(TFakeAckParams* tParam);
//sametime structs
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp
index 9b6abed685..f84ed684e3 100644
--- a/protocols/Sametime/src/sametime_proto.cpp
+++ b/protocols/Sametime/src/sametime_proto.cpp
@@ -147,7 +147,7 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType)
tfap->proto = this;
tfap->hContact = hContact;
tfap->lParam = NULL;
- mir_forkthread(sttFakeAckInfoSuccessThread, tfap);
+ mir_forkThread<TFakeAckParams>(sttFakeAckInfoSuccessThread, tfap);
return 0;
}
@@ -219,7 +219,7 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg)
tfap->proto = this;
tfap->hContact = hContact;
tfap->lParam = 0;
- mir_forkthread(sttFakeAckMessageFailedThread, tfap);
+ mir_forkThread<TFakeAckParams>(sttFakeAckMessageFailedThread, tfap);
return 0;
}
@@ -232,7 +232,7 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg)
tfap->proto = this;
tfap->hContact = hContact;
tfap->lParam = (LPARAM)ret;
- mir_forkthread(sttFakeAckMessageSuccessThread, tfap);
+ mir_forkThread<TFakeAckParams>(sttFakeAckMessageSuccessThread, tfap);
return ret;
}
@@ -262,7 +262,7 @@ HANDLE CSametimeProto::GetAwayMsg(MCONTACT hContact)
tfap = (TFakeAckParams*)malloc(sizeof(TFakeAckParams));
tfap->proto = this;
tfap->hContact = hContact;
- mir_forkthread(sttRecvAwayThread, tfap);
+ mir_forkThread<TFakeAckParams>(sttRecvAwayThread, tfap);
return (HANDLE)1;
}
return nullptr;
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h
index 84407541de..242f68cf6c 100644
--- a/protocols/Sametime/src/sametime_proto.h
+++ b/protocols/Sametime/src/sametime_proto.h
@@ -14,7 +14,6 @@ struct CSametimeProto : public PROTO<CSametimeProto>
// PROTO_INTERFACE
//====================================================================================
-
MCONTACT AddToList(int flags, PROTOSEARCHRESULT* psr) override;
HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath) override;
@@ -121,6 +120,9 @@ struct CSametimeProto : public PROTO<CSametimeProto>
void DeinitAwayMsg();
void InitMeanwhileServices();
void DeinitMeanwhileServices();
+
+ void __cdecl KeepAliveThread(void*);
+ void __cdecl SessionThread(void*);
// options.cpp
int __cdecl OptInit(WPARAM wParam, LPARAM lParam);
@@ -198,14 +200,8 @@ struct CMPlugin : public ACCPROTOPLUGIN<CSametimeProto>
}
};
-typedef struct tag_TFakeAckParams {
- CSametimeProto* proto;
- MCONTACT hContact;
- LPARAM lParam;
-} TFakeAckParams;
-
-
-struct SendAnnouncementFunc_arg {
+struct SendAnnouncementFunc_arg
+{
CSametimeProto* proto;
wchar_t msg[MAX_MESSAGE_SIZE];
GList* recipients;
@@ -213,13 +209,15 @@ struct SendAnnouncementFunc_arg {
typedef void (*SendAnnouncementFunc)(SendAnnouncementFunc_arg* ad);
-struct SessionAnnounceDialogProc_arg {
+struct SessionAnnounceDialogProc_arg
+{
CSametimeProto* proto;
SendAnnouncementFunc sendAnnouncementFunc;
};
-struct PopupData {
+struct PopupData
+{
SametimePopupEnum flag;
wchar_t* title;
wchar_t* text;
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp
index fc029ee5ea..5cdf633385 100644
--- a/protocols/Sametime/src/sametime_session.cpp
+++ b/protocols/Sametime/src/sametime_session.cpp
@@ -245,7 +245,7 @@ int CSametimeProto::SetSessionStatus(int status)
if (idle_timerid) KillTimer(nullptr, idle_timerid);
- us.time = (DWORD)time(nullptr);
+ us.time = (DWORD)time(0);
//us.time = 0;
switch (status) {
@@ -286,7 +286,7 @@ VOID CALLBACK IdleTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime
if (proto->idle_status) {
struct mwUserStatus us;
- us.time = (DWORD)time(nullptr);
+ us.time = (DWORD)time(0);
us.status = mwStatus_IDLE;
us.desc = nullptr;
mwSession_setUserStatus(proto->session, &us);
@@ -341,19 +341,18 @@ void WakeThread(HANDLE hThread)
QueueUserAPC(NullAPC, hThread, 0);
}
-void __cdecl KeepAliveThread(LPVOID param)
+void __cdecl CSametimeProto::KeepAliveThread(void*)
{
- CSametimeProto* proto = (CSametimeProto*)param;
int i = 120;
- proto->debugLogW(L"KeepAliveThread() start");
+ debugLogW(L"KeepAliveThread() start");
while (1) {
if (i <= 0) {
i = 120;
// send keepalive every 120 * 250 = 30000[ms]
- if (mwSession_isStarted(proto->session) && proto->session) {
- mwSession_sendKeepalive(proto->session);
+ if (mwSession_isStarted(session) && session) {
+ mwSession_sendKeepalive(session);
}
}
@@ -361,9 +360,9 @@ void __cdecl KeepAliveThread(LPVOID param)
SleepEx(250, TRUE);
- mir_cslock lck(proto->session_cs);
- if (Miranda_IsTerminated() || !proto->session) {
- proto->debugLogW(L"KeepAliveThread() end");
+ mir_cslock lck(session_cs);
+ if (Miranda_IsTerminated() || !session) {
+ debugLogW(L"KeepAliveThread() end");
break;
}
}
@@ -376,65 +375,64 @@ int waitcallback(unsigned int* timeout)
return continue_connect ? 1 : 0;
}
-void __cdecl SessionThread(LPVOID param)
+void __cdecl CSametimeProto::SessionThread(LPVOID)
{
- CSametimeProto* proto = (CSametimeProto*)param;
- proto->debugLogW(L"SessionThread() start");
+ debugLogW(L"SessionThread() start");
continue_connect = true;
- proto->BroadcastNewStatus(ID_STATUS_CONNECTING);
+ BroadcastNewStatus(ID_STATUS_CONNECTING);
// setup
NETLIBOPENCONNECTION conn_data = { 0 };
conn_data.cbSize = sizeof(NETLIBOPENCONNECTION);
conn_data.flags = NLOCF_V2;
- conn_data.szHost = proto->options.server_name;
- conn_data.wPort = proto->options.port;
+ conn_data.szHost = options.server_name;
+ conn_data.wPort = options.port;
conn_data.timeout = 20;
conn_data.waitcallback = waitcallback;
- proto->server_connection = Netlib_OpenConnection(proto->m_hNetlibUser, &conn_data);
+ server_connection = Netlib_OpenConnection(m_hNetlibUser, &conn_data);
- if (!proto->server_connection) {
+ if (!server_connection) {
- proto->BroadcastNewStatus(ID_STATUS_OFFLINE);
+ BroadcastNewStatus(ID_STATUS_OFFLINE);
if (continue_connect) {
// real timeout - not user cancelled
- proto->showPopup(TranslateT("No server connection!"), SAMETIME_POPUP_ERROR);
+ showPopup(TranslateT("No server connection!"), SAMETIME_POPUP_ERROR);
}
- proto->debugLogW(L"SessionThread() end, no server_connection, continue_connect=[%d]", continue_connect);
+ debugLogW(L"SessionThread() end, no server_connection, continue_connect=[%d]", continue_connect);
return;
}
mwSessionHandler handler = {};
- handler.clear = SessionClear;
- handler.io_write = SessionWrite;
- handler.io_close = SessionClose;
- handler.on_stateChange = SessionStateChange;
- handler.on_admin = SessionAdmin;
- handler.on_announce = SessionAnnounce;
- handler.on_setPrivacyInfo = SessionSetPrivacyInfo;
- handler.on_setUserStatus = SessionSetUserStatus;
+ handler.clear = ::SessionClear;
+ handler.io_write = ::SessionWrite;
+ handler.io_close = ::SessionClose;
+ handler.on_stateChange = ::SessionStateChange;
+ handler.on_admin = ::SessionAdmin;
+ handler.on_announce = ::SessionAnnounce;
+ handler.on_setPrivacyInfo = ::SessionSetPrivacyInfo;
+ handler.on_setUserStatus = ::SessionSetUserStatus;
{
- mir_cslock lck(proto->session_cs);
- proto->session = mwSession_new(&handler);
+ mir_cslock lck(session_cs);
+ session = mwSession_new(&handler);
- proto->InitMeanwhileServices();
+ InitMeanwhileServices();
- mwSession_start(proto->session);
+ mwSession_start(session);
}
- mir_forkthread(KeepAliveThread, proto);
+ ForkThread(&CSametimeProto::KeepAliveThread);
unsigned char* recv_buffer = (unsigned char*)mir_alloc(1024 * 32);
int bytes;
//while(session && server_connection && mwSession_getState(session) != mwSession_STOPPED) {
- while (proto->server_connection) {// && session) {// && !mwSession_isStopped(session)) { // break on error
- bytes = Netlib_Recv(proto->server_connection, (char *)recv_buffer, 1024 * 32, 0);
- proto->debugLogW(L"SessionThread() Netlib_Recv'ed bytes=[%d]", bytes);
+ while (server_connection) {// && session) {// && !mwSession_isStopped(session)) { // break on error
+ bytes = Netlib_Recv(server_connection, (char *)recv_buffer, 1024 * 32, 0);
+ debugLogW(L"SessionThread() Netlib_Recv'ed bytes=[%d]", bytes);
if (bytes == 0) {
break;
@@ -444,23 +442,23 @@ void __cdecl SessionThread(LPVOID param)
break;
}
else {
- mir_cslock lck(proto->session_cs);
- mwSession_recv(proto->session, recv_buffer, bytes);
+ mir_cslock lck(session_cs);
+ mwSession_recv(session, recv_buffer, bytes);
}
}
mir_free(recv_buffer);
- mir_cslock lck2(proto->session_cs);
- proto->DeinitMeanwhileServices();
- mwSession* old_session = proto->session;
- proto->session = nullptr; // kills keepalive thread, if awake
+ mir_cslock lck2(session_cs);
+ DeinitMeanwhileServices();
+ mwSession* old_session = session;
+ session = nullptr; // kills keepalive thread, if awake
mwSession_free(old_session);
- proto->BroadcastNewStatus(ID_STATUS_OFFLINE);
- proto->SetAllOffline();
- proto->first_online = true;
+ BroadcastNewStatus(ID_STATUS_OFFLINE);
+ SetAllOffline();
+ first_online = true;
- proto->debugLogW(L"SessionThread() end");
+ debugLogW(L"SessionThread() end");
return;
}
@@ -496,7 +494,7 @@ int CSametimeProto::LogIn(int ls, HANDLE hNetlibUser)
login_status = ls;
- mir_forkthread(SessionThread, this);
+ ForkThread(&CSametimeProto::SessionThread);
return 0;
}
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp
index f155fa6cb0..1d01d15e24 100644
--- a/protocols/Sametime/src/userlist.cpp
+++ b/protocols/Sametime/src/userlist.cpp
@@ -529,7 +529,7 @@ void mwAwareList_on_aware(mwAwareList* list, mwAwareSnapshot* aware)
new_status = ID_STATUS_AWAY;
db_set_w(hContact, proto->m_szModuleName, "Status", new_status);
}
- db_set_dw(hContact, proto->m_szModuleName, "IdleTS", (DWORD)time(nullptr));
+ db_set_dw(hContact, proto->m_szModuleName, "IdleTS", (DWORD)time(0));
break;
case mwStatus_BUSY:
new_status = ID_STATUS_DND;
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp
index 6ed47aa00c..ed64a40447 100644
--- a/protocols/SkypeWeb/src/request_queue.cpp
+++ b/protocols/SkypeWeb/src/request_queue.cpp
@@ -41,7 +41,7 @@ void RequestQueue::Start()
isTerminated = false;
if (hRequestQueueThread == nullptr)
- hRequestQueueThread = mir_forkthread((pThreadFunc)&RequestQueue::WorkerThread, this);
+ hRequestQueueThread = mir_forkThread<RequestQueue>(&RequestQueue::WorkerThread, this);
}
void RequestQueue::Stop()
@@ -70,7 +70,7 @@ void RequestQueue::Push(HttpRequest *request, HttpResponseCallback response, voi
void RequestQueue::Send(HttpRequest *request, HttpResponseCallback response, void *arg)
{
RequestQueueItem *item = new RequestQueueItem(request, response, arg);
- mir_forkthreadowner((pThreadFuncOwner)&RequestQueue::AsyncSendThread, this, item, nullptr);
+ mir_forkthreadowner(&RequestQueue::AsyncSendThread, this, item, nullptr);
}
void RequestQueue::Execute(RequestQueueItem *item)
@@ -83,20 +83,17 @@ void RequestQueue::Execute(RequestQueueItem *item)
delete item;
}
-unsigned int RequestQueue::AsyncSendThread(void *owner, void *arg)
+unsigned RequestQueue::AsyncSendThread(void *owner, void *arg)
{
RequestQueue *that = (RequestQueue*)owner;
RequestQueueItem *item = (RequestQueueItem*)arg;
that->Execute(item);
-
return 0;
}
-unsigned int RequestQueue::WorkerThread(void *arg)
+void RequestQueue::WorkerThread(RequestQueue *queue)
{
- RequestQueue *queue = (RequestQueue*)arg;
-
while (true) {
queue->hRequestQueueEvent.Wait();
if (queue->isTerminated)
@@ -119,5 +116,4 @@ unsigned int RequestQueue::WorkerThread(void *arg)
}
queue->hRequestQueueThread = nullptr;
- return 0;
-} \ No newline at end of file
+}
diff --git a/protocols/SkypeWeb/src/request_queue.h b/protocols/SkypeWeb/src/request_queue.h
index f4a60e826d..1f2c5a014a 100644
--- a/protocols/SkypeWeb/src/request_queue.h
+++ b/protocols/SkypeWeb/src/request_queue.h
@@ -51,8 +51,8 @@ class RequestQueue
void Execute(RequestQueueItem *item);
- static unsigned int __cdecl AsyncSendThread(void*, void*);
- static unsigned int __cdecl WorkerThread(void*);
+ static unsigned __cdecl AsyncSendThread(void*, void*);
+ static void __cdecl WorkerThread(RequestQueue *queue);
public:
RequestQueue(HNETLIBUSER nlu);
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 9a810d3d16..2ff7f8140a 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -198,7 +198,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
gce.ptszUID = gch->ptszUID;
gce.ptszText = tnick_new;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = time(nullptr);
+ gce.time = time(0);
Chat_Event(&gce);
if (!reset)
@@ -351,7 +351,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)
gce.ptszNick = tszId;
gce.ptszUID = tszId;
gce.ptszText = tszInitiator;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateT("Admin");
Chat_Event(&gce);
@@ -372,9 +372,9 @@ void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszM
ptrA szMessage(mir_utf8encodeW(buf));
if (strncmp(szMessage, "/me ", 4) == 0)
- SendRequest(new SendChatActionRequest(szChatId, time(nullptr), szMessage, li));
+ SendRequest(new SendChatActionRequest(szChatId, time(0), szMessage, li));
else
- SendRequest(new SendChatMessageRequest(szChatId, time(nullptr), szMessage, li));
+ SendRequest(new SendChatMessageRequest(szChatId, time(0), szMessage, li));
}
void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading)
@@ -512,7 +512,7 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
- gce.time = !isChange ? time(nullptr) : NULL;
+ gce.time = !isChange ? time(0) : NULL;
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateW(role);
@@ -533,13 +533,13 @@ void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, con
gce.ptszUID = tid;
gce.ptszNick = tnick;
gce.ptszStatus = tinitiator;
- gce.time = time(nullptr);
+ gce.time = time(0);
}
else {
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
- gce.time = time(nullptr);
+ gce.time = time(0);
gce.bIsMe = IsMe(id);
}
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
index d345821194..14a718b391 100644
--- a/protocols/SkypeWeb/src/skype_contacts.cpp
+++ b/protocols/SkypeWeb/src/skype_contacts.cpp
@@ -122,7 +122,7 @@ void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response)
DB_AUTH_BLOB blob(hContact, nullptr, nullptr, nullptr, skypename.c_str(), reason.c_str());
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(nullptr);
+ pre.timestamp = time(0);
pre.lParam = blob.size();
pre.szMessage = blob;
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp
index 6df167f3b4..7dfd901ae1 100644
--- a/protocols/SkypeWeb/src/skype_login.cpp
+++ b/protocols/SkypeWeb/src/skype_login.cpp
@@ -35,7 +35,7 @@ void CSkypeProto::Login()
}
m_bHistorySynced = m_bThreadsTerminated = false;
- if ((tokenExpires - 1800) > time(nullptr))
+ if ((tokenExpires - 1800) > time(0))
OnLoginSuccess();
PushRequest(new OAuthRequest(), &CSkypeProto::OnOAuthStart);
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index f1381333f2..9ca334c122 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -52,7 +52,7 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage)
SendMessageParam *param = new SendMessageParam();
param->hContact = hContact;
- param->hMessage = time(nullptr);
+ param->hMessage = time(0);
ptrA username(getStringA(hContact, "Skypename"));
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp
index c89b9954a1..65e4108808 100644
--- a/protocols/SkypeWeb/src/skype_trouter.cpp
+++ b/protocols/SkypeWeb/src/skype_trouter.cpp
@@ -95,9 +95,9 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response)
m_hTrouterEvent.Set();
m_hTrouterHealthEvent.Set();
- if ((time(nullptr) - TRouter.lastRegistrationTime) >= 3600) {
+ if ((time(0) - TRouter.lastRegistrationTime) >= 3600) {
SendRequest(new RegisterTrouterRequest(li, TRouter.url.c_str(), TRouter.sessId.c_str()));
- TRouter.lastRegistrationTime = time(nullptr);
+ TRouter.lastRegistrationTime = time(0);
}
}
@@ -186,7 +186,7 @@ void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &)
if (!uid.empty()) {
MCONTACT hContact = AddContact(uid.c_str(), true);
- MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(nullptr), DBEF_READ, gp.c_str(), callId.c_str());
+ MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(0), DBEF_READ, gp.c_str(), callId.c_str());
Skin_PlaySound("skype_inc_call");
CLISTEVENT cle = {};
diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h
index 1f48146cb7..9eb34490c8 100644
--- a/protocols/Steam/src/stdafx.h
+++ b/protocols/Steam/src/stdafx.h
@@ -59,7 +59,7 @@ extern HANDLE hExtraXStatus;
#define STEAM_DB_GETEVENTTEXT_CHATSTATES "/GetEventText2000"
#define STEAM_DB_EVENT_CHATSTATES_GONE 1
-#define now() time(nullptr)
+#define now() time(0)
#include "steam_dialogs.h"
#include "steam_options.h"
diff --git a/protocols/Tox/libtox/src/toxcore/Messenger.c b/protocols/Tox/libtox/src/toxcore/Messenger.c
index 2408c84484..0ea7894ec8 100644
--- a/protocols/Tox/libtox/src/toxcore/Messenger.c
+++ b/protocols/Tox/libtox/src/toxcore/Messenger.c
@@ -2520,7 +2520,7 @@ static void do_friends(Messenger *m, void *userdata)
do_receipts(m, i, userdata);
do_reqchunk_filecb(m, i, userdata);
- m->friendlist[i].last_seen_time = (uint64_t) time(nullptr);
+ m->friendlist[i].last_seen_time = (uint64_t) time(0);
}
}
}
diff --git a/protocols/Tox/libtox/src/toxcore/util.c b/protocols/Tox/libtox/src/toxcore/util.c
index b7a8fda653..853899909f 100644
--- a/protocols/Tox/libtox/src/toxcore/util.c
+++ b/protocols/Tox/libtox/src/toxcore/util.c
@@ -48,7 +48,7 @@ static uint64_t unix_base_time_value;
void unix_time_update(void)
{
if (unix_base_time_value == 0) {
- unix_base_time_value = ((uint64_t)time(nullptr) - (current_time_monotonic() / 1000ULL));
+ unix_base_time_value = ((uint64_t)time(0) - (current_time_monotonic() / 1000ULL));
}
unix_time_value = (current_time_monotonic() / 1000ULL) + unix_base_time_value;
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h
index 124fc96b0b..1e444e9b9d 100644
--- a/protocols/Tox/src/stdafx.h
+++ b/protocols/Tox/src/stdafx.h
@@ -42,7 +42,7 @@
struct CToxProto;
-#define now() time(nullptr)
+#define now() time(0)
#define MODULE "Tox"
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp
index a28c44f351..6ff50e7b28 100644
--- a/protocols/Twitter/src/chat.cpp
+++ b/protocols/Twitter/src/chat.cpp
@@ -92,7 +92,7 @@ void TwitterProto::AddChatContact(const char *name, const char *nick)
ptrW wszNick(mir_a2u(nick ? nick : name));
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
gce.ptszNick = wszNick;
gce.ptszUID = wszId;
gce.ptszStatus = L"Normal";
@@ -104,7 +104,7 @@ void TwitterProto::DeleteChatContact(const char *name)
ptrW wszId(mir_a2u(name));
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
- gce.time = DWORD(time(nullptr));
+ gce.time = DWORD(time(0));
gce.ptszNick = wszId;
gce.ptszUID = gce.ptszNick;
Chat_Event(&gce);
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, OBJLIST<CVkUser
LONG iUserId = !jnItem["invited_by"] ? 0 : jnItem["invited_by"].as_int();
CVKNewsItem *vkNotification = new CVKNewsItem();
- vkNotification->tDate = 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");