diff options
Diffstat (limited to 'protocols')
322 files changed, 3928 insertions, 3927 deletions
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index fa966348e1..0c8143aa4a 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -74,7 +74,7 @@ void CAimProto::avatar_request_handler(MCONTACT hContact, char* hash, unsigned c setByte(hContact, AIM_KEY_AHT, type);
setString(hContact, AIM_KEY_AH, hash);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
}
else {
@@ -82,7 +82,7 @@ void CAimProto::avatar_request_handler(MCONTACT hContact, char* hash, unsigned c delSetting(hContact, AIM_KEY_AHT);
delSetting(hContact, AIM_KEY_AH);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
}
mir_free(saved_hash);
@@ -131,7 +131,7 @@ int CAimProto::get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t c db_free(&dbv);
bool found = false;
- if (ext == NULL) {
+ if (ext == nullptr) {
mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L".*");
_tfinddata_t c_file;
@@ -193,9 +193,9 @@ bool get_avatar_hash(const wchar_t* file, char* hash, char** data, unsigned shor void rescale_image(char *data, unsigned short size, char *&data1, unsigned short &size1)
{
- FI_INTERFACE *fei = NULL;
+ FI_INTERFACE *fei = nullptr;
CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei);
- if (fei == NULL) return;
+ if (fei == nullptr) return;
FIMEMORY *hmem = fei->FI_OpenMemory((BYTE *)data, size);
FREE_IMAGE_FORMAT fif = fei->FI_GetFileTypeFromMemory(hmem, 0);
@@ -205,7 +205,7 @@ void rescale_image(char *data, unsigned short size, char *&data1, unsigned short if (fei->FI_GetWidth(dib) > 64) {
FIBITMAP *dib1 = fei->FI_Rescale(dib, 64, 64, FILTER_BSPLINE);
- FIMEMORY *hmem2 = fei->FI_OpenMemory(NULL, 0);
+ FIMEMORY *hmem2 = fei->FI_OpenMemory(nullptr, 0);
fei->FI_SaveToMemory(fif, dib1, hmem2, 0);
BYTE *data2; DWORD size2;
diff --git a/protocols/AimOscar/src/away.cpp b/protocols/AimOscar/src/away.cpp index 12c15f7a2e..96d4847d9b 100644 --- a/protocols/AimOscar/src/away.cpp +++ b/protocols/AimOscar/src/away.cpp @@ -38,17 +38,17 @@ char** CAimProto::get_status_msg_loc(int status) if (modes[i] == status)
return &m_modeMsgs[i];
- return NULL;
+ return nullptr;
}
int CAimProto::aim_set_away(HNETLIBCONN hServerConn, unsigned short &seqno, const char *amsg, bool set)//user info
{
unsigned short offset = 0;
- char *html_msg = NULL;
+ char *html_msg = nullptr;
size_t msg_size = 0;
if (set) {
if (!amsg) return -1;
- setDword(AIM_KEY_LA, (DWORD)time(NULL));
+ setDword(AIM_KEY_LA, (DWORD)time(nullptr));
html_msg = html_encode(amsg && amsg[0] ? amsg : DEFAULT_AWAY_MSG);
msg_size = mir_strlen(html_msg);
}
@@ -96,7 +96,7 @@ int CAimProto::aim_set_statusmsg(HNETLIBCONN hServerConn, unsigned short &seqno, aim_writebartid(2, 4, (unsigned short)(msg_size + 4), msgb, msgoffset, msgbuf);
}
- else aim_writebartid(2, 0, 0, NULL, msgoffset, msgbuf);
+ else aim_writebartid(2, 0, 0, nullptr, msgoffset, msgbuf);
unsigned short offset = 0;
char* buf = (char*)alloca(SNAC_SIZE + TLV_HEADER_SIZE + msgoffset + 8);
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp index 79cb6d6af1..b084f6ca02 100644 --- a/protocols/AimOscar/src/chat.cpp +++ b/protocols/AimOscar/src/chat.cpp @@ -62,7 +62,7 @@ void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_ gce.bIsMe = _stricmp(sn, m_username) == 0;
gce.ptszStatus = gce.bIsMe ? TranslateT("Me") : TranslateT("Others");
gce.ptszText = msg;
- gce.time = time(NULL);
+ gce.time = time(nullptr);
Chat_Event(&gce);
}
@@ -83,12 +83,12 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) char *id = mir_u2a(gch->ptszID);
chat_list_item* item = find_chat_by_id(id);
- if (item == NULL)
+ if (item == nullptr)
return 0;
switch (gch->iType) {
case GC_SESSION_TERMINATE:
- aim_sendflap(item->hconn, 0x04, 0, NULL, item->seqno);
+ aim_sendflap(item->hconn, 0x04, 0, nullptr, item->seqno);
Netlib_Shutdown(item->hconn);
break;
@@ -98,7 +98,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) break;
case GC_USER_CHANMGR:
- DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, invite_to_chat_dialog,
+ DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, invite_to_chat_dialog,
LPARAM(new invite_chat_param(item->id, this)));
break;
@@ -114,7 +114,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) case GC_USER_LOGMENU:
switch (gch->dwData) {
case 10:
- DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, invite_to_chat_dialog,
+ DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, invite_to_chat_dialog,
LPARAM(new invite_chat_param(item->id, this)));
break;
@@ -211,7 +211,7 @@ chat_list_item* CAimProto::find_chat_by_cid(unsigned short cid) if (m_chat_rooms[i].cid == cid)
return &m_chat_rooms[i];
- return NULL;
+ return nullptr;
}
chat_list_item* CAimProto::find_chat_by_id(char* id)
@@ -220,7 +220,7 @@ chat_list_item* CAimProto::find_chat_by_id(char* id) if (mir_strcmp(m_chat_rooms[i].id, id) == 0)
return &m_chat_rooms[i];
- return NULL;
+ return nullptr;
}
chat_list_item* CAimProto::find_chat_by_conn(HANDLE conn)
@@ -229,7 +229,7 @@ chat_list_item* CAimProto::find_chat_by_conn(HANDLE conn) if (m_chat_rooms[i].hconn == conn)
return &m_chat_rooms[i];
- return NULL;
+ return nullptr;
}
void CAimProto::remove_chat_by_ptr(chat_list_item *item)
@@ -247,7 +247,7 @@ void CAimProto::shutdown_chat_conn(void) for (int i = 0; i < m_chat_rooms.getCount(); ++i) {
chat_list_item &item = m_chat_rooms[i];
if (item.hconn) {
- aim_sendflap(item.hconn, 0x04, 0, NULL, item.seqno);
+ aim_sendflap(item.hconn, 0x04, 0, nullptr, item.seqno);
Netlib_Shutdown(item.hconn);
}
}
@@ -259,7 +259,7 @@ void CAimProto::close_chat_conn(void) chat_list_item &item = m_chat_rooms[i];
if (item.hconn) {
Netlib_CloseHandle(item.hconn);
- item.hconn = NULL;
+ item.hconn = nullptr;
}
}
}
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp index 2804ed52f7..8299cc5a32 100755 --- a/protocols/AimOscar/src/client.cpp +++ b/protocols/AimOscar/src/client.cpp @@ -30,8 +30,8 @@ int CAimProto::aim_authkey_request(HNETLIBCONN hServerConn, unsigned short &seqn char *buf = (char*)alloca(SNAC_SIZE + TLV_HEADER_SIZE * 3 + mir_strlen(m_username));
aim_writesnac(0x17, 0x06, offset, buf);
aim_writetlv(0x01, (unsigned short)mir_strlen(m_username), m_username, offset, buf);
- aim_writetlv(0x4B, 0, 0, offset, buf);
- aim_writetlv(0x5A, 0, 0, offset, buf);
+ aim_writetlv(0x4B, 0, nullptr, offset, buf);
+ aim_writetlv(0x5A, 0, nullptr, offset, buf);
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
@@ -61,7 +61,7 @@ int CAimProto::aim_auth_request(HNETLIBCONN hServerConn, unsigned short &seqno, aim_writesnac(0x17, 0x02, offset, buf);
aim_writetlv(0x01, (unsigned short)mir_strlen(username), username, offset, buf);
aim_writetlv(0x25, MD5_HASH_LENGTH, (char*)auth_hash, offset, buf);
- aim_writetlv(0x4C, 0, 0, offset, buf);//signifies new password hash instead of old method
+ aim_writetlv(0x4C, 0, nullptr, offset, buf);//signifies new password hash instead of old method
aim_writetlv(0x03, (unsigned short)client_id_len, client_id, offset, buf);
aim_writetlvshort(0x16, AIM_CLIENT_ID_NUMBER, offset, buf); //in pidgin it's first
@@ -371,10 +371,10 @@ int CAimProto::aim_send_message(HNETLIBCONN hServerConn, unsigned short &seqno, if (!blast) {
if (auto_response)
- aim_writetlv(0x04, 0, 0, offset, buf); // auto-response message
+ aim_writetlv(0x04, 0, nullptr, offset, buf); // auto-response message
else {
- aim_writetlv(0x03, 0, 0, offset, buf); // message ack request
- aim_writetlv(0x06, 0, 0, offset, buf); // offline message storage
+ aim_writetlv(0x03, 0, nullptr, offset, buf); // message ack request
+ aim_writetlv(0x06, 0, nullptr, offset, buf); // offline message storage
}
}
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno) ? 0 : *(int*)icbm_cookie & 0x7fffffff;
@@ -405,7 +405,7 @@ int CAimProto::aim_delete_contact(HNETLIBCONN hServerConn, unsigned short &seqno aim_writeshort(item_id, offset, buf); // buddy id
aim_writeshort(list, offset, buf); // buddy type
aim_writeshort(nil ? 4 : 0, offset, buf); // length of extra data
- if (nil) aim_writetlv(0x6a, 0, NULL, offset, buf);
+ if (nil) aim_writetlv(0x6a, 0, nullptr, offset, buf);
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
@@ -559,7 +559,7 @@ int CAimProto::aim_send_file(HNETLIBCONN hServerConn, unsigned short &seqno, aim_writetlvshort(0x17, ~port, frag_offset, msg_frag); // port ip check
if (force_proxy)
- aim_writetlv(0x10, 0, 0, frag_offset, msg_frag); // request proxy transfer
+ aim_writetlv(0x10, 0, nullptr, frag_offset, msg_frag); // request proxy transfer
else
aim_writetlvlong(0x03, m_internal_ip, frag_offset, msg_frag); // ip
@@ -578,7 +578,7 @@ int CAimProto::aim_send_file(HNETLIBCONN hServerConn, unsigned short &seqno, aim_writetlv(0x0c, desc_len, desc_msg, frag_offset, msg_frag); // invitaion text
}
- aim_writetlv(0x0f, 0, 0, frag_offset, msg_frag); // request host check
+ aim_writetlv(0x0f, 0, nullptr, frag_offset, msg_frag); // request host check
const char* fname = get_fname(ft->file);
const unsigned short fnlen = (unsigned short)mir_strlen(fname);
@@ -609,7 +609,7 @@ int CAimProto::aim_send_file(HNETLIBCONN hServerConn, unsigned short &seqno, aim_writechar((unsigned char)sn_length, offset, buf); // screen name length
aim_writegeneric(sn_length, ft->sn, offset, buf); // screen name
aim_writetlv(0x05, frag_offset, msg_frag, offset, buf); // icbm tags
- aim_writetlv(0x03, 0, 0, offset, buf); // request ack
+ aim_writetlv(0x03, 0, nullptr, offset, buf); // request ack
char cip[20];
long_ip_to_char_ip(ip, cip);
@@ -865,8 +865,8 @@ int CAimProto::aim_chat_send_message(HNETLIBCONN hServerConn, unsigned short &se aim_writesnac(0x0e, 0x05, offset, buf);
aim_writegeneric(8, "\0\0\0\0\0\0\0\0", offset, buf); // Message Cookie (can be random)
aim_writeshort(0x03, offset, buf); // Message Channel (Always 3 for chat)
- aim_writetlv(0x01, 0, NULL, offset, buf); // Public/Whisper flag
- aim_writetlv(0x06, 0, NULL, offset, buf); // Enable Reflection flag
+ aim_writetlv(0x01, 0, nullptr, offset, buf); // Public/Whisper flag
+ aim_writetlv(0x06, 0, nullptr, offset, buf); // Enable Reflection flag
aim_writetlv(0x05, tlv_offset, tlv_buf, offset, buf); // Message Information TLV
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
@@ -893,7 +893,7 @@ int CAimProto::aim_chat_invite(HNETLIBCONN hServerConn, unsigned short &seqno, c aim_writegeneric(16, AIM_CAP_CHAT, offset, buf); // Capability
aim_writetlvshort(0x0a, 1, offset, buf); // Sequence Number TLV
- aim_writetlv(0x0f, 0, NULL, offset, buf); // Request Host Caps Check TLV
+ aim_writetlv(0x0f, 0, nullptr, offset, buf); // Request Host Caps Check TLV
aim_writetlv(0x0c, msg_len, msg, offset, buf); // Invitation Message TLV
aim_writeshort(0x2711, offset, buf); // Capability TLV
@@ -972,7 +972,7 @@ int CAimProto::aim_admin_request_info(HNETLIBCONN hServerConn, unsigned short &s unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE];
aim_writesnac(0x07, 0x02, offset, buf);
- aim_writetlv(type, 0, NULL, offset, buf);
+ aim_writetlv(type, 0, nullptr, offset, buf);
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index 0d4f47f31b..42b69e9f3d 100755 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -32,7 +32,7 @@ HNETLIBCONN CAimProto::aim_connect(const char* server, unsigned short port, bool if (con && use_ssl) {
if (!Netlib_StartSsl(con, host)) {
Netlib_CloseHandle(con);
- con = NULL;
+ con = nullptr;
}
}
return con;
@@ -61,10 +61,10 @@ void CAimProto::aim_connection_authorization(void) {
if (m_iDesiredStatus != ID_STATUS_OFFLINE) {
char *password = getStringA(AIM_KEY_PW);
- if (password != NULL) {
+ if (password != nullptr) {
mir_free(m_username);
m_username = getStringA(AIM_KEY_SN);
- if (m_username != NULL) {
+ if (m_username != nullptr) {
HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(m_hServerConn, 2048 * 4);
NETLIBPACKETRECVER packetRecv = {};
@@ -107,11 +107,11 @@ void CAimProto::aim_connection_authorization(void) return;
case 2:
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPASSWORD);
goto exit;
case 3:
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NOSERVER);
goto exit;
}
}
@@ -133,7 +133,7 @@ void CAimProto::aim_connection_authorization(void) if (m_iStatus != ID_STATUS_OFFLINE)
broadcast_status(ID_STATUS_OFFLINE);
Netlib_CloseHandle(m_hServerConn);
- m_hServerConn = NULL;
+ m_hServerConn = nullptr;
debugLogA("Connection Authorization Thread Ending: End of Thread");
}
@@ -180,7 +180,7 @@ bool parse_clientlogin_response(NETLIBHTTPREQUEST *nlhr, NETLIBHTTPHEADER *my_he secret = _T2A(secret_w);
token = _T2A(token_w);
- hosttime = strtol(_T2A(hosttime_w), NULL, 10);
+ hosttime = strtol(_T2A(hosttime_w), nullptr, 10);
return true;
}
@@ -298,7 +298,7 @@ void CAimProto::aim_connection_clientlogin(void) // reuse NETLIBHTTPREQUEST
req.requestType = REQUEST_GET;
- req.pData = NULL;
+ req.pData = nullptr;
req.flags |= NLHRF_MANUALHOST;
req.dataLength = 0;
req.headersCount = 1;
@@ -339,7 +339,7 @@ void CAimProto::aim_connection_clientlogin(void) - ForkThread(&CAimProto::aim_protocol_negotiation, 0);
+ ForkThread(&CAimProto::aim_protocol_negotiation, nullptr);
}
void __cdecl CAimProto::aim_protocol_negotiation(void*)
@@ -378,7 +378,7 @@ void __cdecl CAimProto::aim_protocol_negotiation(void*) {
aim_send_cookie(m_hServerConn, m_seqno, COOKIE_LENGTH, COOKIE);//cookie challenge
mir_free(COOKIE);
- COOKIE = NULL;
+ COOKIE = nullptr;
COOKIE_LENGTH = 0;
}
else
@@ -404,7 +404,7 @@ void __cdecl CAimProto::aim_protocol_negotiation(void*) aim_sendflap(m_hServerConn, 0x01, offset, buf_, m_seqno);
mir_free(COOKIE);
- COOKIE = NULL;
+ COOKIE = nullptr;
COOKIE_LENGTH = 0;
}
@@ -453,7 +453,7 @@ void __cdecl CAimProto::aim_protocol_negotiation(void*) }
}
else if (flap.cmp(0x04)) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_OTHERLOCATION);
debugLogA("Connection Negotiation Thread Ending: Flap 0x04");
goto exit;
}
@@ -463,8 +463,8 @@ void __cdecl CAimProto::aim_protocol_negotiation(void*) exit:
if (m_iStatus != ID_STATUS_OFFLINE) broadcast_status(ID_STATUS_OFFLINE);
- Netlib_CloseHandle(hServerPacketRecver); hServerPacketRecver = NULL;
- Netlib_CloseHandle(m_hServerConn); m_hServerConn = NULL;
+ Netlib_CloseHandle(hServerPacketRecver); hServerPacketRecver = nullptr;
+ Netlib_CloseHandle(m_hServerConn); m_hServerConn = nullptr;
debugLogA("Connection Negotiation Thread Ending: End of Thread");
offline_contacts();
}
@@ -503,7 +503,7 @@ void __cdecl CAimProto::aim_mail_negotiation(void*) if (flap.cmp(0x01)) {
aim_send_cookie(m_hMailConn, m_mail_seqno, MAIL_COOKIE_LENGTH, MAIL_COOKIE);//cookie challenge
mir_free(MAIL_COOKIE);
- MAIL_COOKIE = NULL;
+ MAIL_COOKIE = nullptr;
MAIL_COOKIE_LENGTH = 0;
}
else if (flap.cmp(0x02)) {
@@ -528,7 +528,7 @@ exit: debugLogA("Mail Server Connection has ended");
Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(m_hMailConn);
- m_hMailConn = NULL;
+ m_hMailConn = nullptr;
}
void __cdecl CAimProto::aim_avatar_negotiation(void*)
@@ -560,7 +560,7 @@ void __cdecl CAimProto::aim_avatar_negotiation(void*) if (flap.cmp(0x01)) {
aim_send_cookie(m_hAvatarConn, m_avatar_seqno, AVATAR_COOKIE_LENGTH, AVATAR_COOKIE); // cookie challenge
mir_free(AVATAR_COOKIE);
- AVATAR_COOKIE = NULL;
+ AVATAR_COOKIE = nullptr;
AVATAR_COOKIE_LENGTH = 0;
}
else if (flap.cmp(0x02)) {
@@ -585,7 +585,7 @@ void __cdecl CAimProto::aim_avatar_negotiation(void*) exit:
Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(m_hAvatarConn);
- m_hAvatarConn = NULL;
+ m_hAvatarConn = nullptr;
ResetEvent(m_hAvatarEvent);
debugLogA("Avatar Server Connection has ended");
}
@@ -629,7 +629,7 @@ void __cdecl CAimProto::aim_chatnav_negotiation(void*) if (flap.cmp(0x01)) {
aim_send_cookie(m_hChatNavConn, m_chatnav_seqno, CHATNAV_COOKIE_LENGTH, CHATNAV_COOKIE);//cookie challenge
mir_free(CHATNAV_COOKIE);
- CHATNAV_COOKIE = NULL;
+ CHATNAV_COOKIE = nullptr;
CHATNAV_COOKIE_LENGTH = 0;
}
else if (flap.cmp(0x02)) {
@@ -654,7 +654,7 @@ void __cdecl CAimProto::aim_chatnav_negotiation(void*) exit:
Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(m_hChatNavConn);
- m_hChatNavConn = NULL;
+ m_hChatNavConn = nullptr;
ResetEvent(m_hChatNavEvent);
debugLogA("Chat Navigation Server Connection has ended");
}
@@ -693,7 +693,7 @@ void __cdecl CAimProto::aim_chat_negotiation(void* param) if (flap.cmp(0x01)) {
aim_send_cookie(item->hconn, item->seqno, item->CHAT_COOKIE_LENGTH, item->CHAT_COOKIE);//cookie challenge
mir_free(item->CHAT_COOKIE);
- item->CHAT_COOKIE = NULL;
+ item->CHAT_COOKIE = nullptr;
item->CHAT_COOKIE_LENGTH = 0;
}
else if (flap.cmp(0x02)) {
@@ -752,7 +752,7 @@ void __cdecl CAimProto::aim_admin_negotiation(void*) if (flap.cmp(0x01)) {
aim_send_cookie(m_hAdminConn, m_admin_seqno, ADMIN_COOKIE_LENGTH, ADMIN_COOKIE);//cookie challenge
mir_free(ADMIN_COOKIE);
- ADMIN_COOKIE = NULL;
+ ADMIN_COOKIE = nullptr;
ADMIN_COOKIE_LENGTH = 0;
}
else if (flap.cmp(0x02)) {
@@ -778,7 +778,7 @@ void __cdecl CAimProto::aim_admin_negotiation(void*) exit:
Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(m_hAdminConn);
- m_hAdminConn = NULL;
+ m_hAdminConn = nullptr;
ResetEvent(m_hAdminEvent);
debugLogA("Admin Server Connection has ended");
}
diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp index ca36a38663..cca0c668ac 100644 --- a/protocols/AimOscar/src/conv.cpp +++ b/protocols/AimOscar/src/conv.cpp @@ -51,7 +51,7 @@ char* process_status_msg(const char *str, const char* sn) res = (char*)mir_realloc(res, size + 20);
dest = res + off;
size += 20;
- dest += GetDateFormatA(LOCALE_USER_DEFAULT, 0, NULL, NULL, dest, 20) - 1;
+ dest += GetDateFormatA(LOCALE_USER_DEFAULT, 0, nullptr, nullptr, dest, 20) - 1;
++src;
}
else if (src[0] == '%' && src[1] == 't') {
@@ -59,7 +59,7 @@ char* process_status_msg(const char *str, const char* sn) res = (char*)mir_realloc(res, size + 20);
dest = res + off;
size += 20;
- dest += GetTimeFormatA(LOCALE_USER_DEFAULT, 0, NULL, NULL, dest, 20) - 1;
+ dest += GetTimeFormatA(LOCALE_USER_DEFAULT, 0, nullptr, nullptr, dest, 20) - 1;
++src;
}
else *(dest++) = *src;
@@ -73,7 +73,7 @@ void html_decode(char* str) {
char *p, *q;
- if (str == NULL) return;
+ if (str == nullptr) return;
for (p = q = str; *p != '\0'; p++, q++) {
if (*p == '&') {
@@ -124,7 +124,7 @@ char* html_encode(const char* str) const char *p;
int c;
- if (str == NULL) return NULL;
+ if (str == nullptr) return nullptr;
for (c = 0, p = str; *p != '\0'; p++) {
switch (*p) {
@@ -162,11 +162,11 @@ char* html_to_bbcodes(char *src) char *ptrl;
char *rptr;
char* dest = mir_strdup(src);
- while ((ptr = strstr(dest, "<B>")) != NULL || (ptr = strstr(dest, "<b>")) != NULL) {
+ while ((ptr = strstr(dest, "<B>")) != nullptr || (ptr = strstr(dest, "<b>")) != nullptr) {
*ptr = '[';
*(ptr + 1) = 'b';
*(ptr + 2) = ']';
- if ((ptr = strstr(dest, "</B>")) != NULL || (ptr = strstr(dest, "</b>")) != NULL) {
+ if ((ptr = strstr(dest, "</B>")) != nullptr || (ptr = strstr(dest, "</b>")) != nullptr) {
*ptr = '[';
*(ptr + 2) = 'b';
*(ptr + 3) = ']';
@@ -176,11 +176,11 @@ char* html_to_bbcodes(char *src) memcpy(&dest[mir_strlen(dest)], "[/b]", 5);
}
}
- while ((ptr = strstr(dest, "<I>")) != NULL || (ptr = strstr(dest, "<i>")) != NULL) {
+ while ((ptr = strstr(dest, "<I>")) != nullptr || (ptr = strstr(dest, "<i>")) != nullptr) {
*ptr = '[';
*(ptr + 1) = 'i';
*(ptr + 2) = ']';
- if ((ptr = strstr(dest, "</I>")) != NULL || (ptr = strstr(dest, "</i>")) != NULL) {
+ if ((ptr = strstr(dest, "</I>")) != nullptr || (ptr = strstr(dest, "</i>")) != nullptr) {
*ptr = '[';
*(ptr + 2) = 'i';
*(ptr + 3) = ']';
@@ -190,11 +190,11 @@ char* html_to_bbcodes(char *src) memcpy(&dest[mir_strlen(dest)], "[/i]", 5);
}
}
- while ((ptr = strstr(dest, "<U>")) != NULL || (ptr = strstr(dest, "<u>")) != NULL) {
+ while ((ptr = strstr(dest, "<U>")) != nullptr || (ptr = strstr(dest, "<u>")) != nullptr) {
*ptr = '[';
*(ptr + 1) = 'u';
*(ptr + 2) = ']';
- if ((ptr = strstr(dest, "</U>")) != NULL || (ptr = strstr(dest, "</u>")) != NULL) {
+ if ((ptr = strstr(dest, "</U>")) != nullptr || (ptr = strstr(dest, "</u>")) != nullptr) {
*ptr = '[';
*(ptr + 2) = 'u';
*(ptr + 3) = ']';
@@ -204,11 +204,11 @@ char* html_to_bbcodes(char *src) memcpy(&dest[mir_strlen(dest)], "[/u]", 5);
}
}
- while ((ptr = strstr(dest, "<S>")) != NULL || (ptr = strstr(dest, "<s>")) != NULL) {
+ while ((ptr = strstr(dest, "<S>")) != nullptr || (ptr = strstr(dest, "<s>")) != nullptr) {
*ptr = '[';
*(ptr + 1) = 's';
*(ptr + 2) = ']';
- if ((ptr = strstr(dest, "</S>")) != NULL || (ptr = strstr(dest, "</s>")) != NULL) {
+ if ((ptr = strstr(dest, "</S>")) != nullptr || (ptr = strstr(dest, "</s>")) != nullptr) {
*ptr = '[';
*(ptr + 2) = 's';
*(ptr + 3) = ']';
@@ -390,42 +390,42 @@ char* bbcodes_to_html(const char *src) char *ptr;
char *rptr;
char* dest = mir_strdup(src);
- while ((ptr = strstr(dest, "[b]")) != NULL) {
+ while ((ptr = strstr(dest, "[b]")) != nullptr) {
*ptr = '<';
*(ptr + 1) = 'b';
*(ptr + 2) = '>';
}
- while ((ptr = strstr(dest, "[/b]")) != NULL) {
+ while ((ptr = strstr(dest, "[/b]")) != nullptr) {
*ptr = '<';
*(ptr + 2) = 'b';
*(ptr + 3) = '>';
}
- while ((ptr = strstr(dest, "[i]")) != NULL) {
+ while ((ptr = strstr(dest, "[i]")) != nullptr) {
*ptr = '<';
*(ptr + 1) = 'i';
*(ptr + 2) = '>';
}
- while ((ptr = strstr(dest, "[/i]")) != NULL) {
+ while ((ptr = strstr(dest, "[/i]")) != nullptr) {
*ptr = '<';
*(ptr + 2) = 'i';
*(ptr + 3) = '>';
}
- while ((ptr = strstr(dest, "[u]")) != NULL) {
+ while ((ptr = strstr(dest, "[u]")) != nullptr) {
*ptr = '<';
*(ptr + 1) = 'u';
*(ptr + 2) = '>';
}
- while ((ptr = strstr(dest, "[/u]")) != NULL) {
+ while ((ptr = strstr(dest, "[/u]")) != nullptr) {
*ptr = '<';
*(ptr + 2) = 'u';
*(ptr + 3) = '>';
}
- while ((ptr = strstr(dest, "[s]")) != NULL) {
+ while ((ptr = strstr(dest, "[s]")) != nullptr) {
*ptr = '<';
*(ptr + 1) = 's';
*(ptr + 2) = '>';
}
- while ((ptr = strstr(dest, "[/s]")) != NULL) {
+ while ((ptr = strstr(dest, "[/s]")) != nullptr) {
*ptr = '<';
*(ptr + 2) = 's';
*(ptr + 3) = '>';
@@ -668,14 +668,14 @@ char* rtf_to_html(HWND hwndDlg, int DlgItem) void wcs_htons(wchar_t *ch)
{
- if (ch == NULL) return;
+ if (ch == nullptr) return;
for (size_t i = 0; i < mir_wstrlen(ch); i++)
ch[i] = _htons(ch[i]);
}
char* bytes_to_string(char *bytes, int num_bytes)
{
- if (num_bytes == 0) return NULL;
+ if (num_bytes == 0) return nullptr;
char *string = (char*)mir_alloc(num_bytes * 2 + 1);
for (int i = 0; i < num_bytes; i++) {
@@ -699,7 +699,7 @@ void string_to_bytes(char *string, char *bytes) for (size_t i = 0; i < length; i += 2) {
sbyte[0] = string[i];
sbyte[1] = string[i + 1];
- bytes[i / 2] = (char)strtol(sbyte, NULL, 16);
+ bytes[i / 2] = (char)strtol(sbyte, nullptr, 16);
}
}
@@ -736,8 +736,8 @@ wchar_t* get_dir(wchar_t *path) aimString::aimString(char *str)
{
- if (str == NULL) {
- szString = NULL;
+ if (str == nullptr) {
+ szString = nullptr;
size = 0;
unicode = false;
}
diff --git a/protocols/AimOscar/src/direct_connect.cpp b/protocols/AimOscar/src/direct_connect.cpp index b9cfab0508..e79a0f1d9a 100644 --- a/protocols/AimOscar/src/direct_connect.cpp +++ b/protocols/AimOscar/src/direct_connect.cpp @@ -38,7 +38,7 @@ void __cdecl CAimProto::aim_dc_helper(void* param) //only called when we are ini Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(ft->hConn);
- ft->hConn = NULL;
+ ft->hConn = nullptr;
if (result == 0)
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index 0a67bea54b..2f8e93f907 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -96,7 +96,7 @@ bool send_init_oft2(file_transfer *ft, char* file) void CAimProto::report_file_error(wchar_t *fname)
{
wchar_t errmsg[512];
- wchar_t* error = mir_a2u(_strerror(NULL));
+ wchar_t* error = mir_a2u(_strerror(nullptr));
mir_snwprintf(errmsg, TranslateT("Failed to open file: %s : %s"), fname, error);
mir_free(error);
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
@@ -108,7 +108,7 @@ bool setup_next_file_send(file_transfer *ft) struct _stati64 statbuf;
for (;;) {
file = ft->pfts.ptszFiles[ft->cf];
- if (file == NULL) return false;
+ if (file == nullptr) return false;
if (_wstat64(file, &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
break;
@@ -264,7 +264,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET bool accepted_file = false;
int fid = -1;
- oft2 *oft = NULL;
+ oft2 *oft = nullptr;
ft->pfts.tszWorkingDir = mir_utf8decodeW(ft->file);
@@ -453,7 +453,7 @@ file_transfer* ft_list_type::find_by_cookie(char* cookie, MCONTACT hContact) if (ft->hContact == hContact && memcmp(ft->icbm_cookie, cookie, 8) == 0)
return ft;
}
- return NULL;
+ return nullptr;
}
file_transfer* ft_list_type::find_by_port(unsigned short port)
@@ -463,7 +463,7 @@ file_transfer* ft_list_type::find_by_port(unsigned short port) if (ft->requester && ft->local_port == port)
return ft;
}
- return NULL;
+ return nullptr;
}
@@ -502,7 +502,7 @@ file_transfer::file_transfer(MCONTACT hCont, char* nick, char* cookie) else
Utils_GetRandom(icbm_cookie, 8);
- hResumeEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hResumeEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
}
file_transfer::~file_transfer()
@@ -540,7 +540,7 @@ void file_transfer::stop_listen(void) {
if (hDirectBoundPort) {
Netlib_CloseHandle(hDirectBoundPort);
- hDirectBoundPort = NULL;
+ hDirectBoundPort = nullptr;
local_port = 0;
}
}
diff --git a/protocols/AimOscar/src/links.cpp b/protocols/AimOscar/src/links.cpp index 13671e8518..b9235bde99 100644 --- a/protocols/AimOscar/src/links.cpp +++ b/protocols/AimOscar/src/links.cpp @@ -59,7 +59,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) /* skip leading prefix */
arg = wcschr(arg, ':');
- if (arg == NULL) return 1; /* parse failed */
+ if (arg == nullptr) return 1; /* parse failed */
for (++arg; *arg == '/'; ++arg);
@@ -74,7 +74,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) break;
}
}
- if (proto == NULL) return 1;
+ if (proto == nullptr) return 1;
/*
add user: aim:addbuddy?screenname=NICK&groupname=GROUP
@@ -84,9 +84,9 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) /* add a contact to the list */
if (!wcsnicmp(arg, L"addbuddy?", 9)) {
wchar_t *tok, *tok2;
- char *sn = NULL, *group = NULL;
+ char *sn = nullptr, *group = nullptr;
- for (tok = arg + 8; tok != NULL; tok = tok2) {
+ for (tok = arg + 8; tok != nullptr; tok = tok2) {
tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
@@ -94,7 +94,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) if (!wcsnicmp(tok, L"groupname=", 10) && *(tok + 10) != 0)
group = mir_utf8encodeW(url_decode(tok + 10)); /* group is currently ignored */
}
- if (sn == NULL) {
+ if (sn == nullptr) {
mir_free(group);
return 1;
}
@@ -110,10 +110,10 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) }
/* send a message to a contact */
else if (!wcsnicmp(arg, L"goim?", 5)) {
- wchar_t *tok, *tok2, *msg = NULL;
- char *sn = NULL;
+ wchar_t *tok, *tok2, *msg = nullptr;
+ char *sn = nullptr;
- for (tok = arg + 4; tok != NULL; tok = tok2) {
+ for (tok = arg + 4; tok != nullptr; tok = tok2) {
tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
@@ -121,7 +121,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) if (!wcsnicmp(tok, L"message=", 8) && *(tok + 8) != 0)
msg = url_decode(tok + 8);
}
- if (sn == NULL) return 1; /* parse failed */
+ if (sn == nullptr) return 1; /* parse failed */
MCONTACT hContact = proto->contact_from_sn(sn, true, true);
if (hContact)
@@ -134,10 +134,10 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) /* open a chatroom */
else if (!wcsnicmp(arg, L"gochat?", 7)) {
wchar_t *tok, *tok2;
- char *rm = NULL;
+ char *rm = nullptr;
int exchange = 0;
- for (tok = arg + 6; tok != NULL; tok = tok2) {
+ for (tok = arg + 6; tok != nullptr; tok = tok2) {
tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"roomname=", 9) && *(tok + 9) != 0) {
@@ -148,7 +148,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) if (!wcsnicmp(tok, L"exchange=", 9))
exchange = _wtoi(tok + 9);
}
- if (rm == NULL || exchange <= 0) {
+ if (rm == nullptr || exchange <= 0) {
mir_free(rm);
return 1;
}
diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp index e62a66a174..c6ad5624fd 100644 --- a/protocols/AimOscar/src/popup.cpp +++ b/protocols/AimOscar/src/popup.cpp @@ -40,8 +40,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM if (HIWORD(wParam) == STN_CLICKED)
{
CAimPopupData* p = (CAimPopupData*)PUGetPluginData(hWnd);
- if (p->url != NULL)
- ShellExecuteA(NULL, "open", p->url, NULL, NULL, SW_SHOW);
+ if (p->url != nullptr)
+ ShellExecuteA(nullptr, "open", p->url, nullptr, nullptr, SW_SHOW);
PUDeletePopup(hWnd);
return 0;
@@ -89,12 +89,12 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) {
size_t len = mir_wstrlen(ppd.lptzText);
mir_snwprintf(&ppd.lptzText[len], _countof(ppd.lptzText) - len, L" %s", TranslateT("Open mail account?"));
- if (MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_YESNO | MB_ICONINFORMATION) == IDYES)
- ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOW);
+ if (MessageBox(nullptr, ppd.lptzText, ppd.lptzContactName, MB_YESNO | MB_ICONINFORMATION) == IDYES)
+ ShellExecuteA(nullptr, "open", url, nullptr, nullptr, SW_SHOW);
}
else
{
- MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, ppd.lptzText, ppd.lptzContactName, MB_OK | MB_ICONINFORMATION);
}
}
else
@@ -107,7 +107,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) ppd.iSeconds = -1;
}
else
- ppd.PluginData = new CAimPopupData(this, NULL);
+ ppd.PluginData = new CAimPopupData(this, nullptr);
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
}
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 7fd35eec98..5857be9f50 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -24,9 +24,9 @@ CAimProto::CAimProto(const char* aProtoName, const wchar_t* aUserName) : debugLogA("Setting protocol/module name to '%s'", m_szModuleName);
//create some events
- m_hAvatarEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- m_hChatNavEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- m_hAdminEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ m_hAvatarEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
+ m_hChatNavEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
+ m_hAdminEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
CreateProtoService(PS_CREATEACCMGRUI, &CAimProto::SvcCreateAccMgrUI);
@@ -170,7 +170,7 @@ HANDLE __cdecl CAimProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t *s ForkThread(&CAimProto::accept_file_thread, ft);
return ft;
}
- return 0;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -239,7 +239,7 @@ int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** case FILERESUME_SKIP:
mir_free(ft->pfts.tszCurrentFile);
- ft->pfts.tszCurrentFile = NULL;
+ ft->pfts.tszCurrentFile = nullptr;
break;
default:
@@ -317,7 +317,7 @@ void __cdecl CAimProto::basic_search_ack_success(void *p) HANDLE __cdecl CAimProto::SearchBasic(const wchar_t *szId)
{
if (m_state != 1)
- return 0;
+ return nullptr;
//duplicating the parameter so that it isn't deleted before it's needed- e.g. this function ends before it's used
ForkThread(&CAimProto::basic_search_ack_success, mir_u2a(szId));
@@ -330,8 +330,8 @@ HANDLE __cdecl CAimProto::SearchBasic(const wchar_t *szId) HANDLE __cdecl CAimProto::SearchByEmail(const wchar_t *email)
{
// Maximum email size should really be 320, but the char string is limited to 255.
- if (m_state != 1 || email == NULL || mir_wstrlen(email) >= 254)
- return NULL;
+ if (m_state != 1 || email == nullptr || mir_wstrlen(email) >= 254)
+ return nullptr;
char *szEmail = mir_u2a(email);
aim_search_by_email(m_hServerConn, m_seqno, szEmail);
@@ -345,7 +345,7 @@ HANDLE __cdecl CAimProto::SearchByEmail(const wchar_t *email) int __cdecl CAimProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
{
char *omsg = pre->szMessage;
- char *bbuf = NULL;
+ char *bbuf = nullptr;
if (getByte(AIM_KEY_FI, 1)) {
debugLogA("Converting from html to bbcodes then stripping leftover html.");
pre->szMessage = bbuf = html_to_bbcodes(pre->szMessage);
@@ -365,16 +365,16 @@ int __cdecl CAimProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles)
{
if (m_state != 1)
- return 0;
+ return nullptr;
if (hContact && szDescription && ppszFiles) {
DBVARIANT dbv;
if (!getString(hContact, AIM_KEY_SN, &dbv)) {
- file_transfer *ft = new file_transfer(hContact, dbv.pszVal, NULL);
+ file_transfer *ft = new file_transfer(hContact, dbv.pszVal, nullptr);
bool isDir = false;
int count = 0;
- while (ppszFiles[count] != NULL) {
+ while (ppszFiles[count] != nullptr) {
struct _stati64 statbuf;
if (_wstat64(ppszFiles[count++], &statbuf) == 0) {
if (statbuf.st_mode & _S_IFDIR) {
@@ -389,7 +389,7 @@ HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti if (ft->pfts.totalFiles == 0) {
delete ft;
- return NULL;
+ return nullptr;
}
ft->pfts.flags |= PFTS_SENDING;
@@ -397,7 +397,7 @@ HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti ft->file = ft->pfts.totalFiles == 1 || isDir ? mir_utf8encodeW(ppszFiles[0]) : (char*)mir_calloc(1);
ft->sending = true;
- ft->message = szDescription[0] ? mir_utf8encodeW(szDescription) : NULL;
+ ft->message = szDescription[0] ? mir_utf8encodeW(szDescription) : nullptr;
ft->me_force_proxy = getByte(AIM_KEY_FP, 0) != 0;
ft->requester = true;
@@ -417,7 +417,7 @@ HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti }
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -438,7 +438,7 @@ void __cdecl CAimProto::msg_ack_success(void* param) int __cdecl CAimProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
{
- if (pszSrc == NULL)
+ if (pszSrc == nullptr)
return 0;
if (m_state != 1) {
@@ -449,7 +449,7 @@ int __cdecl CAimProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) }
char *sn = getStringA(hContact, AIM_KEY_SN);
- if (sn == NULL) {
+ if (sn == nullptr) {
msg_ack_param *msg_ack = (msg_ack_param*)mir_calloc(sizeof(msg_ack_param));
msg_ack->hContact = hContact;
msg_ack->msg = "Screen Name for the contact not available";
@@ -472,7 +472,7 @@ int __cdecl CAimProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) if (!res || blast || 0 == getByte(AIM_KEY_DC, 1)) {
msg_ack_param *msg_ack = (msg_ack_param*)mir_alloc(sizeof(msg_ack_param));
msg_ack->hContact = hContact;
- msg_ack->msg = NULL;
+ msg_ack->msg = nullptr;
msg_ack->id = res;
msg_ack->success = res != 0;
ForkThread(&CAimProto::msg_ack_success, msg_ack);
@@ -564,7 +564,7 @@ void __cdecl CAimProto::get_online_msg_thread(void* arg) HANDLE __cdecl CAimProto::GetAwayMsg(MCONTACT hContact)
{
if (m_state != 1)
- return 0;
+ return nullptr;
int status = getWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE);
switch (status) {
@@ -574,7 +574,7 @@ HANDLE __cdecl CAimProto::GetAwayMsg(MCONTACT hContact) break;
default:
- return 0;
+ return nullptr;
}
return (HANDLE)1;
@@ -595,7 +595,7 @@ int __cdecl CAimProto::RecvAwayMsg(MCONTACT hContact, int, PROTORECVEVENT* pre) int __cdecl CAimProto::SetAwayMsg(int status, const wchar_t* msg)
{
char **msgptr = get_status_msg_loc(status);
- if (msgptr == NULL) return 1;
+ if (msgptr == nullptr) return 1;
char *nmsg = mir_utf8encodeW(msg);
mir_free(*msgptr); *msgptr = nmsg;
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index d5ac1af9da..96038aa8d1 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -35,7 +35,7 @@ int CAimProto::snac_authorization_reply(SNAC &snac)//family 0x0017 int res = 0;
if (snac.subcmp(0x0003)) {
- char* server = NULL;
+ char* server = nullptr;
int address = 0;
unsigned short port;
unsigned char use_ssl = 0;
@@ -47,7 +47,7 @@ int CAimProto::snac_authorization_reply(SNAC &snac)//family 0x0017 else if (tlv.cmp(0x0006)) {
Netlib_CloseHandle(m_hServerConn);
- if (server == NULL) return 3;
+ if (server == nullptr) return 3;
char* delim = strchr(server, ':');
port = delim ? (unsigned short)atoi(delim + 1) : get_default_port();
if (delim) *delim = 0;
@@ -57,7 +57,7 @@ int CAimProto::snac_authorization_reply(SNAC &snac)//family 0x0017 mir_free(COOKIE);
COOKIE_LENGTH = tlv.len();
COOKIE = tlv.dup();
- ForkThread(&CAimProto::aim_protocol_negotiation, 0);
+ ForkThread(&CAimProto::aim_protocol_negotiation, nullptr);
res = 1;
}
else
@@ -165,7 +165,7 @@ void CAimProto::snac_icbm_limitations(SNAC &snac, HNETLIBCONN hServerConn, unsig }
char** msgptr = get_status_msg_loc(m_iDesiredStatus);
- replaceStr(m_last_status_msg, msgptr ? *msgptr: NULL);
+ replaceStr(m_last_status_msg, msgptr ? *msgptr: nullptr);
aim_set_statusmsg(hServerConn, seqno, m_last_status_msg);
if (m_iDesiredStatus == ID_STATUS_AWAY)
@@ -215,7 +215,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 bool caps_included = false;
unsigned long status_type = 0; // 0 = online
- char *hash_sm = NULL, *hash_lg = NULL;
+ char *hash_sm = nullptr, *hash_lg = nullptr;
unsigned char sn_len = snac.ubyte();
char* sn = snac.part(1, sn_len);
@@ -488,7 +488,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_SM, msg_s);
wchar_t* tszMsg = mir_utf8decodeW(msg_s);
- ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszMsg);
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, nullptr, (LPARAM)tszMsg);
mir_free(tszMsg);
mir_free(msg);
mir_free(msg_s);
@@ -727,7 +727,7 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset) tlv_offset += TLV_HEADER_SIZE + tlv.len();
}
if (m_list_received)
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
}
break;
@@ -856,7 +856,7 @@ void CAimProto::modify_ssi_list(SNAC &snac, int &offset) }
tlv_offset += TLV_HEADER_SIZE + tlv.len();
}
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
}
break;
}
@@ -900,14 +900,14 @@ void CAimProto::delete_ssi_list(SNAC &snac, int &offset) if (mir_strcmp(name, "1")) {
m_avatar_id_sm = 0;
mir_free(m_hash_sm);
- m_hash_sm = NULL;
+ m_hash_sm = nullptr;
}
else if (!mir_strcmp(name, "12")) {
m_avatar_id_lg = 0;
mir_free(m_hash_lg);
- m_hash_lg = NULL;
+ m_hash_lg = nullptr;
}
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
break;
}
mir_free(name);
@@ -947,7 +947,7 @@ void CAimProto::snac_contact_list(SNAC &snac, HNETLIBCONN hServerConn, unsigned if (getByte(AIM_KEY_CM, 0))
aim_new_service_request(hServerConn, seqno, 0x0018);//mail
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
debugLogA("Connection Negotiation Finished");
m_state = 1;
@@ -979,7 +979,7 @@ void CAimProto::snac_message_accepted(SNAC &snac)//family 0x004 msg_ack_param *msg_ack = (msg_ack_param*)mir_alloc(sizeof(msg_ack_param));
msg_ack->hContact = hContact;
msg_ack->id = *(int*)icbm_cookie & 0x7fffffff;
- msg_ack->msg = NULL;
+ msg_ack->msg = nullptr;
msg_ack->success = true;
ForkThread(&CAimProto::msg_ack_success, msg_ack);
}
@@ -999,12 +999,12 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig int offset = 15 + sn_length;
- char *msg_buf = NULL;
+ char *msg_buf = nullptr;
unsigned long offline_timestamp = 0;
bool is_offline = false;
//file transfer stuff
- char *icbm_cookie = NULL;
- char *filename = NULL;
+ char *icbm_cookie = nullptr;
+ char *filename = nullptr;
unsigned __int64 file_size = 0;
bool auto_response = false;
bool force_proxy = false;
@@ -1190,7 +1190,7 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hMsgContact, 0);
{
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (is_offline) ? offline_timestamp : (DWORD)time(0);
+ pre.timestamp = (is_offline) ? offline_timestamp : (DWORD)time(nullptr);
pre.szMessage = msg_buf;
ProtoChainRecvMsg(hMsgContact, &pre);
}
@@ -1209,7 +1209,7 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (int)len;
@@ -1219,7 +1219,7 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig aim_send_message(hServerConn, seqno, sn, s_msg, true, getBool(hContact, AIM_KEY_BLS, false));
mir_free(s_msg);
}
- setDword(hContact, AIM_KEY_LM, (DWORD)time(NULL));
+ setDword(hContact, AIM_KEY_LM, (DWORD)time(nullptr));
}
}
else if (channel == 2) { // File Transfer
@@ -1245,14 +1245,14 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig m_ft_list.insert(ft);
- if (!descr_included) msg_buf = NULL;
+ if (!descr_included) msg_buf = nullptr;
wchar_t* filenameT = mir_utf8decodeW(filename);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = mir_utf8decodeW(msg_buf);
pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
@@ -1338,7 +1338,7 @@ void CAimProto::snac_file_decline(SNAC &snac)//family 0x0004 msg_ack_param *msg_ack = (msg_ack_param*)mir_alloc(sizeof(msg_ack_param));
msg_ack->hContact = hContact;
- msg_ack->msg = NULL;
+ msg_ack->msg = nullptr;
msg_ack->id = *(int*)icbm_cookie & 0x7fffffff;
msg_ack->success = false;
ForkThread(&CAimProto::msg_ack_success, msg_ack);
@@ -1391,8 +1391,8 @@ void CAimProto::snac_received_info(SNAC &snac)//family 0x0002 if (++i > tlv_count) {
if (tlv.cmp(0x0001)) { //profile encoding
char *enc = tlv.dup();
- profile_unicode = strstr(enc, "unicode-2-0") != NULL;
- profile_utf = strstr(enc, "utf-8") != NULL;
+ profile_unicode = strstr(enc, "unicode-2-0") != nullptr;
+ profile_utf = strstr(enc, "utf-8") != nullptr;
mir_free(enc);
}
else if (tlv.cmp(0x0002)) { //profile message string
@@ -1404,8 +1404,8 @@ void CAimProto::snac_received_info(SNAC &snac)//family 0x0002 }
else if (tlv.cmp(0x0003)) { //away message encoding
char *enc = tlv.dup();
- away_message_unicode = strstr(enc, "unicode-2-0") != NULL;
- away_message_utf = strstr(enc, "utf-8") != NULL;
+ away_message_unicode = strstr(enc, "unicode-2-0") != nullptr;
+ away_message_utf = strstr(enc, "utf-8") != nullptr;
mir_free(enc);
}
else if (tlv.cmp(0x0004)) { // away message string
@@ -1533,9 +1533,9 @@ void CAimProto::snac_list_modification_ack(SNAC &snac)//family 0x0013 void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001
{
if (snac.subcmp(0x0005)) {
- char* server = NULL;
- char* local_cookie = NULL;
- char* host = NULL;
+ char* server = nullptr;
+ char* local_cookie = nullptr;
+ char* host = nullptr;
int local_cookie_length = 0;
unsigned short family = 0;
unsigned char use_ssl = 0;
@@ -1567,7 +1567,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 debugLogA("Successfully Connected to the Mail Server.");
MAIL_COOKIE = local_cookie;
MAIL_COOKIE_LENGTH = local_cookie_length;
- ForkThread(&CAimProto::aim_mail_negotiation, 0);
+ ForkThread(&CAimProto::aim_mail_negotiation, nullptr);
}
else debugLogA("Failed to connect to the Mail Server.");
}
@@ -1577,7 +1577,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 debugLogA("Successfully Connected to the Avatar Server.");
AVATAR_COOKIE = local_cookie;
AVATAR_COOKIE_LENGTH = local_cookie_length;
- ForkThread(&CAimProto::aim_avatar_negotiation, 0);
+ ForkThread(&CAimProto::aim_avatar_negotiation, nullptr);
}
else debugLogA("Failed to connect to the Avatar Server.");
}
@@ -1587,7 +1587,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 debugLogA("Successfully Connected to the Chat Navigation Server.");
CHATNAV_COOKIE = local_cookie;
CHATNAV_COOKIE_LENGTH = local_cookie_length;
- ForkThread(&CAimProto::aim_chatnav_negotiation, 0);
+ ForkThread(&CAimProto::aim_chatnav_negotiation, nullptr);
}
else debugLogA("Failed to connect to the Chat Navigation Server.");
}
@@ -1611,7 +1611,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 debugLogA("Successfully Connected to the Admin Server.");
ADMIN_COOKIE = local_cookie;
ADMIN_COOKIE_LENGTH = local_cookie_length;
- ForkThread(&CAimProto::aim_admin_negotiation, 0);
+ ForkThread(&CAimProto::aim_admin_negotiation, nullptr);
}
else debugLogA("Failed to connect to the Admin Server.");
}
@@ -1623,13 +1623,13 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018
{
if (snac.subcmp(0x0007)) {
- char* sn = NULL;
+ char* sn = nullptr;
time_t time = 0;
unsigned short num_msgs = 0;
unsigned short flags = 0;
char new_mail = 0;
- char* url = NULL;
- char* address = NULL;
+ char* url = nullptr;
+ char* address = nullptr;
int position = 26;
int num_tlvs = snac.ushort(24);
@@ -1666,7 +1666,7 @@ void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018 SYSTEMTIME stLocal;
GetLocalTime(&stLocal);
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stLocal, NULL, msg + len, _countof(msg) - len);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stLocal, nullptr, msg + len, _countof(msg) - len);
ShowPopup((char*)msg, MAIL_POPUP | TCHAR_POPUP, url);
}
@@ -1769,7 +1769,7 @@ void CAimProto::snac_chatnav_info_response(SNAC &snac, HNETLIBCONN hServerConn, // Main TLV info
unsigned short exchange = 0;
unsigned short cookie_len = 0;
- char* cookie = 0;
+ char* cookie = nullptr;
unsigned short instance = 0;
unsigned short num_tlv = 0;
unsigned short tlv_offset = 0;
@@ -1781,7 +1781,7 @@ void CAimProto::snac_chatnav_info_response(SNAC &snac, HNETLIBCONN hServerConn, num_tlv = info_tlv.ushort(6 + cookie_len); // Number of TLVs
tlv_offset = 8 + cookie_len; // We're looking at any remaining TLVs
- char* name = 0;
+ char* name = nullptr;
for (int i = 0; i < num_tlv; i++) // Loop through all the TLVs
{
TLV tlv(info_tlv.val() + tlv_offset);
@@ -1793,7 +1793,7 @@ void CAimProto::snac_chatnav_info_response(SNAC &snac, HNETLIBCONN hServerConn, }
chat_list_item *item = find_chat_by_id(name);
- if (item == NULL) {
+ if (item == nullptr) {
item = new chat_list_item(name, cookie, exchange, instance);
m_chat_rooms.insert(item);
@@ -1834,8 +1834,8 @@ void CAimProto::snac_chat_joined_left_users(SNAC &snac, chat_list_item* item)//f void CAimProto::snac_chat_received_message(SNAC &snac, chat_list_item* item)//family 0x000E
{
if (snac.subcmp(0x0006)) {
- wchar_t* message = NULL;
- char* sn = NULL;
+ wchar_t* message = nullptr;
+ char* sn = nullptr;
// unsigned long cookie = snac.ulong(0);
// unsigned short channel = snac.ushort(8);
@@ -1882,8 +1882,8 @@ void CAimProto::snac_chat_received_message(SNAC &snac, chat_list_item* item)//fa }
else if (msg_tlv.cmp(0x0002)) {
char* enc = msg_tlv.dup();
- uni = strstr(enc, "unicode-2-0") != NULL;
- utf = strstr(enc, "utf-8") != NULL;
+ uni = strstr(enc, "unicode-2-0") != nullptr;
+ utf = strstr(enc, "utf-8") != nullptr;
mir_free(enc);
}
@@ -1918,8 +1918,8 @@ void CAimProto::snac_admin_account_infomod(SNAC &snac) //family 0x0007 WORD num_tlv = snac.ushort(2); // Number of TLVs
- char *sn = NULL; // Screen Name
- char *email = NULL; // Email address
+ char *sn = nullptr; // Screen Name
+ char *email = nullptr; // Email address
unsigned short offset = 0;
for (int i = 0; i < num_tlv; i++) // Loop through all the TLVs
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp index c108139a3e..1012a1c611 100644 --- a/protocols/AimOscar/src/services.cpp +++ b/protocols/AimOscar/src/services.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. INT_PTR CAimProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam)
{
char** msgptr = get_status_msg_loc(wParam ? wParam : m_iStatus);
- if (msgptr == NULL) return 0;
+ if (msgptr == nullptr) return 0;
return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_utf8decodeW(*msgptr) : (INT_PTR)mir_utf8decodeA(*msgptr);
}
@@ -128,22 +128,22 @@ int CAimProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) char *name;
switch (cws->value.type) {
case DBVT_DELETED:
- set_local_nick(hContact, NULL, NULL);
+ set_local_nick(hContact, nullptr, nullptr);
break;
case DBVT_ASCIIZ:
name = mir_utf8encode(cws->value.pszVal);
- set_local_nick(hContact, name, NULL);
+ set_local_nick(hContact, name, nullptr);
mir_free(name);
break;
case DBVT_UTF8:
- set_local_nick(hContact, cws->value.pszVal, NULL);
+ set_local_nick(hContact, cws->value.pszVal, nullptr);
break;
case DBVT_WCHAR:
name = mir_utf8encodeW(cws->value.pwszVal);
- set_local_nick(hContact, name, NULL);
+ set_local_nick(hContact, name, nullptr);
mir_free(name);
break;
}
@@ -191,7 +191,7 @@ int CAimProto::OnGroupChange(WPARAM hContact, LPARAM lParam) CLISTGROUPCHANGE *grpchg = (CLISTGROUPCHANGE*)lParam;
if (hContact == NULL) {
- if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL) {
+ if (grpchg->pszNewName == nullptr && grpchg->pszOldName != nullptr) {
T2Utf szOldName(grpchg->pszOldName);
unsigned short group_id = m_group_list.find_id(szOldName);
if (group_id) {
@@ -200,7 +200,7 @@ int CAimProto::OnGroupChange(WPARAM hContact, LPARAM lParam) update_server_group("", 0);
}
}
- else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL) {
+ else if (grpchg->pszNewName != nullptr && grpchg->pszOldName != nullptr) {
unsigned short group_id = m_group_list.find_id(T2Utf(grpchg->pszOldName));
if (group_id)
update_server_group(T2Utf(grpchg->pszNewName), group_id);
@@ -254,7 +254,7 @@ INT_PTR CAimProto::BlockBuddy(WPARAM hContact, LPARAM) }
else {
item_id = m_block_list.add(dbv.pszVal);
- aim_add_contact(m_hServerConn, m_seqno, dbv.pszVal, item_id, 0, 3, false);
+ aim_add_contact(m_hServerConn, m_seqno, dbv.pszVal, item_id, 0, 3, nullptr);
}
break;
@@ -281,7 +281,7 @@ INT_PTR CAimProto::BlockBuddy(WPARAM hContact, LPARAM) INT_PTR CAimProto::JoinChatUI(WPARAM, LPARAM)
{
- DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHAT), NULL, join_chat_dialog, LPARAM(this));
+ DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHAT), nullptr, join_chat_dialog, LPARAM(this));
return 0;
}
@@ -316,13 +316,13 @@ INT_PTR CAimProto::OnLeaveChat(WPARAM wParam, LPARAM) INT_PTR CAimProto::InstantIdle(WPARAM, LPARAM)
{
- DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_IDLE), NULL, instant_idle_dialog, LPARAM(this));
+ DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_IDLE), nullptr, instant_idle_dialog, LPARAM(this));
return 0;
}
INT_PTR CAimProto::ManageAccount(WPARAM, LPARAM)
{
- ShellExecuteA(NULL, "open", "https://my.screenname.aol.com", NULL, NULL, SW_SHOW);
+ ShellExecuteA(nullptr, "open", "https://my.screenname.aol.com", nullptr, nullptr, SW_SHOW);
return 0;
}
@@ -336,7 +336,7 @@ INT_PTR CAimProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (getByte(AIM_KEY_DA, 0))
return GAIR_NOAVATAR;
- switch (get_avatar_filename(pai->hContact, pai->filename, _countof(pai->filename), NULL)) {
+ switch (get_avatar_filename(pai->hContact, pai->filename, _countof(pai->filename), nullptr)) {
case GAIR_SUCCESS:
if (!(wParam & GAIF_FORCE) || m_state != 1)
return GAIR_SUCCESS;
@@ -394,7 +394,7 @@ INT_PTR CAimProto::GetAvatar(WPARAM wParam, LPARAM lParam) {
wchar_t* buf = (wchar_t*)wParam;
size_t size = (size_t)lParam;
- if (buf == NULL || size <= 0)
+ if (buf == nullptr || size <= 0)
return -1;
PROTO_AVATAR_INFORMATION ai = { 0 };
@@ -413,16 +413,16 @@ INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam) if (m_state != 1)
return 1;
- if (szFileName == NULL) {
+ if (szFileName == nullptr) {
aim_ssi_update(m_hServerConn, m_seqno, true);
aim_delete_avatar_hash(m_hServerConn, m_seqno, 1, 1, m_avatar_id_sm);
aim_delete_avatar_hash(m_hServerConn, m_seqno, 1, 12, m_avatar_id_lg);
aim_ssi_update(m_hServerConn, m_seqno, false);
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
}
else {
- char hash[16], hash1[16], *data, *data1 = NULL;
+ char hash[16], hash1[16], *data, *data1 = nullptr;
unsigned short size, size1 = 0;
if (!get_avatar_hash(szFileName, hash, &data, size)) {
@@ -447,7 +447,7 @@ INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam) aim_ssi_update(m_hServerConn, m_seqno, false);
}
else {
- mir_free(m_hash_lg); m_hash_lg = NULL;
+ mir_free(m_hash_lg); m_hash_lg = nullptr;
mir_free(m_hash_sm); m_hash_sm = bytes_to_string(hash, sizeof(hash1));
aim_ssi_update(m_hServerConn, m_seqno, true);
@@ -456,7 +456,7 @@ INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam) aim_ssi_update(m_hServerConn, m_seqno, false);
}
- avatar_request_handler(NULL, NULL, 0);
+ avatar_request_handler(NULL, nullptr, 0);
avatar_up_req *req = new avatar_up_req(data, size, data1, size1);
ForkThread(&CAimProto::avatar_upload_thread, req);
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index 627ffbfdb6..762c841a39 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -73,7 +73,7 @@ HANDLE GetIconHandle(const char *name) if (!mir_strcmp(iconList[i].szName, name))
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
void ReleaseIconEx(const char *name, bool big)
@@ -113,7 +113,7 @@ static void set_AT_icon(CAimProto* ppro, MCONTACT hContact) if (ppro->isChatRoom(hContact)) return;
unsigned i = ppro->getByte(hContact, AIM_KEY_AC, 0) - 1;
- ExtraIcon_SetIcon(hExtraAT, hContact, (i < 5) ? GetIconHandle(extra_AT_icon_name[i]) : NULL);
+ ExtraIcon_SetIcon(hExtraAT, hContact, (i < 5) ? GetIconHandle(extra_AT_icon_name[i]) : nullptr);
}
static void set_ES_icon(CAimProto* ppro, MCONTACT hContact)
@@ -121,7 +121,7 @@ static void set_ES_icon(CAimProto* ppro, MCONTACT hContact) if (ppro->isChatRoom(hContact)) return;
unsigned i = ppro->getByte(hContact, AIM_KEY_ET, 0) - 1;
- ExtraIcon_SetIcon(hExtraAT, hContact, (i < 2) ? GetIconHandle(extra_ES_icon_name[i]) : NULL);
+ ExtraIcon_SetIcon(hExtraAT, hContact, (i < 2) ? GetIconHandle(extra_ES_icon_name[i]) : nullptr);
}
void set_contact_icon(CAimProto* ppro, MCONTACT hContact)
diff --git a/protocols/AimOscar/src/thread.cpp b/protocols/AimOscar/src/thread.cpp index 35b163f506..3affac892b 100644 --- a/protocols/AimOscar/src/thread.cpp +++ b/protocols/AimOscar/src/thread.cpp @@ -23,7 +23,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file {
file_transfer *ft = (file_transfer*)param;
- HNETLIBCONN hConn = NULL;
+ HNETLIBCONN hConn = nullptr;
if (ft->peer_force_proxy) //peer is forcing proxy
{
hConn = aim_peer_connect(ft->proxy_ip, get_default_port());
@@ -74,7 +74,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file }
}
- if (hConn == NULL) {
+ if (hConn == nullptr) {
if (ft->req_num)
aim_file_ad(m_hServerConn, m_seqno, ft->sn, ft->icbm_cookie, true, 0);
diff --git a/protocols/AimOscar/src/tlv.cpp b/protocols/AimOscar/src/tlv.cpp index 717ef5d4b5..089a0fc17d 100644 --- a/protocols/AimOscar/src/tlv.cpp +++ b/protocols/AimOscar/src/tlv.cpp @@ -28,7 +28,7 @@ TLV::TLV(char* buf) memcpy(value_,&buf[4],length_);
}
else
- value_= NULL;
+ value_= nullptr;
}
TLV::TLV(unsigned short type, unsigned short length, const char* value)
@@ -41,7 +41,7 @@ TLV::TLV(unsigned short type, unsigned short length, const char* value) memcpy(value_, value, length_);
}
else
- value_= NULL;
+ value_= nullptr;
}
TLV::~TLV()
@@ -71,7 +71,7 @@ unsigned char TLV::ubyte(int pos) char* TLV::part(int pos, int length)//returns part of the tlv value
{
- if ((pos + length) > length_) return NULL;
+ if ((pos + length) > length_) return nullptr;
char* value = (char*)mir_alloc(length + 2);
memcpy(value, &value_[pos], length);
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index c2d37f170f..7bf8eed909 100755 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-HANDLE hThemeButton = NULL;
+HANDLE hThemeButton = nullptr;
COLORREF foreground=0;
COLORREF background=0xffffff;
COLORREF custColours[16]={0};
@@ -45,7 +45,7 @@ void DrawMyControl(HDC hDC, HWND /*hwndButton*/, HANDLE hTheme, UINT iState, REC }
rect.top -= 1;
rect.left -= 1;
- DrawThemeBackground(hTheme, hDC, BP_PUSHBUTTON, state, &rect, NULL);
+ DrawThemeBackground(hTheme, hDC, BP_PUSHBUTTON, state, &rect, nullptr);
}
else {
if (bIsFocused) {
@@ -169,12 +169,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L _itoa(cfOld.yHeight / 20, size, sizeof(size));
//SetDlgItemText(hwndDlg, IDC_FONTSIZE, size);
SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_SELECTSTRING, 1, (LPARAM)size);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_BOLD), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_ITALIC), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_UNDERLINE), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_BOLD), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_ITALIC), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_UNDERLINE), nullptr, FALSE);
}
else if (((LPNMHDR)lParam)->code == EN_REQUESTRESIZE) {
// REQRESIZE* rr= (REQRESIZE*)lParam;
@@ -212,12 +212,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isSuper = (cfOld.dwEffects & CFE_SUPERSCRIPT) && (cfOld.dwMask & CFM_SUPERSCRIPT);
if (isSuper) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sup_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sup_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("sup_scrpt");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nsup_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nsup_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nsup_scrpt");
}
}
@@ -230,12 +230,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isSuper = (cfOld.dwEffects & CFE_SUPERSCRIPT) && (cfOld.dwMask & CFM_SUPERSCRIPT);
if (!isSub&&!isSuper) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("norm_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("norm_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("norm_scrpt");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nnorm_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nnorm_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nnorm_scrpt");
}
}
@@ -247,12 +247,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isSub = (cfOld.dwEffects & CFE_SUBSCRIPT) && (cfOld.dwMask & CFM_SUBSCRIPT);
if (isSub) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sub_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sub_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("sub_scrpt");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nsub_scrpt"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nsub_scrpt"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nsub_scrpt");
}
}
@@ -264,12 +264,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isBold = (cfOld.dwEffects & CFE_BOLD) && (cfOld.dwMask & CFM_BOLD);
if (!isBold) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nbold"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nbold"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nbold");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("bold"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("bold"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("bold");
}
}
@@ -281,12 +281,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isItalic = (cfOld.dwEffects & CFE_ITALIC) && (cfOld.dwMask & CFM_ITALIC);
if (!isItalic) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_ITALIC), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nitalic"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nitalic"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nitalic");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_ITALIC), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("italic"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("italic"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("italic");
}
}
@@ -298,18 +298,18 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L BOOL isUnderline = (cfOld.dwEffects & CFE_UNDERLINE) && (cfOld.dwMask & CFM_UNDERLINE);
if (!isUnderline) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_UNDERLINE), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nundrln"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nundrln"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("nundrln");
}
else {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_UNDERLINE), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("undrln"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("undrln"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("undrln");
}
}
else if (lpDIS->CtlID == IDC_FOREGROUNDCOLOR) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 2, LoadIconEx("foreclr"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 2, LoadIconEx("foreclr"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("foreclr");
HBRUSH hbr = CreateSolidBrush(foreground);
HPEN hp = CreatePen(PS_SOLID, 1, ~foreground & 0x00ffffff);
@@ -343,7 +343,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L }
else if (lpDIS->CtlID == IDC_BACKGROUNDCOLOR) {
DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLOR), hThemeButton, lpDIS->itemState, lpDIS->rcItem);
- DrawIconEx(lpDIS->hDC, 4, 2, LoadIconEx("backclr"), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(lpDIS->hDC, 4, 2, LoadIconEx("backclr"), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseIconEx("backclr");
HBRUSH hbr = CreateSolidBrush(background);
HPEN hp = CreatePen(PS_SOLID, 1, ~background & 0x00ffffff);
@@ -405,8 +405,8 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cf.dwEffects = CFE_SUPERSCRIPT;
SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE));
- InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), nullptr, FALSE);
}
break;
@@ -418,8 +418,8 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cf.dwEffects &= ~CFE_SUPERSCRIPT;
SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE));
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUBSCRIPT), nullptr, FALSE);
}
break;
@@ -431,8 +431,8 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cf.dwEffects = CFE_SUBSCRIPT;
SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE));
- InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), NULL, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), nullptr, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), nullptr, FALSE);
}
break;
@@ -512,7 +512,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
if (ChooseColor(&cc)) {
foreground = cc.rgbResult;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR), nullptr, FALSE);
}
SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE));
}
@@ -537,12 +537,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L custColours[1] = background;
cc.lStructSize = sizeof(CHOOSECOLOR);
cc.hwndOwner = hwndDlg;
- cc.hInstance = (HWND)GetModuleHandle(NULL);
+ cc.hInstance = (HWND)GetModuleHandle(nullptr);
cc.lpCustColors = custColours;
cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
if (ChooseColor(&cc)) {
background = cc.rgbResult;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLOR), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLOR), nullptr, FALSE);
}
SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE));
}
@@ -703,7 +703,7 @@ int CAimProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) INT_PTR CAimProto::EditProfile(WPARAM, LPARAM)
{
- DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_AIM), NULL, userinfo_dialog, LPARAM(this));
+ DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_AIM), nullptr, userinfo_dialog, LPARAM(this));
return 0;
}
@@ -866,7 +866,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP //End Force Proxy Transfer
//PN
- int port = GetDlgItemInt(hwndDlg, IDC_PN, NULL, FALSE);
+ int port = GetDlgItemInt(hwndDlg, IDC_PN, nullptr, FALSE);
if (port > 0 && port != AIM_DEFAULT_PORT)
ppro->setWord(AIM_KEY_PN, (WORD)port);
else
@@ -1175,8 +1175,8 @@ INT_PTR CALLBACK instant_idle_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_COMMAND:
{
- unsigned long hours = GetDlgItemInt(hwndDlg, IDC_IIH, 0, 0);
- unsigned short minutes = (unsigned short)GetDlgItemInt(hwndDlg, IDC_IIM, 0, 0);
+ unsigned long hours = GetDlgItemInt(hwndDlg, IDC_IIH, nullptr, 0);
+ unsigned short minutes = (unsigned short)GetDlgItemInt(hwndDlg, IDC_IIM, nullptr, 0);
if (minutes > 59)
minutes = 59;
@@ -1453,5 +1453,5 @@ INT_PTR CALLBACK chat_request_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR void CALLBACK chat_request_cb(PVOID dwParam)
{
CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE_REQ),
- NULL, chat_request_dialog, (LPARAM)dwParam);
+ nullptr, chat_request_dialog, (LPARAM)dwParam);
}
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index ee1918bcc4..eeb52b6f26 100755 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -29,42 +29,42 @@ void CAimProto::broadcast_status(int status) shutdown_chat_conn();
if (m_hServerConn) {
- aim_sendflap(m_hServerConn, 0x04, 0, NULL, m_seqno);
+ aim_sendflap(m_hServerConn, 0x04, 0, nullptr, m_seqno);
Netlib_Shutdown(m_hServerConn);
}
if (m_hMailConn && m_hMailConn != (HANDLE)1) {
- aim_sendflap(m_hMailConn, 0x04, 0, NULL, m_mail_seqno);
+ aim_sendflap(m_hMailConn, 0x04, 0, nullptr, m_mail_seqno);
Netlib_Shutdown(m_hMailConn);
}
else if (m_hMailConn == (HANDLE)1)
- m_hMailConn = NULL;
+ m_hMailConn = nullptr;
if (m_hAvatarConn && m_hAvatarConn != (HANDLE)1) {
- aim_sendflap(m_hAvatarConn, 0x04, 0, NULL, m_avatar_seqno);
+ aim_sendflap(m_hAvatarConn, 0x04, 0, nullptr, m_avatar_seqno);
Netlib_Shutdown(m_hAvatarConn);
}
else if (m_hAvatarConn == (HANDLE)1)
- m_hAvatarConn = NULL;
+ m_hAvatarConn = nullptr;
if (m_hChatNavConn && m_hChatNavConn != (HANDLE)1) {
- aim_sendflap(m_hChatNavConn, 0x04, 0, NULL, m_chatnav_seqno);
+ aim_sendflap(m_hChatNavConn, 0x04, 0, nullptr, m_chatnav_seqno);
Netlib_Shutdown(m_hChatNavConn);
}
else if (m_hChatNavConn == (HANDLE)1)
- m_hChatNavConn = NULL;
+ m_hChatNavConn = nullptr;
m_idle = false;
m_instantidle = false;
m_list_received = false;
m_state = 0;
m_iDesiredStatus = ID_STATUS_OFFLINE;
- replaceStr(m_last_status_msg, NULL);
+ replaceStr(m_last_status_msg, nullptr);
m_avatar_id_lg = 0;
m_avatar_id_sm = 0;
- replaceStr(m_hash_lg, NULL);
- replaceStr(m_hash_sm, NULL);
+ replaceStr(m_hash_lg, nullptr);
+ replaceStr(m_hash_sm, nullptr);
m_pd_flags = 0;
m_pd_info_id = 0;
@@ -107,7 +107,7 @@ void CAimProto::start_connection(void*) //if (login_url == NULL) login_url = mir_strdup(use_ssl ? AIM_DEFAULT_SERVER : AIM_DEFAULT_SERVER_NS);
- if (login_url == NULL) login_url = mir_strdup(AIM_DEFAULT_SERVER);
+ if (login_url == nullptr) login_url = mir_strdup(AIM_DEFAULT_SERVER);
m_hServerConn = aim_connect(login_url, get_default_port(), false, login_url); //ssl does not work anymore with old authorization algo
@@ -115,8 +115,8 @@ void CAimProto::start_connection(void*) m_pref1_flags = 0x77ffff;
m_pref1_set_flags = 0x77ffff;
- mir_free(m_pref2_flags); m_pref2_flags = NULL; m_pref2_len = 0;
- mir_free(m_pref2_set_flags); m_pref2_set_flags = NULL; m_pref2_set_len = 0;
+ mir_free(m_pref2_flags); m_pref2_flags = nullptr; m_pref2_len = 0;
+ mir_free(m_pref2_set_flags); m_pref2_set_flags = nullptr; m_pref2_set_len = 0;
if (m_hServerConn)
aim_connection_authorization();
@@ -137,7 +137,7 @@ bool CAimProto::wait_conn(HNETLIBCONN &hConn, HANDLE &hEvent, unsigned short ser return false;
{
mir_cslock lck(connMutex);
- if (hConn == NULL && m_hServerConn) {
+ if (hConn == nullptr && m_hServerConn) {
debugLogA("Starting Connection.");
hConn = (HNETLIBCONN)1; //set so no additional service request attempts are made while aim is still processing the request
aim_new_service_request(m_hServerConn, m_seqno, service);//general service connection!
@@ -163,7 +163,7 @@ unsigned short CAimProto::get_default_port(void) bool CAimProto::is_my_contact(MCONTACT hContact)
{
const char* szProto = GetContactProto(hContact);
- return szProto != NULL && mir_strcmp(m_szModuleName, szProto) == 0;
+ return szProto != nullptr && mir_strcmp(m_szModuleName, szProto) == 0;
}
MCONTACT CAimProto::find_chat_contact(const char* room)
@@ -235,7 +235,7 @@ void CAimProto::update_server_group(const char* group, unsigned short group_id) void CAimProto::add_contact_to_group(MCONTACT hContact, const char* new_group)
{
- if (new_group == NULL)
+ if (new_group == nullptr)
return;
unsigned short old_group_id = getGroupId(hContact, 1);
@@ -244,7 +244,7 @@ void CAimProto::add_contact_to_group(MCONTACT hContact, const char* new_group) return;
DBVARIANT dbv;
- char *nick = NULL;
+ char *nick = nullptr;
if (!db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv)) {
nick = NEWSTR_ALLOCA(dbv.pszVal);
db_free(&dbv);
@@ -319,7 +319,7 @@ void CAimProto::offline_contacts(void) char *normalize_name(const char *s)
{
- if (s == NULL) return NULL;
+ if (s == nullptr) return nullptr;
char* buf = mir_strdup(s);
_strlwr(buf);
@@ -341,7 +341,7 @@ char *normalize_name(const char *s) char* trim_str(char* s)
{
- if (s == NULL) return NULL;
+ if (s == nullptr) return nullptr;
size_t len = mir_strlen(s);
while (len) {
@@ -389,7 +389,7 @@ retry: //returns the size of the list array aquired with data
unsigned short* CAimProto::get_members_of_group(unsigned short group_id, unsigned short &size)
{
- unsigned short* list = NULL;
+ unsigned short* list = nullptr;
size = 0;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
@@ -415,7 +415,7 @@ void CAimProto::upload_nicks(void) for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
DBVARIANT dbv;
if (!db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv)) {
- set_local_nick(hContact, dbv.pszVal, NULL);
+ set_local_nick(hContact, dbv.pszVal, nullptr);
db_free(&dbv);
}
}
@@ -468,7 +468,7 @@ char* BdList::find_name(unsigned short id) if (items[i]->item_id == id)
return items[i]->name;
}
- return NULL;
+ return nullptr;
}
void BdList::remove_by_id(unsigned short id)
@@ -542,7 +542,7 @@ int CAimProto::open_contact_file(const char*, const wchar_t* file, const char*, int fid = _wopen(path, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD);
if (fid < 0) {
wchar_t errmsg[512];
- mir_snwprintf(errmsg, TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
+ mir_snwprintf(errmsg, TranslateT("Failed to open file: %s %s"), path, __tcserror(nullptr));
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
return fid;
@@ -560,7 +560,7 @@ void CAimProto::write_away_message(const char* sn, const char* msg, bool utf) _write(fid, "'s Away Message:</h3>", 21);
_write(fid, s_msg, (unsigned)mir_strlen(s_msg));
_close(fid);
- ShellExecute(NULL, L"open", path, NULL, NULL, SW_SHOW);
+ ShellExecute(nullptr, L"open", path, nullptr, nullptr, SW_SHOW);
mir_free(path);
mir_free(s_msg);
}
@@ -578,7 +578,7 @@ void CAimProto::write_profile(const char* sn, const char* msg, bool utf) _write(fid, "'s Profile:</h3>", 16);
_write(fid, s_msg, (unsigned)mir_strlen(s_msg));
_close(fid);
- ShellExecute(NULL, L"open", path, NULL, NULL, SW_SHOW);
+ ShellExecute(nullptr, L"open", path, nullptr, nullptr, SW_SHOW);
mir_free(path);
mir_free(s_msg);
}
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index 5e615367b3..cd5dbf7ec3 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(0); + gce.time = time(nullptr); Chat_Event(&gce); } } @@ -228,7 +228,7 @@ void CDiscordProto::OnCommandGuildMemberRemoved(const JSONNode &pRoot) continue; GCEVENT gce = { m_szModuleName, pUser.wszUsername, GC_EVENT_PART }; - gce.time = time(0); + gce.time = time(nullptr); gce.ptszUID = wszUserId; Chat_Event(&gce); } @@ -263,7 +263,7 @@ void CDiscordProto::OnCommandGuildMemberUpdated(const JSONNode &pRoot) } GCEVENT gce = { m_szModuleName, pUser.wszUsername, GC_EVENT_NICK }; - gce.time = time(0); + gce.time = time(nullptr); 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 52c1f290ed..db21b69cc2 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(0); + gce.time = time(nullptr); 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(0); + gce.time = time(nullptr); gce.dwFlags = GCEF_SILENT; wchar_t wszUserId[100]; diff --git a/protocols/Discord/src/menus.cpp b/protocols/Discord/src/menus.cpp index c5f0fff585..4c3cf1ab5c 100644 --- a/protocols/Discord/src/menus.cpp +++ b/protocols/Discord/src/menus.cpp @@ -39,7 +39,7 @@ INT_PTR CDiscordProto::OnMenuCopyId(WPARAM hContact, LPARAM) INT_PTR CDiscordProto::OnMenuCreateChannel(WPARAM hContact, LPARAM) { - ENTER_STRING es = { sizeof(es), ESF_COMBO, m_szModuleName, "channel_name", TranslateT("Enter channel name"), 0, 5 }; + ENTER_STRING es = { sizeof(es), ESF_COMBO, m_szModuleName, "channel_name", TranslateT("Enter channel name"), nullptr, 5 }; if (EnterString(&es)) { JSONNode roles(JSON_ARRAY); roles.set_name("permission_overwrites"); JSONNode root; root << INT_PARAM("type", 0) << WCHAR_PARAM("name", es.ptszResult) << roles; @@ -54,7 +54,7 @@ INT_PTR CDiscordProto::OnMenuCreateChannel(WPARAM hContact, LPARAM) INT_PTR CDiscordProto::OnMenuJoinGuild(WPARAM, LPARAM) { - ENTER_STRING es = { sizeof(es), ESF_COMBO, m_szModuleName, "guild_name", TranslateT("Enter invitation code you received"), 0, 5 }; + ENTER_STRING es = { sizeof(es), ESF_COMBO, m_szModuleName, "guild_name", TranslateT("Enter invitation code you received"), nullptr, 5 }; if (EnterString(&es)) { CMStringA szUrl(FORMAT, "/invite/%S", es.ptszResult); Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, nullptr)); diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp index b60e03df6b..a3ebd86284 100644 --- a/protocols/Discord/src/utils.cpp +++ b/protocols/Discord/src/utils.cpp @@ -81,7 +81,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(0); + return time(nullptr); T.tm_year -= 1900; T.tm_mon--; diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 56a4d3b8b8..6ccf2f4ac0 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CDummyProto::SendMsgAck(void *p) { - if (p == NULL) + if (p == nullptr) return; message_data *data = static_cast<message_data*>(p); @@ -69,7 +69,7 @@ CDummyProto::CDummyProto(const char *szModuleName, const wchar_t *ptszUserName) CDummyProto::~CDummyProto() { - Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = NULL; + Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = nullptr; dummy_Instances.remove(this); } @@ -145,7 +145,7 @@ int CDummyProto::SetStatus(int) HANDLE CDummyProto::SearchBasic(const wchar_t* id) { if (uniqueIdSetting[0] == '\0') - return 0; + return nullptr; wchar_t *tid = mir_wstrdup(id); ForkThread(&CDummyProto::SearchIdAckThread, tid); @@ -154,7 +154,7 @@ HANDLE CDummyProto::SearchBasic(const wchar_t* id) MCONTACT CDummyProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { - if (psr->id.w == NULL) + if (psr->id.w == nullptr) return NULL; MCONTACT hContact = db_add_contact(); diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp index c65fdeb4de..d25ebae2c8 100644 --- a/protocols/EmLanProto/src/amdproto.cpp +++ b/protocols/EmLanProto/src/amdproto.cpp @@ -19,8 +19,8 @@ PLUGININFOEX pluginInfo = { { 0xe08ce7c4, 0x9eeb, 0x4272, { 0xb5, 0x44, 0xd, 0x32, 0xe1, 0x8d, 0x90, 0xde } }
};
-HINSTANCE g_hInstance = NULL;
-CMLan* g_lan = NULL;
+HINSTANCE g_hInstance = nullptr;
+CMLan* g_lan = nullptr;
int hLangpack;
bool g_InitOptions = false;
@@ -294,7 +294,7 @@ INT_PTR CALLBACK EMPDlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA switch (uMsg) {
case WM_INITDIALOG:
- if ((hwndOwner = GetParent(hwndDlg)) == NULL)
+ if ((hwndOwner = GetParent(hwndDlg)) == nullptr)
hwndOwner = GetDesktopWindow();
GetWindowRect(hwndOwner, &rcOwner);
diff --git a/protocols/EmLanProto/src/lan.cpp b/protocols/EmLanProto/src/lan.cpp index d473bca9df..336e64bb75 100644 --- a/protocols/EmLanProto/src/lan.cpp +++ b/protocols/EmLanProto/src/lan.cpp @@ -9,8 +9,8 @@ CLan::CLan() m_filesoc = INVALID_SOCKET;
m_status = LS_OK;
m_mode = LM_OFF;
- m_hListenThread = NULL;
- m_hAcceptTCPThread = NULL;
+ m_hListenThread = nullptr;
+ m_hAcceptTCPThread = nullptr;
Startup();
}
@@ -69,11 +69,11 @@ void CLan::StopListen() if (m_hListenThread) {
shutdown(m_income, SD_BOTH);
WaitForSingleObject(m_hListenThread, INFINITE);
- m_hListenThread = NULL;
+ m_hListenThread = nullptr;
}
if (m_hAcceptTCPThread) {
TerminateThread(m_hAcceptTCPThread, 0);
- m_hAcceptTCPThread = NULL;
+ m_hAcceptTCPThread = nullptr;
}
if (m_income != INVALID_SOCKET) {
closesocket(m_income);
@@ -133,7 +133,7 @@ void CLan::StartListen() m_hListenThread = mir_forkthread(ListenProc, (void*)this);
m_hAcceptTCPThread = mir_forkthread(AcceptTCPProc, (void*)this);
- if (m_hListenThread == NULL || m_hAcceptTCPThread == NULL) {
+ if (m_hListenThread == nullptr || m_hAcceptTCPThread == nullptr) {
m_mode = LM_ON;
m_status = LS_CANT_CREATE_THREADS;
StopListen();
@@ -174,7 +174,7 @@ void CLan::Listen() OnRecvPacket((u_char*)buf, recLen, addr.sin_addr);
}
}
- m_hListenThread = NULL;
+ m_hListenThread = nullptr;
}
void CLan::SendPacketBroadcast(const u_char* mes, int len)
@@ -219,7 +219,7 @@ void CLan::AcceptTCP() mir_forkthread(OnInTCPConnectionProc, (void*)tcp_conn);
Sleep(100);
}
- m_hAcceptTCPThread = NULL;
+ m_hAcceptTCPThread = nullptr;
}
void __cdecl CLan::OnInTCPConnectionProc(void *lpParameter)
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index cc3f7b2d2a..14005a3294 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -34,20 +34,20 @@ CMLan::CMLan() m_UseHostName = true; m_mirStatus = ID_STATUS_OFFLINE; - m_pRootContact = 0; + m_pRootContact = nullptr; - m_pRootContact = NULL; - m_hCheckThread = NULL; + m_pRootContact = nullptr; + m_hCheckThread = nullptr; m_handleId = 1; - m_amesAway = NULL; - m_amesNa = NULL; - m_amesOccupied = NULL; - m_amesDnd = NULL; - m_amesFfc = NULL; + m_amesAway = nullptr; + m_amesNa = nullptr; + m_amesOccupied = nullptr; + m_amesDnd = nullptr; + m_amesFfc = nullptr; - m_pFileConnectionList = NULL; + m_pFileConnectionList = nullptr; LoadSettings(); @@ -74,7 +74,7 @@ CMLan::~CMLan() void CMLan::DeleteCache() { TContact* pCont = m_pRootContact; - m_pRootContact = NULL; + m_pRootContact = nullptr; while (pCont) { delete[] pCont->m_nick; TContact* pPrev = pCont->m_prev; @@ -139,7 +139,7 @@ void CMLan::StopChecking() mir_cslock lck(m_csAccessClass); if (m_hCheckThread) { TerminateThread(m_hCheckThread, 0); - m_hCheckThread = NULL; + m_hCheckThread = nullptr; } } @@ -346,7 +346,7 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) mir_cslock lck(m_csAccessAwayMes); - char* mesAway = NULL; + char* mesAway = nullptr; switch (m_mirStatus) { case ID_STATUS_AWAY: mesAway = m_amesAway; break; case ID_STATUS_NA: mesAway = m_amesNa; break; @@ -554,7 +554,7 @@ int CMLan::SetAwayMsg(u_int status, char* msg) if (msg) *ppMsg = _strdup(msg); else - *ppMsg = NULL; + *ppMsg = nullptr; return 0; } @@ -841,7 +841,7 @@ int CMLan::TFileConnection::Recv(bool halt) EMLOG("No data - halting Recv (only " << len << " bytes)"); m_recSize = -1; delete[] m_buf; - m_buf = NULL; + m_buf = nullptr; return FCS_OK; } Sleep(10); @@ -862,7 +862,7 @@ int CMLan::TFileConnection::Recv(bool halt) if (size == 0) { EMLOG("Connection was gracefully closed - size is 0"); delete[] m_buf; - m_buf = NULL; + m_buf = nullptr; m_recSize = 0; return FCS_OK; } @@ -952,7 +952,7 @@ void CMLan::FileAddToList(TFileConnection* conn) mir_cslock lck(m_csFileConnectionList); mir_cslock connLck(conn->m_csAccess); conn->m_pNext = m_pFileConnectionList; - conn->m_pPrev = NULL; + conn->m_pPrev = nullptr; if (m_pFileConnectionList) m_pFileConnectionList->m_pPrev = conn; m_pFileConnectionList = conn; @@ -969,9 +969,9 @@ void CMLan::FileRemoveFromList(TFileConnection* conn) m_pFileConnectionList = conn->m_pNext; if (conn->m_pNext) conn->m_pNext->m_pPrev = conn->m_pPrev; - conn->m_pLan = NULL; - conn->m_pPrev = NULL; - conn->m_pNext = NULL; + conn->m_pLan = nullptr; + conn->m_pPrev = nullptr; + conn->m_pNext = nullptr; } void CMLan::RecvFile(CCSDATA* ccs) @@ -1001,7 +1001,7 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) cont = cont->m_prev; // There is no such user in cached list - can not identify him - if (cont == NULL) + if (cont == nullptr) return; EMLOG("Passed contact search (cont is not NULL)"); @@ -1030,7 +1030,7 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) char* pf_fr = (char*)conn->m_buf + 1 + 4 + 4; conn->m_szFiles = new char*[rcTotalFiles + 1]; - conn->m_szFiles[rcTotalFiles] = NULL; + conn->m_szFiles[rcTotalFiles] = nullptr; for (int i = 0; i < rcTotalFiles; i++) { conn->m_szFiles[i] = _strdup(pf_fr); @@ -1059,7 +1059,7 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) Sleep(10); if (conn->m_state != TFileConnection::FCS_ALLOW) { - conn->Send(NULL, 0); + conn->Send(nullptr, 0); delete conn; return; } @@ -1082,7 +1082,7 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) conn->m_szRenamedFile = _strdup(pathpart); *pathpart = 0; if (!SetCurrentDirectory(path)) { - conn->Send(NULL, 0); + conn->Send(nullptr, 0); ProtoBroadcastAck(PROTONAME, conn->m_hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)conn->m_cid, (LPARAM)"Can't open output directory"); delete conn; return; @@ -1161,10 +1161,10 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) conn->m_state = TFileConnection::FCS_OK; EMLOG("Creating file"); - HANDLE hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL, mode_open, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ, nullptr, mode_open, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { EMLOG("Can't create file"); - conn->Send(NULL, 0); + conn->Send(nullptr, 0); ProtoBroadcastAck(PROTONAME, conn->m_hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)conn->m_cid, (LPARAM)"Can't create file"); delete conn; return; @@ -1172,9 +1172,9 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) EMLOG("Ok"); snd_buf[0] = FCODE_SND_ACCEPT; - int fsize = GetFileSize(hFile, NULL); + int fsize = GetFileSize(hFile, nullptr); *((int*)(snd_buf + 1)) = fsize; - SetFilePointer(hFile, 0, NULL, FILE_END); + SetFilePointer(hFile, 0, nullptr, FILE_END); fts.currentFileProgress = fsize; fts.totalProgress += fsize; @@ -1206,7 +1206,7 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) EMLOG("Received"); DWORD written; EMLOG("Writing to file"); - WriteFile(hFile, conn->m_buf + 1, conn->m_recSize - 1, &written, NULL); + WriteFile(hFile, conn->m_buf + 1, conn->m_recSize - 1, &written, nullptr); EMLOG("Ok"); fts.currentFileProgress += conn->m_recSize - 1; fts.totalProgress += conn->m_recSize - 1; @@ -1227,7 +1227,7 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) break; delete[] conn->m_szRenamedFile; - conn->m_szRenamedFile = NULL; + conn->m_szRenamedFile = nullptr; } if (err) @@ -1268,14 +1268,14 @@ void CMLan::OnOutTCPConnection(u_long addr, SOCKET out_socket, LPVOID lpParamete while (*pf) { // TODO: FIX IT ! EMLOG("Opening file"); - HANDLE hFile = CreateFile(*pf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + HANDLE hFile = CreateFile(*pf, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); if (hFile == INVALID_HANDLE_VALUE) { EMLOG("Can't open file for reading"); ProtoBroadcastAck(PROTONAME, conn->m_hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)conn->m_cid, (LPARAM)"Can't open one of the files"); delete conn; return; } - size += GetFileSize(hFile, NULL); + size += GetFileSize(hFile, nullptr); filecount++; CloseHandle(hFile); @@ -1327,10 +1327,10 @@ void CMLan::OnOutTCPConnection(u_long addr, SOCKET out_socket, LPVOID lpParamete for (int fileNo = 0; fileNo < filecount; fileNo++) { EMLOG("Opening file for reading (once more)"); - HANDLE hFile = CreateFile(conn->m_szFiles[fileNo], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(conn->m_szFiles[fileNo], GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { EMLOG("Failed"); - conn->Send(NULL, 0); + conn->Send(nullptr, 0); ProtoBroadcastAck(PROTONAME, conn->m_hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)conn->m_cid, (LPARAM)"Can't open file"); delete conn; return; @@ -1342,7 +1342,7 @@ void CMLan::OnOutTCPConnection(u_long addr, SOCKET out_socket, LPVOID lpParamete u_char snd_buf[5]; snd_buf[0] = FCODE_SND_NEXTFILE; - int fsize = GetFileSize(hFile, NULL); + int fsize = GetFileSize(hFile, nullptr); *((int*)(snd_buf + 1)) = fsize; EMLOG("Sending file size"); if (conn->Send(snd_buf, 5)) { @@ -1363,7 +1363,7 @@ void CMLan::OnOutTCPConnection(u_long addr, SOCKET out_socket, LPVOID lpParamete if (conn->m_buf[0] != FCODE_SND_FILESKIP) { EMLOG("File is not skipped"); int filepos = *((int*)(conn->m_buf + 1)); - SetFilePointer(hFile, filepos, NULL, FILE_BEGIN); + SetFilePointer(hFile, filepos, nullptr, FILE_BEGIN); fts.szCurrentFile = fts.pszFiles[fileNo]; fts.currentFileTime = get_time(); @@ -1384,14 +1384,14 @@ void CMLan::OnOutTCPConnection(u_long addr, SOCKET out_socket, LPVOID lpParamete if (tosend > fsize) tosend = fsize; EMLOG("Reading file data"); - ReadFile(hFile, buf + 1, tosend, &readbytes, NULL); + ReadFile(hFile, buf + 1, tosend, &readbytes, nullptr); EMLOG("Ok"); buf[0] = FCODE_SND_FILEDATA; if (readbytes != tosend) { EMLOG("Error during reading file. File was changed"); CloseHandle(hFile); - conn->Send(NULL, 0); + conn->Send(nullptr, 0); ProtoBroadcastAck(PROTONAME, conn->m_hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)conn->m_cid, (LPARAM)"Can't read file"); delete conn; return; @@ -1424,7 +1424,7 @@ void CMLan::OnOutTCPConnection(u_long addr, SOCKET out_socket, LPVOID lpParamete if (conn->m_state) { EMLOG("Interrupted by user"); - conn->Send(NULL, 0); + conn->Send(nullptr, 0); //CloseHandle(hFile); err = true; break; @@ -1438,7 +1438,7 @@ void CMLan::OnOutTCPConnection(u_long addr, SOCKET out_socket, LPVOID lpParamete if (err) { EMLOG("There was error during file transfering"); - conn->Send(NULL, 0); + conn->Send(nullptr, 0); ProtoBroadcastAck(PROTONAME, conn->m_hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)conn->m_cid, (LPARAM)"Connection aborted"); } else @@ -1463,7 +1463,7 @@ int CMLan::SendFile(CCSDATA* ccs) conn->m_szFiles = new char*[files + 1]; for (int i = 0; i < files; i++) conn->m_szFiles[i] = _strdup(ppszFiles[i]); - conn->m_szFiles[files] = NULL; + conn->m_szFiles[files] = nullptr; u_long addr = db_get_dw(ccs->hContact, PROTONAME, "ipaddr", 0); CreateTCPConnection(addr, (LPVOID)conn); diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index da7be52e72..41e3c5d341 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -80,13 +80,13 @@ void FacebookProto::CheckAvatarChange(MCONTACT hContact, const std::string &imag }
else if (update_required) {
db_set_b(hContact, "ContactPhoto", "NeedUpdate", 1);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr);
}
}
void FacebookProto::UpdateAvatarWorker(void *)
{
- HNETLIBCONN nlc = NULL;
+ HNETLIBCONN nlc = nullptr;
debugLogA("*** UpdateAvatarWorker");
@@ -178,7 +178,7 @@ INT_PTR FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) return GAIR_NOAVATAR;
PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
- if (GetDbAvatarInfo(*pai, NULL))
+ if (GetDbAvatarInfo(*pai, nullptr))
{
bool fileExist = _waccess(pai->filename, 0) == 0;
@@ -198,7 +198,7 @@ INT_PTR FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) bool is_empty = avatar_queue.empty();
avatar_queue.push_back(pai->hContact);
if (is_empty)
- ForkThread(&FacebookProto::UpdateAvatarWorker, NULL);
+ ForkThread(&FacebookProto::UpdateAvatarWorker, nullptr);
}
return GAIR_WAITFOR;
}
diff --git a/protocols/FacebookRM/src/captcha.cpp b/protocols/FacebookRM/src/captcha.cpp index 8e65cf6374..6f09eeaae9 100644 --- a/protocols/FacebookRM/src/captcha.cpp +++ b/protocols/FacebookRM/src/captcha.cpp @@ -111,7 +111,7 @@ bool FacebookProto::RunCaptchaForm(std::string captchaUrl, std::string &result) req.flags = NLHRF_NODUMPHEADERS; NETLIBHTTPREQUEST *reply = Netlib_HttpTransaction(facy.handle_, &req); - if (reply == NULL) + if (reply == nullptr) return false; if (reply->resultCode != HTTP_CODE_OK) { @@ -119,7 +119,7 @@ bool FacebookProto::RunCaptchaForm(std::string captchaUrl, std::string &result) return false; } - CAPTCHA_FORM_PARAMS param = { 0 }; + CAPTCHA_FORM_PARAMS param = {}; IMGSRVC_MEMIO memio = { 0 }; memio.iLen = reply->dataLength; @@ -131,7 +131,7 @@ bool FacebookProto::RunCaptchaForm(std::string captchaUrl, std::string &result) GetObject(param.bmp, sizeof(bmp), &bmp); param.w = bmp.bmWidth; param.h = bmp.bmHeight; - int res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CAPTCHAFORM), NULL, CaptchaFormDlgProc, (LPARAM)¶m); + int res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CAPTCHAFORM), nullptr, CaptchaFormDlgProc, (LPARAM)¶m); if (res == 0) return false; diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index 966a7a0d76..3d35fb179f 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -37,8 +37,8 @@ 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(NULL); - if (id != NULL) + gce.time = timestamp ? timestamp : ::time(nullptr); + if (id != nullptr) gce.bIsMe = !mir_strcmp(id, facy.self_.user_id.c_str()); gce.dwFlags |= GCEF_ADDTOLOG; if (is_old) { @@ -172,7 +172,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(NULL); + gce.time = ::time(nullptr); gce.bIsMe = (user.role == ROLE_ME); if (user.is_former) { @@ -209,7 +209,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(NULL); + gce.time = ::time(nullptr); gce.bIsMe = false; Chat_Event(&gce); @@ -233,7 +233,7 @@ char *FacebookProto::GetChatUsers(const char *chat_id) bool FacebookProto::IsChatContact(const char *chat_id, const char *id) { ptrA users(GetChatUsers(chat_id)); - return (users != NULL && strstr(users, id) != NULL); + return (users != NULL && strstr(users, id) != nullptr); } void FacebookProto::AddChat(const char *id, const wchar_t *tname) @@ -308,7 +308,7 @@ INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM) INT_PTR FacebookProto::OnLeaveChat(WPARAM wParam, LPARAM) { - ptrW idT(wParam ? getWStringA(wParam, "ChatRoomID") : NULL); + ptrW idT(wParam ? getWStringA(wParam, "ChatRoomID") : nullptr); Chat_Control(m_szModuleName, idT, SESSION_OFFLINE); Chat_Terminate(m_szModuleName, idT); @@ -335,7 +335,7 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam) { GCMENUITEMS *gcmi = (GCMENUITEMS*)lParam; - if (gcmi == NULL || _stricmp(gcmi->pszModule, m_szModuleName)) return 0; + if (gcmi == nullptr || _stricmp(gcmi->pszModule, m_szModuleName)) return 0; if (gcmi->Type == MENU_ON_LOG) { @@ -416,7 +416,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(NULL); + gce.time = notification->time ? notification->time : ::time(nullptr); 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 514ab9ccef..7d41c10e2e 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -42,7 +42,7 @@ http::response facebook_client::sendRequest(HttpRequest *request) } // Check and append user defined locale if request doesn't have it forced already - if (!parent->m_locale.empty() && strstr(request->szUrl, "&locale=") == NULL) + if (!parent->m_locale.empty() && strstr(request->szUrl, "&locale=") == nullptr) request->Url << CHAR_VALUE("locale", parent->m_locale.c_str()); request->Headers @@ -68,7 +68,7 @@ http::response facebook_client::sendRequest(HttpRequest *request) // Set persistent connection (or not) switch (request->Persistent) { case ChannelRequest::NONE: - request->nlc = NULL; + request->nlc = nullptr; request->flags &= ~NLHRF_PERSISTENT; break; case ChannelRequest::CHANNEL: @@ -96,19 +96,19 @@ http::response facebook_client::sendRequest(HttpRequest *request) case ChannelRequest::NONE: break; case ChannelRequest::CHANNEL: - hChannelCon = pnlhr ? pnlhr->nlc : NULL; + hChannelCon = pnlhr ? pnlhr->nlc : nullptr; break; case ChannelRequest::MESSAGES: - hMessagesCon = pnlhr ? pnlhr->nlc : NULL; + hMessagesCon = pnlhr ? pnlhr->nlc : nullptr; break; case ChannelRequest::DEFAULT: ReleaseMutex(fcb_conn_lock_); - hFcbCon = pnlhr ? pnlhr->nlc : NULL; + hFcbCon = pnlhr ? pnlhr->nlc : nullptr; break; } // Check and copy response data - if (pnlhr != NULL) { + if (pnlhr != nullptr) { parent->debugLogA("@@@ Got response with code %d", pnlhr->resultCode); store_headers(&resp, pnlhr->headers, pnlhr->headersCount); resp.code = pnlhr->resultCode; @@ -293,7 +293,7 @@ void facebook_client::clear_notifications() ScopedLock s(notifications_lock_); for (auto it = notifications.begin(); it != notifications.end();) { - if (it->second->hWndPopup != NULL) + if (it->second->hWndPopup != nullptr) PUDeletePopup(it->second->hWndPopup); // close popup delete it->second; @@ -570,7 +570,7 @@ bool facebook_client::login(const char *username, const char *password) tszMessage.AppendFormat(L"\n\n%s", ptrW(mir_utf8decodeW(activity.c_str()))); } - if (MessageBox(0, tszMessage, tszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1) != IDYES) { + if (MessageBox(nullptr, tszMessage, tszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1) != IDYES) { // We will cancel connecting right away, because we don't want to handle password changing via Miranda client_notify(TranslateT("Login error: You need to confirm last unknown login or revoke it from web browser.")); return handle_error("login", FORCE_QUIT); @@ -1007,7 +1007,7 @@ bool facebook_client::activity_ping() http::response resp = sendRequest(request); // Remember this last ping time - parent->m_pingTS = ::time(NULL); + parent->m_pingTS = ::time(nullptr); if (resp.data.empty() || resp.data.find("\"t\":\"pong\"") == resp.data.npos) { // Something went wrong @@ -1143,7 +1143,7 @@ int facebook_client::send_message(int seqid, MCONTACT hContact, const std::strin bool facebook_client::post_status(status_data *status) { - if (status == NULL || (status->text.empty() && status->url.empty())) + if (status == nullptr || (status->text.empty() && status->url.empty())) return false; handle_entry("post_status"); @@ -1213,7 +1213,7 @@ bool facebook_client::save_url(const std::string &url, const std::wstring &filen // Write to file FILE *f = _wfopen(filename.c_str(), L"wb"); - if (f != NULL) { + if (f != nullptr) { fwrite(resp->pData, 1, resp->dataLength, f); fclose(f); @@ -1223,7 +1223,7 @@ bool facebook_client::save_url(const std::string &url, const std::wstring &filen Netlib_FreeHttpRequest(resp); } else { - nlc = NULL; + nlc = nullptr; } return ret; diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index 613e25427f..80d4b6e95a 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -40,13 +40,13 @@ void FacebookProto::ChangeStatus(void*) Netlib_Shutdown(facy.hChannelCon); if (facy.hChannelCon) Netlib_CloseHandle(facy.hChannelCon); - facy.hChannelCon = NULL; + facy.hChannelCon = nullptr; // Shutdown and close messages handle Netlib_Shutdown(facy.hMessagesCon); if (facy.hMessagesCon) Netlib_CloseHandle(facy.hMessagesCon); - facy.hMessagesCon = NULL; + facy.hMessagesCon = nullptr; // Turn off chat on Facebook if (getByte(FACEBOOK_KEY_DISCONNECT_CHAT, DEFAULT_DISCONNECT_CHAT)) @@ -84,7 +84,7 @@ void FacebookProto::ChangeStatus(void*) // Close connection handle if (facy.hFcbCon) Netlib_CloseHandle(facy.hFcbCon); - facy.hFcbCon = NULL; + facy.hFcbCon = nullptr; m_iStatus = facy.self_.status_id = ID_STATUS_OFFLINE; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); @@ -115,38 +115,38 @@ void FacebookProto::ChangeStatus(void*) if (NegotiateConnection() && facy.home() && facy.reconnect()) { // Load all friends - ProcessFriendList(NULL); + ProcessFriendList(nullptr); // Process friendship requests - ForkThread(&FacebookProto::ProcessFriendRequests, NULL); + ForkThread(&FacebookProto::ProcessFriendRequests, nullptr); // Get unread messages - ForkThread(&FacebookProto::ProcessUnreadMessages, NULL); + ForkThread(&FacebookProto::ProcessUnreadMessages, nullptr); // Get notifications if (getByte(FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE)) - ForkThread(&FacebookProto::ProcessNotifications, NULL); + ForkThread(&FacebookProto::ProcessNotifications, nullptr); // Load pages for post status dialog - ForkThread(&FacebookProto::ProcessPages, NULL); + ForkThread(&FacebookProto::ProcessPages, nullptr); // Load on this day posts if (getByte(FACEBOOK_KEY_EVENT_ON_THIS_DAY_ENABLE, DEFAULT_EVENT_ON_THIS_DAY_ENABLE)) - ForkThread(&FacebookProto::ProcessMemories, NULL); + ForkThread(&FacebookProto::ProcessMemories, nullptr); - setDword(FACEBOOK_KEY_LOGON_TS, (DWORD)time(NULL)); - ForkThread(&FacebookProto::UpdateLoop, NULL); - ForkThread(&FacebookProto::MessageLoop, NULL); + setDword(FACEBOOK_KEY_LOGON_TS, (DWORD)time(nullptr)); + ForkThread(&FacebookProto::UpdateLoop, nullptr); + ForkThread(&FacebookProto::MessageLoop, nullptr); if (getByte(FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS)) - ForkThread(&FacebookProto::SetAwayMsgWorker, NULL); + ForkThread(&FacebookProto::SetAwayMsgWorker, nullptr); } else { ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_FAILED, (HANDLE)old_status, m_iStatus); if (facy.hFcbCon) Netlib_CloseHandle(facy.hFcbCon); - facy.hFcbCon = NULL; + facy.hFcbCon = nullptr; facy.clear_cookies(); @@ -181,7 +181,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(NULL)); + m_awayTS = (m_idleTS > 0 ? m_idleTS : ::time(nullptr)); } else if (wasAwayOrInvisible && !isAwayOrInvisible) { // Switching from "away" to "not-away" state, reset the timestamp @@ -217,7 +217,7 @@ bool FacebookProto::NegotiateConnection() password = mir_utf8encode(password); // Refresh last time of feeds update - facy.last_feeds_update_ = ::time(NULL); + facy.last_feeds_update_ = ::time(nullptr); // Generate random clientid for this connection facy.chat_clientid_ = utils::text::rand_string(8, "0123456789abcdef", &facy.random_); @@ -231,14 +231,14 @@ bool FacebookProto::NegotiateConnection() void FacebookProto::UpdateLoop(void *) { - time_t tim = ::time(NULL); + time_t tim = ::time(nullptr); debugLogA(">>> Entering Facebook::UpdateLoop[%d]", tim); for (int i = -1; !isOffline(); i = (i + 1) % 50) { if (i != -1) { if (getByte(FACEBOOK_KEY_EVENT_FEEDS_ENABLE, DEFAULT_EVENT_FEEDS_ENABLE)) - ProcessFeeds(NULL); + ProcessFeeds(nullptr); } debugLogA("*** FacebookProto::UpdateLoop[%d] going to sleep...", tim); @@ -253,7 +253,7 @@ void FacebookProto::UpdateLoop(void *) void FacebookProto::MessageLoop(void *) { - time_t tim = ::time(NULL); + time_t tim = ::time(nullptr); debugLogA(">>> Entering Facebook::MessageLoop[%d]", tim); while (facy.channel()) @@ -262,7 +262,7 @@ void FacebookProto::MessageLoop(void *) break; // If we're not idle, send activity_ping every few minutes... - if (!m_idleTS && (::time(NULL) - m_pingTS) > FACEBOOK_PING_TIME) { + if (!m_idleTS && (::time(nullptr) - 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 3433941bca..75b7e7de68 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -410,7 +410,7 @@ void FacebookProto::DeleteContactFromServer(void *data) { facy.handle_entry("DeleteContactFromServer"); - if (data == NULL) + if (data == nullptr) return; std::string id = *(std::string*)data; @@ -436,7 +436,7 @@ void FacebookProto::DeleteContactFromServer(void *data) if (hContact != NULL) { setWord(hContact, "Status", ID_STATUS_OFFLINE); setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE); - setDword(hContact, FACEBOOK_KEY_DELETED, ::time(NULL)); + setDword(hContact, FACEBOOK_KEY_DELETED, ::time(nullptr)); } NotifyEvent(m_tszUserName, TranslateT("Contact was removed from your server list."), NULL, EVENT_FRIENDSHIP); @@ -453,7 +453,7 @@ void FacebookProto::AddContactToServer(void *data) { facy.handle_entry("AddContactToServer"); - if (data == NULL) + if (data == nullptr) return; std::string id = *(std::string*)data; @@ -485,7 +485,7 @@ void FacebookProto::ApproveContactToServer(void *data) { facy.handle_entry("ApproveContactToServer"); - if (data == NULL) + if (data == nullptr) return; MCONTACT hContact = *(MCONTACT*)data; @@ -517,7 +517,7 @@ void FacebookProto::CancelFriendsRequest(void *data) { facy.handle_entry("CancelFriendsRequest"); - if (data == NULL) + if (data == nullptr) return; MCONTACT hContact = *(MCONTACT*)data; @@ -549,7 +549,7 @@ void FacebookProto::IgnoreFriendshipRequest(void *data) { facy.handle_entry("IgnoreFriendshipRequest"); - if (data == NULL) + if (data == nullptr) return; MCONTACT hContact = *(MCONTACT*)data; @@ -585,7 +585,7 @@ void FacebookProto::SendPokeWorker(void *p) { facy.handle_entry("SendPokeWorker"); - if (p == NULL) + if (p == nullptr) return; std::string *id = (std::string*)p; @@ -622,7 +622,7 @@ void FacebookProto::SendPokeWorker(void *p) void FacebookProto::RefreshUserInfo(void *data) { - if (data == NULL) + if (data == nullptr) return; MCONTACT hContact = *(MCONTACT*)data; @@ -630,7 +630,7 @@ void FacebookProto::RefreshUserInfo(void *data) ptrA user_id(getStringA(hContact, FACEBOOK_KEY_ID)); if (user_id == NULL || isOffline()) { - ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)0, 0); + ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)nullptr, 0); return; } @@ -700,13 +700,13 @@ void FacebookProto::RefreshUserInfo(void *data) } } - ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)0, 0); + ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)nullptr, 0); } HANDLE FacebookProto::GetAwayMsg(MCONTACT) { - return 0; // Status messages are disabled + return nullptr; // Status messages are disabled } int FacebookProto::OnContactDeleted(WPARAM wParam, LPARAM) diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 8874d141bf..d35042b74a 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -174,7 +174,7 @@ void ResizeHorizontal(HWND hwnd, bool wide) { RECT r = { 0, 0, wide ? 422 : 271, 116 }; MapDialogRect(hwnd, &r); r.bottom += GetSystemMetrics(SM_CYSMCAPTION); - SetWindowPos(hwnd, 0, 0, 0, r.right, r.bottom, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(hwnd, nullptr, 0, 0, r.right, r.bottom, SWP_NOMOVE | SWP_NOZORDER); SetDlgItemText(hwnd, IDC_EXPAND, (wide ? TranslateT("<< Contacts") : TranslateT("Contacts >>"))); ShowWindow(GetDlgItem(hwnd, IDC_CCLIST), wide); ShowWindow(GetDlgItem(hwnd, IDC_CCLIST_LABEL), wide); @@ -413,7 +413,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp } else { proto->delSetting(FACEBOOK_KEY_DEF_GROUP); - proto->m_tszDefaultGroup = NULL; + proto->m_tszDefaultGroup = nullptr; } StoreDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY); @@ -477,7 +477,7 @@ INT_PTR CALLBACK FBOptionsStatusesProc(HWND hwnd, UINT message, WPARAM, LPARAM l { proto->setByte(FACEBOOK_KEY_SET_MIRANDA_STATUS, setStatus); if (setStatus && proto->isOnline()) - proto->ForkThread(&FacebookProto::SetAwayMsgWorker, NULL); + proto->ForkThread(&FacebookProto::SetAwayMsgWorker, nullptr); } return TRUE; @@ -616,7 +616,7 @@ INT_PTR CALLBACK FBOptionsMessagingProc(HWND hwnd, UINT message, WPARAM wparam, StoreDBCheckState(proto, hwnd, IDC_HIDE_CHATS, FACEBOOK_KEY_HIDE_CHATS); StoreDBCheckState(proto, hwnd, IDC_JOIN_EXISTING_CHATS, FACEBOOK_KEY_JOIN_EXISTING_CHATS); - int count = GetDlgItemInt(hwnd, IDC_MESSAGES_COUNT, NULL, TRUE); + int count = GetDlgItemInt(hwnd, IDC_MESSAGES_COUNT, nullptr, TRUE); count = min(count, FACEBOOK_MESSAGES_ON_OPEN_LIMIT); proto->setByte(FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT, count); } diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp index 13129f43f3..c54c59eac6 100644 --- a/protocols/FacebookRM/src/events.cpp +++ b/protocols/FacebookRM/src/events.cpp @@ -24,8 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. HWND FacebookProto::NotifyEvent(wchar_t* title, wchar_t* text, MCONTACT contact, EventType type, std::string *url, std::string *notification_id, const char *icon) { - if (title == NULL || text == NULL) - return NULL; + if (title == nullptr || text == nullptr) + return nullptr; char name[256]; @@ -80,15 +80,15 @@ HWND FacebookProto::NotifyEvent(wchar_t* title, wchar_t* text, MCONTACT contact, pd.pwszText = text; pd.pszClassName = name; pd.hContact = contact; - if (icon != NULL) { + if (icon != nullptr) { // pd.hIcon = IcoLib_GetIconByHandle(GetIconHandle(icon)); // FIXME: Uncomment when implemented in Popup+ and YAPP correctly } - if (url != NULL || notification_id != NULL) { + if (url != nullptr || notification_id != nullptr) { popup_data *data = new popup_data(this); - if (url != NULL) + if (url != nullptr) data->url = *url; - if (notification_id != NULL) + if (notification_id != nullptr) data->notification_id = *notification_id; pd.PluginData = data; } @@ -98,11 +98,11 @@ HWND FacebookProto::NotifyEvent(wchar_t* title, wchar_t* text, MCONTACT contact, } else { if (!Clist_TrayNotifyW(m_szModuleName, title, text, type == EVENT_CLIENT ? NIIF_WARNING : NIIF_INFO, 10000)) - return NULL; + return nullptr; } if (type == EVENT_CLIENT) - MessageBox(NULL, text, title, MB_OK | MB_ICONERROR); + MessageBox(nullptr, text, title, MB_OK | MB_ICONERROR); - return NULL; + return nullptr; } diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 94791a1324..165436cb1b 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -762,13 +762,13 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo // Notify it, if user wants to be notified if (proto->getByte(FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE, DEFAULT_EVENT_FRIENDSHIP_ENABLE)) { - proto->NotifyEvent(proto->m_tszUserName, ptrW(mir_utf8decodeW(text.c_str())), NULL, EVENT_FRIENDSHIP, &url, alert_id.empty() ? NULL : &alert_id); + proto->NotifyEvent(proto->m_tszUserName, ptrW(mir_utf8decodeW(text.c_str())), NULL, EVENT_FRIENDSHIP, &url, alert_id.empty() ? nullptr : &alert_id); } } } else if (t == "jewel_requests_add") { // New friendship request, load them all with real names (because there is only user_id in "from" field) - proto->ForkThread(&FacebookProto::ProcessFriendRequests, NULL); + proto->ForkThread(&FacebookProto::ProcessFriendRequests, nullptr); } /*else if (t == "jewel_requests_handled") { // revised 5.3.2017 // When some request is approved (or perhaps even ignored/removed) @@ -870,7 +870,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo if (!buddyList) continue; - time_t offlineThreshold = time(NULL) - 15 * 60; // contacts last active more than 15 minutes will be marked offline + time_t offlineThreshold = time(nullptr) - 15 * 60; // contacts last active more than 15 minutes will be marked offline for (auto itNodes = buddyList.begin(); itNodes != buddyList.end(); ++itNodes) { std::string id = (*itNodes).name(); @@ -944,7 +944,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo if (!overlay_) continue; - time_t offlineThreshold = time(NULL) - 15 * 60; // contacts last active more than 15 minutes will be marked offline + time_t offlineThreshold = time(nullptr) - 15 * 60; // contacts last active more than 15 minutes will be marked offline for (auto itNodes = overlay_.begin(); itNodes != overlay_.end(); ++itNodes) { std::string id = (*itNodes).name(); @@ -1070,7 +1070,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo auto itAlert = notifications->find(id); if (itAlert != notifications->end()) { - if (itAlert->second->hWndPopup != NULL) + if (itAlert->second->hWndPopup != nullptr) PUDeletePopup(itAlert->second->hWndPopup); // close popup delete itAlert->second; diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp index 7b60f15c60..635bb4a610 100644 --- a/protocols/FacebookRM/src/main.cpp +++ b/protocols/FacebookRM/src/main.cpp @@ -117,7 +117,7 @@ extern "C" int __declspec(dllexport) Load(void) g_strUserAgent = agent.str();
// Initialize random generator (used only as fallback in utils)
- srand(::time(NULL));
+ srand(::time(nullptr));
return 0;
}
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index 8054934261..48b86f3981 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -31,7 +31,7 @@ int FacebookProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) void FacebookProto::SendMsgWorker(void *p) { - if (p == NULL) + if (p == nullptr) return; send_direct *data = static_cast<send_direct*>(p); @@ -69,7 +69,7 @@ void FacebookProto::SendMsgWorker(void *p) void FacebookProto::SendChatMsgWorker(void *p) { - if (p == NULL) + if (p == nullptr) return; send_chat *data = static_cast<send_chat*>(p); @@ -101,7 +101,7 @@ void FacebookProto::SendChatMsgWorker(void *p) UpdateChat(data->chat_id.c_str(), facy.self_.user_id.c_str(), facy.self_.real_name.c_str(), data->msg.c_str()); else { ptrA text(mir_utf8encode(err_message.c_str())); - UpdateChat(data->chat_id.c_str(), NULL, NULL, text); + UpdateChat(data->chat_id.c_str(), nullptr, nullptr, text); } } } @@ -128,7 +128,7 @@ int FacebookProto::UserIsTyping(MCONTACT hContact, int type) void FacebookProto::SendTypingWorker(void *p) { - if (p == NULL) + if (p == nullptr) return; send_typing *typing = static_cast<send_typing*>(p); @@ -159,7 +159,7 @@ void FacebookProto::SendTypingWorker(void *p) void FacebookProto::ReadMessageWorker(void *p) { - if (p == NULL) + if (p == nullptr) return; if (getBool(FACEBOOK_KEY_KEEP_UNREAD, 0)) @@ -215,7 +215,7 @@ void FacebookProto::StickerAsSmiley(std::string sticker, const std::string &url, // Check if we have this sticker already and download it if not if (GetFileAttributes(filename.c_str()) == INVALID_FILE_ATTRIBUTES) { - HNETLIBCONN nlc = NULL; + HNETLIBCONN nlc = nullptr; facy.save_url(url, filename, nlc); Netlib_CloseHandle(nlc); } diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 297576d219..d2907ca3c9 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -143,7 +143,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(NULL)); + setDword(hContact, FACEBOOK_KEY_DELETED, ::time(nullptr)); // Notify it, if user wants to be notified if (getByte(FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE, DEFAULT_EVENT_FRIENDSHIP_ENABLE)) { @@ -208,7 +208,7 @@ void FacebookProto::ProcessUnreadMessages(void*) void FacebookProto::ProcessUnreadMessage(void *pParam) { - if (pParam == NULL) + if (pParam == nullptr) return; std::vector<std::string> *threads = (std::vector<std::string>*)pParam; @@ -269,7 +269,7 @@ void FacebookProto::ProcessUnreadMessage(void *pParam) void FacebookProto::LoadLastMessages(void *pParam) { - if (pParam == NULL) + if (pParam == nullptr) return; MCONTACT hContact = *(MCONTACT*)pParam; @@ -328,7 +328,7 @@ void FacebookProto::LoadLastMessages(void *pParam) void FacebookProto::LoadHistory(void *pParam) { - if (pParam == NULL) + if (pParam == nullptr) return; MCONTACT hContact = *(MCONTACT*)pParam; @@ -384,7 +384,7 @@ void FacebookProto::LoadHistory(void *pParam) wcsncpy(pd.lptzContactName, m_tszUserName, MAX_CONTACTNAME); wcsncpy(pd.lptzText, TranslateT("Loading history started."), MAX_SECONDLINE); - HWND popupHwnd = NULL; + HWND popupHwnd = nullptr; if (ServiceExists(MS_POPUP_ADDPOPUPW)) { popupHwnd = (HWND)CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pd, (LPARAM)APF_RETURN_HWND); } @@ -835,11 +835,11 @@ void FacebookProto::ReceiveMessages(std::vector<facebook_message> &messages, boo UpdateChat(fbc->thread_id.c_str(), msg.user_id.c_str(), name.c_str(), msg.message_text.c_str(), msg.time); break; case ADMIN_TEXT: - UpdateChat(thread_id.c_str(), NULL, NULL, msg.message_text.c_str()); + UpdateChat(thread_id.c_str(), nullptr, nullptr, msg.message_text.c_str()); break; case SUBSCRIBE: case UNSUBSCRIBE: - UpdateChat(thread_id.c_str(), NULL, NULL, msg.message_text.c_str()); + UpdateChat(thread_id.c_str(), nullptr, nullptr, msg.message_text.c_str()); { std::vector<std::string> ids; utils::text::explode(msg.data, ";", &ids); @@ -866,7 +866,7 @@ void FacebookProto::ReceiveMessages(std::vector<facebook_message> &messages, boo } break; case THREAD_NAME: { - UpdateChat(thread_id.c_str(), NULL, NULL, msg.message_text.c_str()); + UpdateChat(thread_id.c_str(), nullptr, nullptr, msg.message_text.c_str()); std::string chatName = (!msg.data.empty() ? msg.data : GenerateChatName(fbc)); // proto->RenameChat(thread_id.c_str(), chatName.c_str()); // this don't work, why? @@ -874,7 +874,7 @@ void FacebookProto::ReceiveMessages(std::vector<facebook_message> &messages, boo break; } case THREAD_IMAGE: - UpdateChat(thread_id.c_str(), NULL, NULL, msg.message_text.c_str()); + UpdateChat(thread_id.c_str(), nullptr, nullptr, msg.message_text.c_str()); break; } @@ -958,7 +958,7 @@ void FacebookProto::ReceiveMessages(std::vector<facebook_message> &messages, boo void FacebookProto::ProcessMessages(void* data) { - if (data == NULL) + if (data == nullptr) return; std::string* resp = (std::string*)data; @@ -994,7 +994,7 @@ void FacebookProto::ShowNotifications() { // Show popups for unseen notifications and/or write them to chatroom for (std::map<std::string, facebook_notification*>::iterator it = facy.notifications.begin(); it != facy.notifications.end(); ++it) { facebook_notification *notification = it->second; - if (notification != NULL && !notification->seen) { + if (notification != nullptr && !notification->seen) { debugLogA(" Showing popup for notification ID: %s", notification->id.c_str()); ptrW szText(mir_utf8decodeW(notification->text.c_str())); MCONTACT hContact = (notification->user_id.empty() ? NULL : ContactIDToHContact(notification->user_id)); @@ -1115,11 +1115,11 @@ void FacebookProto::ProcessFriendRequests(void *p) isNew = true; setString(hContact, "RequestTime", time.c_str()); - DB_AUTH_BLOB blob(hContact, fbu.real_name.c_str(), 0, 0, fbu.user_id.c_str(), reason.c_str()); + DB_AUTH_BLOB blob(hContact, fbu.real_name.c_str(), nullptr, nullptr, fbu.user_id.c_str(), reason.c_str()); DBEVENTINFO dbei = {}; dbei.szModule = m_szModuleName; - dbei.timestamp = ::time(NULL); + dbei.timestamp = ::time(nullptr); dbei.flags = DBEF_UTF; dbei.eventType = EVENTTYPE_AUTHREQUEST; dbei.cbBlob = blob.size(); @@ -1285,7 +1285,7 @@ void FacebookProto::SearchAckThread(void *targ) // sld is Base64 encoded and then URL encoded string. So replace potential "%3D" with "=" utils::text::replace_all(&sld, "%3D", "="); // decode Base64 string - ptrA data_((char*)mir_base64_decode(sld.c_str(), 0)); + ptrA data_((char*)mir_base64_decode(sld.c_str(), nullptr)); if (data_) { std::string data = data_; id = utils::text::source_get_value2(&data, "\"ent_id\":", ",}"); diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 281aad172a..68a5364335 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -28,18 +28,18 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : { facy.parent = this; - signon_lock_ = CreateMutex(NULL, FALSE, NULL); - avatar_lock_ = CreateMutex(NULL, FALSE, NULL); - log_lock_ = CreateMutex(NULL, FALSE, NULL); - update_loop_lock_ = CreateEvent(NULL, FALSE, FALSE, NULL); - facy.send_message_lock_ = CreateMutex(NULL, FALSE, NULL); - facy.fcb_conn_lock_ = CreateMutex(NULL, FALSE, NULL); - facy.notifications_lock_ = CreateMutex(NULL, FALSE, NULL); - facy.cookies_lock_ = CreateMutex(NULL, FALSE, NULL); - facy.loading_history_lock_ = CreateMutex(NULL, FALSE, NULL); + signon_lock_ = CreateMutex(nullptr, FALSE, nullptr); + avatar_lock_ = CreateMutex(nullptr, FALSE, nullptr); + log_lock_ = CreateMutex(nullptr, FALSE, nullptr); + update_loop_lock_ = CreateEvent(nullptr, FALSE, FALSE, nullptr); + facy.send_message_lock_ = CreateMutex(nullptr, FALSE, nullptr); + facy.fcb_conn_lock_ = CreateMutex(nullptr, FALSE, nullptr); + facy.notifications_lock_ = CreateMutex(nullptr, FALSE, nullptr); + facy.cookies_lock_ = CreateMutex(nullptr, FALSE, nullptr); + facy.loading_history_lock_ = CreateMutex(nullptr, FALSE, nullptr); // Initialize random seed for this client - facy.random_ = ::time(NULL) + PtrToUint(&facy); + facy.random_ = ::time(nullptr) + PtrToUint(&facy); m_enableChat = DEFAULT_ENABLE_CHATS; @@ -90,10 +90,10 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); nlu.szDescriptiveName.w = descr; m_hNetlibUser = Netlib_RegisterUser(&nlu); - if (m_hNetlibUser == NULL) { + if (m_hNetlibUser == nullptr) { wchar_t error[200]; mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); - MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); + MessageBox(nullptr, error, L"Miranda NG", MB_OK | MB_ICONERROR); } facy.set_handle(m_hNetlibUser); @@ -231,14 +231,14 @@ int FacebookProto::SetAwayMsg(int, const wchar_t *msg) last_status_msg_ = narrow; if (isOnline() && getByte(FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS)) - ForkThread(&FacebookProto::SetAwayMsgWorker, NULL); + ForkThread(&FacebookProto::SetAwayMsgWorker, nullptr); return 0; } void FacebookProto::SetAwayMsgWorker(void *p) { - if (p != NULL) { + if (p != nullptr) { status_data *data = static_cast<status_data*>(p); facy.post_status(data); delete data; @@ -254,7 +254,7 @@ void FacebookProto::SetAwayMsgWorker(void *p) HANDLE FacebookProto::SearchBasic(const wchar_t* id) { if (isOffline()) - return 0; + return nullptr; wchar_t *tid = mir_wstrdup(id); ForkThread(&FacebookProto::SearchIdAckThread, tid); @@ -264,7 +264,7 @@ HANDLE FacebookProto::SearchBasic(const wchar_t* id) HANDLE FacebookProto::SearchByEmail(const wchar_t* email) { if (isOffline()) - return 0; + return nullptr; wchar_t *temail = mir_wstrdup(email); ForkThread(&FacebookProto::SearchAckThread, temail); @@ -297,7 +297,7 @@ MCONTACT FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr) } if (fbu.user_id.find_first_not_of("0123456789") != std::string::npos) { - MessageBox(0, TranslateT("Facebook ID must be numeric value."), m_tszUserName, MB_ICONERROR | MB_OK); + MessageBox(nullptr, TranslateT("Facebook ID must be numeric value."), m_tszUserName, MB_ICONERROR | MB_OK); return NULL; } @@ -387,7 +387,7 @@ int FacebookProto::OnIdleChanged(WPARAM, LPARAM lParam) CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii); // Compute time when user really became idle - m_idleTS = time(0) - mii.idleTime * 60; + m_idleTS = time(nullptr) - mii.idleTime * 60; setDword("IdleTS", m_idleTS); } else { // User stopped being idle @@ -501,7 +501,7 @@ int FacebookProto::OnOptionsInit(WPARAM wParam, LPARAM) int FacebookProto::OnToolbarInit(WPARAM, LPARAM) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE; char service[100]; @@ -543,7 +543,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM) } } - HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MIND), (HWND)0, FBMindProc, reinterpret_cast<LPARAM>(data)); + HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MIND), (HWND)nullptr, FBMindProc, reinterpret_cast<LPARAM>(data)); ShowWindow(hDlg, SW_SHOW); return 0; @@ -747,7 +747,7 @@ INT_PTR FacebookProto::LoadHistory(WPARAM wParam, LPARAM) // Allow loading history only from one contact at a time if (facy.loading_history) { const wchar_t *message = TranslateT("Loading history is already in progress. It can't run for more contacts at once so please wait until it finishes."); - MessageBox(0, message, m_tszUserName, MB_ICONWARNING | MB_OK); + MessageBox(nullptr, message, m_tszUserName, MB_ICONWARNING | MB_OK); return 0; } @@ -761,7 +761,7 @@ INT_PTR FacebookProto::LoadHistory(WPARAM wParam, LPARAM) title.AppendFormat(L"%s - %s", m_tszUserName, name); const wchar_t *message = TranslateT("This will load all messages from the server. To avoid having duplicate messages in your history, delete existing messages manually before continuing.\nLoading process might take a while, so be patient.\n\nDo you want to continue?"); - if (MessageBox(0, message, title, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) == IDYES) { + if (MessageBox(nullptr, message, title, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) == IDYES) { ForkThread(&FacebookProto::LoadHistory, new MCONTACT(hContact)); } @@ -790,7 +790,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam) wchar_t tstr[256]; mir_snwprintf(tstr, TranslateT("Do you want to cancel your friendship with '%s'?"), tname); - if (MessageBox(0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) { + if (MessageBox(nullptr, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) { ptrA id(getStringA(hContact, FACEBOOK_KEY_ID)); if (id == NULL) @@ -880,12 +880,12 @@ MCONTACT FacebookProto::HContactFromAuthEvent(MEVENT hEvent) } void FacebookProto::OpenUrlThread(void *p) { - if (p == NULL) + if (p == nullptr) return; open_url *data = static_cast<open_url*>(p); - ShellExecute(NULL, L"open", data->browser, data->url, NULL, SW_SHOWDEFAULT); + ShellExecute(nullptr, L"open", data->browser, data->url, nullptr, SW_SHOWDEFAULT); delete data; } @@ -936,7 +936,7 @@ void FacebookProto::OpenUrl(std::string url) void FacebookProto::ReadNotificationWorker(void *p) { - if (p == NULL) + if (p == nullptr) return; std::string *id = (std::string*)p; @@ -964,7 +964,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa { // Get the plugin data (we need the Popup service to do it) popup_data *data = (popup_data *)PUGetPluginData(hwnd); - if (data != NULL) { + if (data != nullptr) { if (!data->notification_id.empty()) data->proto->ForkThread(&FacebookProto::ReadNotificationWorker, new std::string(data->notification_id)); diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index 2391114df0..f1a093b46b 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -68,7 +68,7 @@ HANDLE GetIconHandle(const char* name) if (mir_strcmp(icons[i].szName, name) == 0)
return icons[i].hIcolib;
- return 0;
+ return nullptr;
}
// Helper functions
@@ -76,13 +76,13 @@ static FacebookProto * GetInstanceByHContact(MCONTACT hContact) {
char *proto = GetContactProto(hContact);
if (!proto)
- return 0;
+ return nullptr;
for (int i = 0; i < g_Instances.getCount(); i++)
if (!mir_strcmp(proto, g_Instances[i].m_szModuleName))
return &g_Instances[i];
- return 0;
+ return nullptr;
}
template<INT_PTR(__cdecl FacebookProto::*Fcn)(WPARAM, LPARAM)>
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 24ac5b6e68..975d3720b4 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -58,7 +58,7 @@ void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts)
{
- *avatarurl = *avatarts = NULL;
+ *avatarurl = *avatarts = nullptr;
char szUrl[128];
mir_snprintf(szUrl, "http://api.gadu-gadu.pl/avatars/%d/0.xml", uin);
@@ -69,7 +69,7 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_REDIRECT;
NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
- if (resp == NULL) {
+ if (resp == nullptr) {
debugLogA("getAvatarFileInfo(): No response from HTTP request");
return false;
}
@@ -84,18 +84,18 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) //if this url returned xml data (before and after 11.2013 gg convention)
wchar_t *xmlAction = mir_a2u(resp->pData);
- HXML hXml = xmlParseString(xmlAction, 0, L"result");
- if (hXml != NULL) {
+ HXML hXml = xmlParseString(xmlAction, nullptr, L"result");
+ if (hXml != nullptr) {
HXML node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar", 0);
- const wchar_t *blank = (node != NULL) ? xmlGetAttrValue(node, L"blank") : NULL;
- if (blank != NULL && mir_wstrcmp(blank, L"1")) {
+ const wchar_t *blank = (node != nullptr) ? xmlGetAttrValue(node, L"blank") : nullptr;
+ if (blank != nullptr && mir_wstrcmp(blank, L"1")) {
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/timestamp", 0);
- *avatarts = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
+ *avatarts = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/bigavatar", 0); //new gg convention
- if (node == NULL){
+ if (node == nullptr){
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/originBigAvatar", 0); //old gg convention
}
- *avatarurl = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
+ *avatarurl = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
}
xmlDestroyNode(hXml);
}
@@ -133,8 +133,8 @@ char *gg_avatarhash(char *param) {
char *result;
- if (param == NULL || (result = (char *)mir_alloc(MIR_SHA1_HASH_SIZE * 2 + 1)) == NULL)
- return NULL;
+ if (param == nullptr || (result = (char *)mir_alloc(MIR_SHA1_HASH_SIZE * 2 + 1)) == nullptr)
+ return nullptr;
BYTE digest[MIR_SHA1_HASH_SIZE];
mir_sha1_hash((BYTE*)param, (int)mir_strlen(param), digest);
@@ -168,7 +168,7 @@ void GGPROTO::requestAvatarInfo(MCONTACT hContact, int iWaitFor) if (!getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS))
return;
- GGREQUESTAVATARDATA *data = NULL;
+ GGREQUESTAVATARDATA *data = nullptr;
gg_EnterCriticalSection(&avatar_mutex, "requestAvatarInfo", 2, "avatar_mutex", 1);
if (avatar_requests.getIndex((GGREQUESTAVATARDATA*)&hContact) == -1) {
data = (GGREQUESTAVATARDATA*)mir_alloc(sizeof(GGREQUESTAVATARDATA));
@@ -178,7 +178,7 @@ void GGPROTO::requestAvatarInfo(MCONTACT hContact, int iWaitFor) }
gg_LeaveCriticalSection(&avatar_mutex, "requestAvatarInfo", 2, 1, "avatar_mutex", 1);
- if (data != NULL)
+ if (data != nullptr)
setByte(hContact, GG_KEY_AVATARREQUESTED, 1);
}
@@ -202,14 +202,14 @@ void __cdecl GGPROTO::avatarrequestthread(void*) char *AvatarURL, *AvatarTs;
if (!getAvatarFileInfo(uin, &AvatarURL, &AvatarTs)) {
if (iWaitFor)
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, nullptr, 0);
}
else {
- if (AvatarURL == NULL && AvatarTs == NULL){
+ if (AvatarURL == nullptr && AvatarTs == nullptr){
delSetting(hContact, GG_KEY_AVATARURL);
delSetting(hContact, GG_KEY_AVATARTS);
if (iWaitFor)
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, nullptr, 0);
}
else {
setString(hContact, GG_KEY_AVATARURL, AvatarURL);
@@ -221,11 +221,11 @@ void __cdecl GGPROTO::avatarrequestthread(void*) ai.hContact = hContact;
INT_PTR res = getavatarinfo((WPARAM)GAIF_FORCE, (LPARAM)&ai);
if (res == GAIR_NOAVATAR)
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, nullptr, 0);
else if (res == GAIR_SUCCESS)
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
- else ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, 0, 0);
+ else ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
delSetting(hContact, GG_KEY_AVATARREQUESTED);
}
}
@@ -314,7 +314,7 @@ void GGPROTO::initavatarrequestthread() #ifdef DEBUGMODE
debugLogA("initavatarrequestthread(): ForkThreadEx 1 GGPROTO::avatarrequestthread");
#endif
- pth_avatar.hThread = ForkThreadEx(&GGPROTO::avatarrequestthread, NULL, &pth_avatar.dwThreadId);
+ pth_avatar.hThread = ForkThreadEx(&GGPROTO::avatarrequestthread, nullptr, &pth_avatar.dwThreadId);
}
}
@@ -324,7 +324,7 @@ void __cdecl GGPROTO::getOwnAvatarThread(void*) char *AvatarURL, *AvatarTs;
if (getAvatarFileInfo(getDword(GG_KEY_UIN, 0), &AvatarURL, &AvatarTs)) {
- if (AvatarURL != NULL && AvatarTs != NULL) {
+ if (AvatarURL != nullptr && AvatarTs != nullptr) {
setString(GG_KEY_AVATARURL, AvatarURL);
setString(GG_KEY_AVATARTS, AvatarTs);
mir_free(AvatarURL); mir_free(AvatarTs);
@@ -348,7 +348,7 @@ void GGPROTO::getOwnAvatar() #ifdef DEBUGMODE
debugLogA("getOwnAvatar(): ForkThread 2 GGPROTO::getOwnAvatarThread");
#endif
- ForkThread(&GGPROTO::getOwnAvatarThread, NULL);
+ ForkThread(&GGPROTO::getOwnAvatarThread, nullptr);
}
}
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 0fb92afbe2..a9048fe0c8 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -43,7 +43,7 @@ int GGPROTO::isonline() int isonline;
gg_EnterCriticalSection(&sess_mutex, "isonline", 76, "sess_mutex", 1);
- isonline = (sess != NULL);
+ isonline = (sess != nullptr);
gg_LeaveCriticalSection(&sess_mutex, "isonline", 76, 1, "sess_mutex", 1);
return isonline;
@@ -58,7 +58,7 @@ void GGPROTO::disconnect() if (isonline())
{
// Fetch proper status msg
- char *szMsg = NULL;
+ char *szMsg = nullptr;
// Loadup status
if (getByte(GG_KEY_LEAVESTATUSMSG, GG_KEYDEF_LEAVESTATUSMSG))
@@ -184,8 +184,8 @@ typedef struct int gg_decodehosts(char *var, GGHOST *hosts, int max)
{
int hp = 0;
- char *hostname = NULL;
- char *portname = NULL;
+ char *hostname = nullptr;
+ char *portname = nullptr;
while(var && *var && hp < max)
{
@@ -212,8 +212,8 @@ int gg_decodehosts(char *var, GGHOST *hosts, int max) hp ++;
// Zero the names
- hostname = NULL;
- portname = NULL;
+ hostname = nullptr;
+ portname = nullptr;
}
else
var ++;
@@ -294,7 +294,7 @@ void __cdecl GGPROTO::mainthread(void *) gg_proxy_username = nlus.szProxyAuthUser;
gg_proxy_password = nlus.szProxyAuthPassword;
}
- else gg_proxy_username = gg_proxy_password = NULL;
+ else gg_proxy_username = gg_proxy_password = nullptr;
}
else {
debugLogA("mainthread() (%x): Failed loading proxy settings.", this);
@@ -344,7 +344,7 @@ void __cdecl GGPROTO::mainthread(void *) ////////////////////////////// DCC STARTUP /////////////////////////////
// Uin is ok so startup dcc if not started already
if (!dcc) {
- hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
dccstart();
// Wait for DCC
@@ -352,7 +352,7 @@ void __cdecl GGPROTO::mainthread(void *) debugLogA("mainthread() (%x): Waiting DCC service to start...", this);
#endif
while (WaitForSingleObjectEx(hEvent, INFINITE, TRUE) != WAIT_OBJECT_0);
- CloseHandle(hEvent); hEvent = NULL;
+ CloseHandle(hEvent); hEvent = nullptr;
}
// Check if dcc is running and setup forwarding port
@@ -379,7 +379,7 @@ retry: gg_EnterCriticalSection(&modemsg_mutex, "mainthread", 13, "modemsg_mutex", 1);
p.status_descr = mir_utf8encodeW(getstatusmsg(m_iDesiredStatus));
- p.status = status_m2gg(m_iDesiredStatus, p.status_descr != NULL);
+ p.status = status_m2gg(m_iDesiredStatus, p.status_descr != nullptr);
debugLogW(L"mainthread() (%x): Connecting with number %d, status %d and description \"%s\".", this, p.uin, m_iDesiredStatus,
p.status_descr ? getstatusmsg(m_iDesiredStatus) : L"<none>");
@@ -414,7 +414,7 @@ retry: // Check if connection attempt wasn't cancelled by the user
if (m_iDesiredStatus != ID_STATUS_OFFLINE)
{
- wchar_t error[128], *perror = NULL;
+ wchar_t error[128], *perror = nullptr;
// Lookup for error desciption
if (errno == EACCES) {
for (int i = 0; reason[i].type; i++) if (reason[i].type == gg_failno) {
@@ -438,13 +438,13 @@ retry: DWORD dwInterval = getDword(GG_KEY_RECONNINTERVAL, GG_KEYDEF_RECONNINTERVAL), dwResult;
BOOL bRetry = TRUE;
- hConnStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ hConnStopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
dwResult = WaitForSingleObjectEx(hConnStopEvent, dwInterval, TRUE);
if ((dwResult == WAIT_OBJECT_0 && m_iDesiredStatus == ID_STATUS_OFFLINE)
|| (dwResult == WAIT_IO_COMPLETION && Miranda_IsTerminated()))
bRetry = FALSE;
CloseHandle(hConnStopEvent);
- hConnStopEvent = NULL;
+ hConnStopEvent = nullptr;
// Reconnect to the next server on the list
if (bRetry)
@@ -466,7 +466,7 @@ retry: else
{
// Successfully connected
- logonTime = time(NULL);
+ logonTime = time(nullptr);
setDword(GG_KEY_LOGONTIME, logonTime);
gg_EnterCriticalSection(&sess_mutex, "mainthread", 15, "sess_mutex", 1);
sess = local_sess;
@@ -510,7 +510,7 @@ retry: debugLogA("mainthread() (%x): Connection closed.", this);
gg_EnterCriticalSection(&sess_mutex, "mainthread", 16, "sess_mutex", 1);
gg_free_session(sess);
- sess = NULL;
+ sess = nullptr;
gg_LeaveCriticalSection(&sess_mutex, "mainthread", 16, 1, "sess_mutex", 1);
break;
}
@@ -533,7 +533,7 @@ retry: case GG_EVENT_DISCONNECT:
gg_EnterCriticalSection(&sess_mutex, "mainthread", 17, "sess_mutex", 1);
gg_free_session(sess);
- sess = NULL;
+ sess = nullptr;
gg_LeaveCriticalSection(&sess_mutex, "mainthread", 17, 1, "sess_mutex", 1);
break;
@@ -547,7 +547,7 @@ retry: case GG_EVENT_ACK:
if (e->event.ack.seq && e->event.ack.recipient)
{
- ProtoBroadcastAck(getcontact((DWORD)e->event.ack.recipient, 0, 0, NULL),
+ ProtoBroadcastAck(getcontact((DWORD)e->event.ack.recipient, 0, 0, nullptr),
ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)e->event.ack.seq, 0);
}
break;
@@ -562,7 +562,7 @@ retry: for (; n->uin; n++)
{
- wchar_t *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeW(e->event.notify_descr.descr) : NULL;
+ wchar_t *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeW(e->event.notify_descr.descr) : nullptr;
changecontactstatus(n->uin, n->status, descrT, 0, n->remote_ip, n->remote_port, n->version);
if (descrT) mir_free(descrT);
}
@@ -580,7 +580,7 @@ retry: e->event.notify60[i].time, e->event.notify60[i].remote_ip, e->event.notify60[i].remote_port,
e->event.notify60[i].version);
mir_free(descrT);
- requestAvatarInfo(getcontact(e->event.notify60[i].uin, 0, 0, NULL), 0);
+ requestAvatarInfo(getcontact(e->event.notify60[i].uin, 0, 0, nullptr), 0);
}
break;
}
@@ -628,7 +628,7 @@ retry: const char *__status = gg_pubdir50_get(res, i, GG_PUBDIR50_STATUS);
uin_t uin = __fmnumber ? atoi(__fmnumber) : 0;
- MCONTACT hContact = (res->seq == GG_SEQ_CHINFO) ? NULL : getcontact(uin, 0, 0, NULL);
+ MCONTACT hContact = (res->seq == GG_SEQ_CHINFO) ? NULL : getcontact(uin, 0, 0, nullptr);
debugLogA("mainthread() (%x): Search result for uin %d, seq %d.", this, uin, res->seq);
if (res->seq == GG_SEQ_SEARCH)
{
@@ -641,7 +641,7 @@ retry: mir_wstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_wstrlen(strFmt2));
}
if (__birthyear) {
- time_t t = time(NULL);
+ time_t t = time(nullptr);
struct tm *lt = localtime(&t);
int br = atoi(__birthyear);
@@ -704,7 +704,7 @@ retry: if (__birthyear)
{
- time_t t = time(NULL);
+ time_t t = time(nullptr);
struct tm *lt = localtime(&t);
int br = atoi(__birthyear);
if (br > 0)
@@ -766,7 +766,7 @@ retry: // Status (version >= 6.0)
case GG_EVENT_STATUS60:
{
- MCONTACT hContact = getcontact(e->event.status60.uin, 0, 0, NULL);
+ MCONTACT hContact = getcontact(e->event.status60.uin, 0, 0, nullptr);
int oldstatus = getWord(hContact, GG_KEY_STATUS, (WORD)ID_STATUS_OFFLINE);
uin_t uin = (uin_t)getDword(GG_KEY_UIN, 0);
@@ -796,15 +796,15 @@ retry: case GG_USERLIST_GET_REPLY:
if (e->event.userlist.reply) {
parsecontacts(e->event.userlist.reply);
- MessageBox(NULL, TranslateT("List import successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("List import successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
break;
case GG_USERLIST_PUT_REPLY:
if (is_list_remove)
- MessageBox(NULL, TranslateT("List remove successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("List remove successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
else
- MessageBox(NULL, TranslateT("List export successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("List export successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
break;
}
break;
@@ -829,11 +829,11 @@ retry: UIN2IDT(e->event.msg.sender, id);
GCEVENT gce = { m_szModuleName, chat, GC_EVENT_MESSAGE };
- time_t t = time(NULL);
+ time_t t = time(nullptr);
gce.ptszUID = id;
wchar_t* messageT = mir_utf8decodeW(e->event.msg.message);
gce.ptszText = messageT;
- gce.ptszNick = (wchar_t*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, NULL), 0);
+ gce.ptszNick = (wchar_t*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, nullptr), 0);
gce.time = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"mainthread() (%x): Conference message to room %s & id %s.", this, chat, id);
@@ -845,16 +845,16 @@ retry: 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(NULL);
+ time_t t = time(nullptr);
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, NULL), &pre);
+ ProtoChainRecvMsg( getcontact(e->event.msg.sender, 1, 0, nullptr), &pre);
}
// RichEdit format included (image)
if (e->event.msg.formats_length &&
getByte(GG_KEY_IMGRECEIVE, GG_KEYDEF_IMGRECEIVE) &&
- !(db_get_dw(getcontact(e->event.msg.sender, 1, 0, NULL), "Ignore", "Mask1", 0) & IGNOREEVENT_MESSAGE))
+ !(db_get_dw(getcontact(e->event.msg.sender, 1, 0, nullptr), "Ignore", "Mask1", 0) & IGNOREEVENT_MESSAGE))
{
char *formats = (char*)e->event.msg.formats;
int len = 0, formats_len = e->event.msg.formats_length, add_ptr;
@@ -921,7 +921,7 @@ retry: dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)mir_strlen(e->event.multilogon_msg.message) + 1;
dbei.pBlob = (PBYTE)e->event.multilogon_msg.message;
- db_event_add( getcontact(e->event.multilogon_msg.sender, 1, 0, NULL), &dbei);
+ db_event_add( getcontact(e->event.multilogon_msg.sender, 1, 0, nullptr), &dbei);
}
break;
@@ -929,7 +929,7 @@ retry: case GG_EVENT_MULTILOGON_INFO:
{
list_t l;
- int* iIndexes = NULL, i;
+ int* iIndexes = nullptr, i;
debugLogA("mainthread(): Concurrent sessions count: %d.", e->event.multilogon_info.count);
if (e->event.multilogon_info.count > 0)
iIndexes = (int*)mir_calloc(e->event.multilogon_info.count * sizeof(int));
@@ -949,7 +949,7 @@ retry: mir_free(msess);
}
list_destroy(sessions, 0);
- sessions = NULL;
+ sessions = nullptr;
for (i = 0; i < e->event.multilogon_info.count; i++)
{
gg_multilogon_session* msess = (gg_multilogon_session*)mir_alloc(sizeof(struct gg_multilogon_session));
@@ -963,7 +963,7 @@ retry: sessions_updatedlg();
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
{
- const wchar_t* szText = time(NULL) - logonTime > 3
+ const wchar_t* szText = time(nullptr) - 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++)
@@ -987,8 +987,8 @@ retry: // Get rid of empty image
if (e->event.image_reply.size && e->event.image_reply.image)
{
- MCONTACT hContact = getcontact(e->event.image_reply.sender, 1, 0, NULL);
- void *img = (void *)img_loadpicture(e, 0);
+ MCONTACT hContact = getcontact(e->event.image_reply.sender, 1, 0, nullptr);
+ void *img = (void *)img_loadpicture(e, nullptr);
if (!img)
break;
@@ -1030,12 +1030,12 @@ retry: {
struct gg_dcc7 *dcc7 = e->event.dcc7_new;
debugLogA("mainthread() (%x): Incoming direct connection.", this);
- dcc7->contact = (void*)getcontact(dcc7->peer_uin, 0, 0, NULL);
+ dcc7->contact = (void*)getcontact(dcc7->peer_uin, 0, 0, nullptr);
// Check if user is on the list and if it is my uin
if (!dcc7->contact || getDword(GG_KEY_UIN, -1) != dcc7->uin) {
gg_dcc7_free(dcc7);
- e->event.dcc7_new = NULL;
+ e->event.dcc7_new = nullptr;
break;
}
@@ -1055,14 +1055,14 @@ retry: PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = filenameT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)dcc7;
ProtoChainRecvFile((UINT_PTR)dcc7->contact, &pre);
mir_free(filenameT);
- e->event.dcc7_new = NULL;
+ e->event.dcc7_new = nullptr;
}
break;
@@ -1149,26 +1149,26 @@ retry: xmlAction = mir_a2u(e->event.xml_action.data);
tag = mir_a2u("events");
- hXml = xmlParseString(xmlAction, 0, tag);
+ hXml = xmlParseString(xmlAction, nullptr, tag);
- if (hXml != NULL) {
+ if (hXml != nullptr) {
HXML node;
char *type, *sender;
mir_free(tag);
tag = mir_a2u("event/type");
node = xmlGetChildByPath(hXml, tag, 0);
- type = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
+ type = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
mir_free(tag);
tag = mir_a2u("event/sender");
node = xmlGetChildByPath(hXml, tag, 0);
- sender = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
- debugLogA("mainthread() (%x): XML Action type: %s.", this, type != NULL ? type : "unknown");
+ sender = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
+ debugLogA("mainthread() (%x): XML Action type: %s.", this, type != nullptr ? type : "unknown");
// Avatar change notify
- if (type != NULL && !mir_strcmp(type, "28")) {
+ if (type != nullptr && !mir_strcmp(type, "28")) {
debugLogA("mainthread() (%x): Client %s changed his avatar.", this, sender);
- requestAvatarInfo(getcontact(atoi(sender), 0, 0, NULL), 0);
+ requestAvatarInfo(getcontact(atoi(sender), 0, 0, nullptr), 0);
}
mir_free(type);
mir_free(sender);
@@ -1181,7 +1181,7 @@ retry: case GG_EVENT_TYPING_NOTIFICATION:
{
- MCONTACT hContact = getcontact(e->event.typing_notification.uin, 0, 0, NULL);
+ MCONTACT hContact = getcontact(e->event.typing_notification.uin, 0, 0, nullptr);
#ifdef DEBUGMODE
debugLogA("mainthread() (%x): Typing notification from %d (%d).", this,
e->event.typing_notification.uin, e->event.typing_notification.length);
@@ -1224,7 +1224,7 @@ retry: mir_free(msess);
}
list_destroy(sessions, 0);
- sessions = NULL;
+ sessions = nullptr;
gg_LeaveCriticalSection(&sessions_mutex, "mainthread", 23, 1, "sessions_mutex", 1);
}
@@ -1310,7 +1310,7 @@ static wchar_t* sttSettingToTchar( DBVARIANT* value ) case DBVT_WCHAR:
return mir_wstrdup(value->pwszVal);
}
- return NULL;
+ return nullptr;
}
int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam)
@@ -1336,7 +1336,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) if (gc_enabled && !strcmp(cws->szModule, m_szModuleName) && !strcmp(cws->szSetting, GG_KEY_NICK)){
wchar_t* ptszVal = sttSettingToTchar(&(cws->value));
- if(ptszVal==NULL) return 0;
+ if(ptszVal==nullptr) return 0;
// Groupchat window contact is being renamed
DBVARIANT dbv;
@@ -1366,7 +1366,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) // If name changed... change nick
if (!strcmp(cws->szSetting, "MyHandle")){
wchar_t* ptszVal = sttSettingToTchar(&(cws->value));
- if(ptszVal==NULL) return 0;
+ if(ptszVal==nullptr) return 0;
setWString(hContact, GG_KEY_NICK, ptszVal);
mir_free(ptszVal);
}
@@ -1471,7 +1471,7 @@ void GGPROTO::notifyall() if (count == 0) {
if (isonline()) {
gg_EnterCriticalSection(&sess_mutex, "notifyall", 29, "sess_mutex", 1);
- gg_notify_ex(sess, NULL, NULL, 0);
+ gg_notify_ex(sess, nullptr, nullptr, 0);
gg_LeaveCriticalSection(&sess_mutex, "notifyall", 29, 1, "sess_mutex", 1);
}
return;
@@ -1583,7 +1583,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) gg_EnterCriticalSection(&modemsg_mutex, "getcontact", 33, "modemsg_mutex", 1);
wchar_t *szMsg = mir_wstrdup(getstatusmsg(m_iStatus));
gg_LeaveCriticalSection(&modemsg_mutex, "getcontact", 33, 1, "modemsg_mutex", 1);
- changecontactstatus(uin, status_m2gg(m_iStatus, szMsg != NULL), szMsg, 0, 0, 0, 0);
+ changecontactstatus(uin, status_m2gg(m_iStatus, szMsg != nullptr), szMsg, 0, 0, 0, 0);
mir_free(szMsg);
}
}
@@ -1680,7 +1680,7 @@ void GGPROTO::changecontactstatus(uin_t uin, int status, const wchar_t *idescr, #ifdef DEBUGMODE
debugLogA("changecontactstatus(): uin=%d status=%d", uin, status);
#endif
- MCONTACT hContact = getcontact(uin, 0, 0, NULL);
+ MCONTACT hContact = getcontact(uin, 0, 0, nullptr);
// Check if contact is on list
if (!hContact) return;
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 1abf79e361..ad35aeb2de 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -39,12 +39,12 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule { DBVARIANT dbv = {0}; wchar_t str[256]; - wchar_t *ptstr = NULL; - wchar_t* valT = NULL; + wchar_t *ptstr = nullptr; + wchar_t* valT = nullptr; int unspecified = 0; dbv.type = DBVT_DELETED; - if (szModule == NULL) unspecified = 1; + if (szModule == nullptr) unspecified = 1; else unspecified = db_get(hContact, szModule, szSetting, &dbv); if (!unspecified) { switch (dbv.type) { @@ -75,7 +75,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule case DBVT_WORD: if (special == SVS_COUNTRY) { char* pstr = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, dbv.wVal, 0); - if (pstr == NULL){ + if (pstr == nullptr){ unspecified = 1; } else { ptstr = str; @@ -93,7 +93,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule struct in_addr ia; ia.S_un.S_addr = htonl(dbv.dVal); char* pstr = inet_ntoa(ia); - if (pstr == NULL){ + if (pstr == nullptr){ unspecified = 1; } else { ptstr = str; @@ -309,9 +309,9 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, uin = atoi(email); GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, _countof(email)); if (!mir_strlen(email)) - MessageBox(NULL, TranslateT("You need to specify your registration e-mail first."), + MessageBox(nullptr, TranslateT("You need to specify your registration e-mail first."), gg->m_tszUserName, MB_OK | MB_ICONEXCLAMATION); - else if (MessageBox(NULL, + else if (MessageBox(nullptr, TranslateT("Your password will be sent to your registration e-mail.\nDo you want to continue?"), gg->m_tszUserName, MB_OKCANCEL | MB_ICONQUESTION) == IDOK) @@ -323,7 +323,7 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, if (gg->isonline()) { if (MessageBox( - NULL, + nullptr, TranslateT("You should disconnect before making any permanent changes with your account.\nDo you want to disconnect now?"), gg->m_tszUserName, MB_OKCANCEL | MB_ICONEXCLAMATION) == IDCANCEL) @@ -705,14 +705,14 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, // Show updated message if (dat->updating) { - MessageBox(NULL, TranslateT("Your details has been uploaded to the public directory."), + MessageBox(nullptr, TranslateT("Your details has been uploaded to the public directory."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION); dat->updating = FALSE; break; } char *szProto = (hContact == NULL) ? gg->m_szModuleName : GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) break; // Disable when updating @@ -790,7 +790,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, if (!gg->isonline()) { - MessageBox(NULL, + MessageBox(nullptr, TranslateT("You have to be logged in before you can change your details."), gg->m_tszUserName, MB_OK | MB_ICONSTOP); break; @@ -799,7 +799,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_SAVE), FALSE); gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_WRITE); - if (req == NULL) + if (req == nullptr) break; GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text)); @@ -910,7 +910,7 @@ int GGPROTO::details_init(WPARAM wParam, LPARAM lParam) } else { // Other user details char* szProto = GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) return 0; if (mir_strcmp(szProto, m_szModuleName) || isChatRoom(hContact)) return 0; diff --git a/protocols/Gadu-Gadu/src/dynstuff.cpp b/protocols/Gadu-Gadu/src/dynstuff.cpp index 9c9656da84..275a273aff 100644 --- a/protocols/Gadu-Gadu/src/dynstuff.cpp +++ b/protocols/Gadu-Gadu/src/dynstuff.cpp @@ -42,13 +42,13 @@ void *list_add_sorted(list_t *list, void *data, int alloc_size, int (*comparisio {
if (!list) {
errno = EFAULT;
- return NULL;
+ return nullptr;
}
list_t newlist = (list_t)malloc(sizeof(struct list));
newlist->data = data;
- newlist->next = NULL;
+ newlist->next = nullptr;
if (alloc_size) {
newlist->data = malloc(alloc_size);
@@ -64,7 +64,7 @@ void *list_add_sorted(list_t *list, void *data, int alloc_size, int (*comparisio tmp = tmp->next;
tmp->next = newlist;
} else {
- list_t prev = NULL;
+ list_t prev = nullptr;
while (comparision(newlist->data, tmp->data) > 0) {
prev = tmp;
@@ -94,7 +94,7 @@ void *list_add_sorted(list_t *list, void *data, int alloc_size, int (*comparisio */
void *list_add(list_t *list, void *data, int alloc_size)
{
- return list_add_sorted(list, data, alloc_size, NULL);
+ return list_add_sorted(list, data, alloc_size, nullptr);
}
/*
@@ -108,7 +108,7 @@ void *list_add(list_t *list, void *data, int alloc_size) */
int list_remove(list_t *list, void *data, int free_data)
{
- list_t tmp, last = NULL;
+ list_t tmp, last = nullptr;
if (!list || !*list) {
errno = EFAULT;
@@ -350,10 +350,10 @@ void string_clear(string_t s) */
char *string_free(string_t s, int free_string)
{
- char *tmp = NULL;
+ char *tmp = nullptr;
if (!s)
- return NULL;
+ return nullptr;
if (free_string)
free(s->str);
@@ -411,7 +411,7 @@ const char *ditoa(long int i) char **array_make(const char *string, const char *sep, int max, int trim, int quotes)
{
const char *p, *q;
- char **result = NULL;
+ char **result = nullptr;
int items = 0, last = 0;
if (!string || !sep)
@@ -419,7 +419,7 @@ char **array_make(const char *string, const char *sep, int max, int trim, int qu for (p = string; ; ) {
int len = 0;
- char *token = NULL;
+ char *token = nullptr;
if (max && items >= max - 1)
last = 1;
@@ -487,7 +487,7 @@ char **array_make(const char *string, const char *sep, int max, int trim, int qu result = (char**)realloc(result, (items + 2) * sizeof(char*));
result[items] = token;
- result[++items] = NULL;
+ result[++items] = nullptr;
if (!*p)
break;
@@ -532,7 +532,7 @@ void array_add(char ***array, char *string) int count = array_count(*array);
*array = (char**)realloc(*array, (count + 2) * sizeof(char*));
- (*array)[count + 1] = NULL;
+ (*array)[count + 1] = nullptr;
(*array)[count] = string;
}
@@ -552,7 +552,7 @@ char *array_join(char **array, const char *sep) if (!array)
return _strdup("");
- string_t s = string_init(NULL);
+ string_t s = string_init(nullptr);
for (int i = 0; array[i]; i++) {
if (i)
string_append(s, sep);
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 682e3656d0..4b9f547930 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -54,13 +54,13 @@ void GGPROTO::dccstart() #ifdef DEBUGMODE
debugLogA("dccstart(): ForkThreadEx 4 GGPROTO::dccmainthread");
#endif
- pth_dcc.hThread = ForkThreadEx(&GGPROTO::dccmainthread, NULL, &pth_dcc.dwThreadId);
+ pth_dcc.hThread = ForkThreadEx(&GGPROTO::dccmainthread, nullptr, &pth_dcc.dwThreadId);
}
void GGPROTO::dccconnect(uin_t uin)
{
struct gg_dcc *local_dcc;
- MCONTACT hContact = getcontact(uin, 0, 0, NULL);
+ MCONTACT hContact = getcontact(uin, 0, 0, nullptr);
DWORD ip, myuin; WORD port;
debugLogA("dccconnect(): Connecting to uin %d.", uin);
@@ -110,7 +110,7 @@ HANDLE ftfail(GGPROTO *gg, MCONTACT hContact) #ifdef DEBUGMODE
gg->debugLogA("ftfail(): Failing file transfer...");
#endif
- srand(time(NULL));
+ srand(time(nullptr));
ft->hProcess = (HANDLE)rand();
ft->hContact = hContact;
#ifdef DEBUGMODE
@@ -139,7 +139,7 @@ void __cdecl GGPROTO::dccmainthread(void*) char szFilename[MAX_PATH];
// Zero up lists
- watches = transfers = requests = l = NULL;
+ watches = transfers = requests = l = nullptr;
debugLogA("dccmainthread(): started. DCC Server Thread Starting");
@@ -206,7 +206,7 @@ void __cdecl GGPROTO::dccmainthread(void*) }
// Wait for data on selects
- ret = select(maxfd + 1, &rd, &wd, NULL, &tv);
+ ret = select(maxfd + 1, &rd, &wd, nullptr, &tv);
// Check for select error
if (ret == -1)
@@ -248,7 +248,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_dcc_socket_free(local_dcc);
// Check if it's main socket
- if (local_dcc == dcc) dcc = NULL;
+ if (local_dcc == dcc) dcc = nullptr;
continue;
} else {
gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
@@ -260,7 +260,7 @@ void __cdecl GGPROTO::dccmainthread(void*) // Client connected
case GG_EVENT_DCC_NEW:
list_add(&watches, e->event.dcc_new, 0);
- e->event.dcc_new = NULL;
+ e->event.dcc_new = nullptr;
break;
//
@@ -275,7 +275,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc->contact;
pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND);
- pfts.pszFiles = NULL;
+ pfts.pszFiles = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc->file_info.size;
@@ -305,7 +305,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc->contact;
pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND);
- pfts.pszFiles = NULL;
+ pfts.pszFiles = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc->file_info.size;
@@ -324,7 +324,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
}
// Free dcc
- gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = NULL;
+ gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr;
break;
// Client error
@@ -364,7 +364,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
}
// Free dcc
- gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = NULL;
+ gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr;
break;
// Need file acknowledgement
@@ -380,13 +380,13 @@ void __cdecl GGPROTO::dccmainthread(void*) // Add file recv request
{
// Make new ggtransfer struct
- local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, NULL);
+ local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, nullptr);
wchar_t* filenameT = mir_utf8decodeW((char*)dcc->file_info.filename);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = filenameT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)local_dcc;
@@ -403,13 +403,13 @@ void __cdecl GGPROTO::dccmainthread(void*) case GG_EVENT_DCC_CLIENT_ACCEPT:
debugLogA("dccmainthread(): Client: %d, Client accept.", local_dcc->peer_uin);
// Check if user is on the list and if it is my uin
- if (getcontact(local_dcc->peer_uin, 0, 0, NULL) &&
+ if (getcontact(local_dcc->peer_uin, 0, 0, nullptr) &&
getDword(GG_KEY_UIN, -1) == local_dcc->uin)
break;
// Kill unauthorized dcc
list_remove(&watches, dcc, 0);
- gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = NULL;
+ gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr;
break;
// Client connected as we wished to (callback)
@@ -454,7 +454,7 @@ void __cdecl GGPROTO::dccmainthread(void*) debugLogA("dccmainthread(): Unknown request to client %d.", local_dcc->peer_uin);
// Kill unauthorized dcc
list_remove(&watches, local_dcc, 0);
- gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = NULL;
+ gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr;
}
break;
}
@@ -503,7 +503,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc7->contact;
pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND);
- pfts.pszFiles = NULL;
+ pfts.pszFiles = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc7->size;
@@ -533,7 +533,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc7->contact;
pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND);
- pfts.pszFiles = NULL;
+ pfts.pszFiles = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc7->size;
@@ -625,7 +625,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_dcc_socket_free(local_dcc);
// Check if it's main socket
- if (local_dcc == dcc) dcc = NULL;
+ if (local_dcc == dcc) dcc = nullptr;
}
}
// Close all waiting for aknowledgle transfers
@@ -683,7 +683,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath) ProtoBroadcastAck((UINT_PTR)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0);
// Free transfer
gg_free_dcc(dcc);
- return 0;
+ return nullptr;
}
// Put an offset to the file
@@ -719,7 +719,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath) ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0);
// Free transfer
gg_dcc7_free(dcc7);
- return 0;
+ return nullptr;
}
// Open file for appending and check if ok
@@ -733,7 +733,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath) ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0);
// Free transfer
gg_dcc7_free(dcc7);
- return 0;
+ return nullptr;
}
// Put an offset to the file
@@ -855,7 +855,7 @@ HANDLE GGPROTO::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath) // Check if its proper dcc
struct gg_common *c = (struct gg_common *) hTransfer;
if (!c)
- return NULL;
+ return nullptr;
if (c->type == GG_SESSION_DCC7_GET)
return dcc7fileallow(hTransfer, szPath);
@@ -930,7 +930,7 @@ HANDLE GGPROTO::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFiles if ((ver & 0x00ffffff) >= 0x29 || !ver) {
gg_EnterCriticalSection(&sess_mutex, "SendFile", 46, "sess_mutex", 1);
- struct gg_dcc7 *dcc7 = gg_dcc7_send_file(sess, uin, filename, NULL, NULL);
+ struct gg_dcc7 *dcc7 = gg_dcc7_send_file(sess, uin, filename, nullptr, nullptr);
if (!dcc7) {
gg_LeaveCriticalSection(&sess_mutex, "SendFile", 46, 1, "sess_mutex", 1);
debugLogA("SendFile(): Failed to send file \"%s\".", filename);
@@ -967,7 +967,7 @@ HANDLE GGPROTO::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFiles }
// Try to connect if not ask user to connect me
- struct gg_dcc *dcc = NULL;
+ struct gg_dcc *dcc = nullptr;
if ((ip && port >= 10 && !(dcc = gg_dcc_send_file(ip, port, myuin, uin))) || (port < 10 && port > 0))
{
// Make fake dcc structure
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index cf2ec94613..9f343b52cd 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -47,8 +47,8 @@ int hLangpack; LIST<GGPROTO> g_Instances(1, PtrKeySortT);
// Event hooks
-static HANDLE hHookModulesLoaded = NULL;
-static HANDLE hHookPreShutdown = NULL;
+static HANDLE hHookModulesLoaded = nullptr;
+static HANDLE hHookPreShutdown = nullptr;
static unsigned long crc_table[256];
@@ -63,7 +63,7 @@ wchar_t* ws_strerror(int code) if (code == 0)
{
wchar_t buff[128];
- int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL);
+ int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, WSAGetLastError(), 0, buff, _countof(buff), nullptr);
if (len == 0)
mir_snwprintf(err_desc, L"WinSock %u: Unknown error.", WSAGetLastError());
else
@@ -83,7 +83,7 @@ char* as_strerror(int code) if (code == 0)
{
char buff[128];
- int len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL);
+ int len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, WSAGetLastError(), 0, buff, _countof(buff), nullptr);
if (len == 0)
mir_snprintf(err_desc, "WinSock %u: Unknown error.", WSAGetLastError());
else
@@ -216,14 +216,14 @@ static int gg_modulesloaded(WPARAM, LPARAM) static GGPROTO* gg_getprotoinstance(MCONTACT hContact)
{
char* szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
for (int i=0; i < g_Instances.getCount(); i++)
if (mir_strcmp(szProto, g_Instances[i]->m_szModuleName) == 0)
return g_Instances[i];
- return NULL;
+ return nullptr;
}
//////////////////////////////////////////////////////////
@@ -232,7 +232,7 @@ static GGPROTO* gg_getprotoinstance(MCONTACT hContact) static int gg_prebuildcontactmenu(WPARAM hContact, LPARAM)
{
GGPROTO* gg = gg_getprotoinstance(hContact);
- if (gg == NULL)
+ if (gg == nullptr)
return 0;
if (gg->getDword(hContact, GG_KEY_UIN, 0) == gg->getByte(GG_KEY_UIN, 0) || gg->isChatRoom(hContact) || db_get_b(hContact, "CList", "NotOnList", 0))
@@ -442,7 +442,7 @@ void gg_debughandler(int level, const char *format, va_list ap) memcpy(szText, prefix, PREFIXLEN);
mir_vsnprintf(szText + mir_strlen(szText), sizeof(szText) - mir_strlen(szText), szFormat, ap);
- Netlib_Log(NULL, szText);
+ Netlib_Log(nullptr, szText);
free(szFormat);
}
#endif
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 3fe2a9d605..d0ff63102f 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -254,14 +254,14 @@ void __cdecl GGPROTO::searchthread(void *) HANDLE GGPROTO::SearchBasic(const wchar_t *id)
{
if (!isonline())
- return 0;
+ return nullptr;
gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH);
if (!req) {
#ifdef DEBUGMODE
debugLogA("SearchBasic(): ForkThread 10 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
return (HANDLE)1;
}
@@ -275,7 +275,7 @@ HANDLE GGPROTO::SearchBasic(const wchar_t *id) #ifdef DEBUGMODE
debugLogA("SearchBasic(): ForkThread 11 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
return (HANDLE)1;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 2, "sess_mutex", 1);
@@ -292,17 +292,17 @@ HANDLE GGPROTO::SearchByName(const wchar_t *nick, const wchar_t *firstName, cons {
// Check if connected and if there's a search data
if (!isonline())
- return 0;
+ return nullptr;
if (!nick && !firstName && !lastName)
- return 0;
+ return nullptr;
gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH);
- if (req == NULL) {
+ if (req == nullptr) {
#ifdef DEBUGMODE
debugLogA("SearchByName(): ForkThread 12 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
return (HANDLE)1;
}
@@ -343,7 +343,7 @@ HANDLE GGPROTO::SearchByName(const wchar_t *nick, const wchar_t *firstName, cons #ifdef DEBUGMODE
debugLogA("SearchByName(): ForkThread 13 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
}
else
{
@@ -362,14 +362,14 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) {
// Check if connected
if (!isonline())
- return 0;
+ return nullptr;
gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH);
if (!req) {
#ifdef DEBUGMODE
debugLogA("SearchAdvanced(): ForkThread 14 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
return (HWND)1;
}
@@ -413,7 +413,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) if (mir_wstrlen(text)) {
int yearTo = _tstoi(text);
int yearFrom;
- time_t t = time(NULL);
+ time_t t = time(nullptr);
struct tm *lt = localtime(&t);
int ay = lt->tm_year + 1900;
char age[16];
@@ -459,7 +459,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) // No data entered
if (szQuery.GetLength() <= 7 || (szQuery.GetLength() == 8 && IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED))) {
gg_pubdir50_free(req);
- return 0;
+ return nullptr;
}
// Count crc & check if the data was equal if yes do same search with shift
@@ -479,7 +479,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) #ifdef DEBUGMODE
debugLogA("SearchAdvanced(): ForkThread 15 GGPROTO::searchthread");
#endif
- ForkThread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, nullptr);
return (HWND)1;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchAdvanced", 52, 2, "sess_mutex", 1);
@@ -663,7 +663,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg) else {
if (*msgPtr)
mir_free(*msgPtr);
- *msgPtr = newMsg && *newMsg ? mir_wstrdup(newMsg) : NULL;
+ *msgPtr = newMsg && *newMsg ? mir_wstrdup(newMsg) : nullptr;
#ifdef DEBUGMODE
debugLogA("SetAwayMsg(): Message changed.");
#endif
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index f916ee62fd..e88190e763 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -86,7 +86,7 @@ int GGPROTO::gc_destroy() GGGC *chat = (GGGC *)l->data;
free(chat->recipients);
}
- list_destroy(chats, 1); chats = NULL;
+ list_destroy(chats, 1); chats = nullptr;
return 1;
}
@@ -102,13 +102,13 @@ GGGC* GGPROTO::gc_lookup(const wchar_t *id) return chat;
}
- return NULL;
+ return nullptr;
}
int GGPROTO::gc_event(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK *)lParam;
- GGGC *chat = NULL;
+ GGGC *chat = nullptr;
uin_t uin;
// Check if we got our protocol, and fields are set
@@ -164,7 +164,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) while(lc >= 0 && (gch->ptszText[lc] == '\n' || gch->ptszText[lc] == '\r'))
gch->ptszText[lc --] = 0;
- gce.time = time(NULL);
+ gce.time = time(nullptr);
gce.bIsMe = 1;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"gc_event(): Sending conference message to room %s, \"%s\".", gch->ptszID, gch->ptszText);
@@ -182,7 +182,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) if (gch->iType == GC_USER_PRIVMESS)
{
MCONTACT hContact = NULL;
- if ((uin = _wtoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL)))
+ if ((uin = _wtoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, nullptr)))
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
}
debugLogW(L"gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->iType, chat, uin, gch->ptszText);
@@ -209,7 +209,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou uin_t uin;
debugLogA("gc_getchat(): Count %d.", recipients_count);
- if (!recipients) return NULL;
+ if (!recipients) return nullptr;
// Look for existing chat
for(l = chats; l; l = l->next)
@@ -240,7 +240,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou debugLogW(L"gc_getchat(): Ignoring existing id %s, size %d.", chat->id, chat->recipients_count);
else
debugLogW(L"gc_getchat(): Returning existing id %s, size %d.", chat->id, chat->recipients_count);
- return !(chat->ignore) ? chat->id : NULL;
+ return !(chat->ignore) ? chat->id : nullptr;
}
}
}
@@ -253,10 +253,10 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou // Check groupchat policy (new) / only for incoming
if (sender)
{
- int unknown = (getcontact(sender, 0, 0, NULL) == NULL),
+ int unknown = (getcontact(sender, 0, 0, nullptr) == NULL),
unknownSender = unknown;
for(int i = 0; i < recipients_count; i++)
- if (!getcontact(recipients[i], 0, 0, NULL))
+ if (!getcontact(recipients[i], 0, 0, nullptr))
unknown ++;
if ((getWord(GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT) == 2) ||
(getWord(GG_KEY_GC_POLICY_TOTAL, GG_KEYDEF_GC_POLICY_TOTAL) == 2 &&
@@ -271,11 +271,11 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou unknown >= getWord(GG_KEY_GC_COUNT_UNKNOWN, GG_KEYDEF_GC_COUNT_UNKNOWN))))
{
wchar_t *senderName = unknownSender ?
- TranslateT("Unknown") : pcli->pfnGetContactDisplayName(getcontact(sender, 0, 0, NULL), 0);
+ TranslateT("Unknown") : pcli->pfnGetContactDisplayName(getcontact(sender, 0, 0, nullptr), 0);
wchar_t error[256];
mir_snwprintf(error, TranslateT("%s has initiated conference with %d participants (%d unknowns).\nDo you want to participate?"),
senderName, recipients_count + 1, unknown);
- chat->ignore = MessageBox(NULL, error, m_tszUserName, MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK;
+ chat->ignore = MessageBox(nullptr, error, m_tszUserName, MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK;
}
if (chat->ignore)
{
@@ -288,7 +288,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou if (sender) chat->recipients[i] = sender;
debugLogW(L"gc_getchat(): Ignoring new chat %s, count %d.", chat->id, chat->recipients_count);
list_add(&chats, chat, 0);
- return NULL;
+ return nullptr;
}
}
@@ -297,12 +297,12 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou wchar_t *senderName;
if (sender)
{
- senderName = pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0);
+ senderName = pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, nullptr), 0);
mir_snwprintf(status, TranslateT("%s initiated the conference.") , senderName);
}
else
{
- senderName = NULL;
+ senderName = nullptr;
mir_snwprintf(status, TranslateT("This is my own conference."));
}
@@ -346,7 +346,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou // Add contacts
for(i = 0; i < chat->recipients_count; i++) {
- MCONTACT hContact = getcontact(chat->recipients[i], 1, 0, NULL);
+ MCONTACT hContact = getcontact(chat->recipients[i], 1, 0, nullptr);
UIN2IDT(chat->recipients[i], id);
if (hContact)
gce.ptszNick = pcli->pfnGetContactDisplayName(hContact, 0);
@@ -431,7 +431,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa // Check if connected
if (!gg->isonline())
{
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("You have to be connected to open new conference."),
gg->m_tszUserName, MB_OK | MB_ICONSTOP);
}
@@ -500,7 +500,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa uin = (uin_t)gg->getDword(hContact, GG_KEY_UIN, 0);
}
- if (szProto == NULL || mir_strcmp(szProto, gg->m_szModuleName) || !uin || uin == gg->getDword(GG_KEY_UIN, 0))
+ if (szProto == nullptr || mir_strcmp(szProto, gg->m_szModuleName) || !uin || uin == gg->getDword(GG_KEY_UIN, 0))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_DELETEITEM, (WPARAM)hItem, 0);
}
}
@@ -556,7 +556,7 @@ INT_PTR GGPROTO::gc_clearignored(WPARAM, LPARAM) cleared = TRUE;
}
}
- MessageBox( NULL,
+ MessageBox( nullptr,
cleared ?
TranslateT("All ignored conferences are now unignored and the conference policy will act again.") :
TranslateT("There are no ignored conferences."),
@@ -571,14 +571,14 @@ INT_PTR GGPROTO::gc_openconf(WPARAM, LPARAM) // Check if connected
if (!isonline())
{
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("You have to be connected to open new conference."),
m_tszUserName, MB_OK | MB_ICONSTOP
);
return 0;
}
- CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_CONFERENCE), NULL, gg_gc_openconfdlg, (LPARAM)this);
+ CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_CONFERENCE), nullptr, gg_gc_openconfdlg, (LPARAM)this);
return 1;
}
diff --git a/protocols/Gadu-Gadu/src/icolib.cpp b/protocols/Gadu-Gadu/src/icolib.cpp index 3a5d05451a..b4cf97f5bf 100644 --- a/protocols/Gadu-Gadu/src/icolib.cpp +++ b/protocols/Gadu-Gadu/src/icolib.cpp @@ -58,7 +58,8 @@ HANDLE GetIconHandle(int iconId) for(int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+
+ return nullptr;
}
void ReleaseIconEx(const char* name, bool big)
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 1c5b90f3df..0cfef60aed 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -159,7 +159,7 @@ int gg_img_paint(HWND hwnd, GGIMAGEENTRY *dat) if (dat->hBitmap)
{
- HDC hdcBmp = NULL;
+ HDC hdcBmp = nullptr;
int nWidth, nHeight;
BITMAP bmp;
@@ -224,10 +224,10 @@ wchar_t *gg_img_getfilter(wchar_t *szFilter, int nSize) // Make up filter
wcsncpy(pFilter, szFilterName, nSize);
pFilter += mir_wstrlen(pFilter) + 1;
- if (pFilter >= szFilter + nSize) return NULL;
+ if (pFilter >= szFilter + nSize) return nullptr;
wcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter));
pFilter += mir_wstrlen(pFilter) + 1;
- if (pFilter >= szFilter + nSize) return NULL;
+ if (pFilter >= szFilter + nSize) return nullptr;
*pFilter = 0;
return szFilter;
@@ -287,7 +287,7 @@ BOOL gg_img_fit(HWND hwndDlg) int rWidth = 0, rHeight = 0;
int oWidth = 0, oHeight = 0;
BITMAP bmp;
- GGIMAGEENTRY *img = NULL;
+ GGIMAGEENTRY *img = nullptr;
HDC hdc;
// Check if image is loaded
@@ -340,7 +340,7 @@ BOOL gg_img_fit(HWND hwndDlg) oHeight = dlgRect.bottom - dlgRect.top;
oWidth = wrkRect.right - wrkRect.left;
}
- SetWindowPos(hwndDlg, NULL,
+ SetWindowPos(hwndDlg, nullptr,
(wrkRect.left + wrkRect.right - oWidth) / 2,
(wrkRect.top + wrkRect.bottom - oHeight) / 2,
oWidth, oHeight,
@@ -434,7 +434,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_SIZE:
Utils_ResizeDialog(hwndDlg, hInstance, dat->bReceiving ? MAKEINTRESOURCEA(IDD_IMAGE_RECV) : MAKEINTRESOURCEA(IDD_IMAGE_SEND), sttImageDlgResizer);
if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED)
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
return 0;
case WM_SIZING:
@@ -536,7 +536,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->nImg > 1)
{
dat->nImg--;
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
}
return TRUE;
@@ -544,7 +544,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->nImg < dat->nImgTotal)
{
dat->nImg++;
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
}
return TRUE;
@@ -573,7 +573,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if ((-- dat->nImgTotal) == 0)
EndDialog(hwndDlg, 0);
else
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
gg_img_releasepicture(del);
}
@@ -603,8 +603,8 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->lpImages && gg->isonline())
{
uin_t uin = (uin_t)gg->getDword(dat->hContact, GG_KEY_UIN, 0);
- struct gg_msg_richtext_format *r = NULL;
- struct gg_msg_richtext_image *p = NULL;
+ struct gg_msg_richtext_format *r = nullptr;
+ struct gg_msg_richtext_image *p = nullptr;
int len;
((struct gg_msg_richtext*)format)->flag = 2;
@@ -654,7 +654,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
// Fit window to image
if (!gg_img_fit(hwndDlg))
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
return TRUE;
case WM_CHOOSEIMG:
@@ -677,13 +677,13 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
if (dat->lpImages)
gg_img_releasepicture(dat->lpImages);
- if (!(dat->lpImages = (GGIMAGEENTRY *)dat->gg->img_loadpicture(0, szFileName)))
+ if (!(dat->lpImages = (GGIMAGEENTRY *)dat->gg->img_loadpicture(nullptr, szFileName)))
{
EndDialog(hwndDlg, 0);
return FALSE;
}
if (!gg_img_fit(hwndDlg))
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
}
else
{
@@ -702,7 +702,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP //
void __cdecl GGPROTO::img_dlgcallthread(void *param)
{
- HWND hMIWnd = 0;
+ HWND hMIWnd = nullptr;
debugLogA("img_dlgcallthread(): started.");
GGIMAGEDLGDATA *dat = (GGIMAGEDLGDATA *)param;
@@ -722,7 +722,7 @@ GGIMAGEDLGDATA *gg_img_recvdlg(GGPROTO *gg, MCONTACT hContact) // Create dialog data
GGIMAGEDLGDATA *dat = (GGIMAGEDLGDATA *)calloc(1, sizeof(GGIMAGEDLGDATA));
dat->hContact = hContact;
- dat->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ dat->hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
dat->bReceiving = TRUE;
dat->gg = gg;
ResetEvent(dat->hEvent);
@@ -771,10 +771,10 @@ int gg_img_isexists(wchar_t *szPath, GGIMAGEENTRY *dat) //
wchar_t *gg_img_hasextension(wchar_t *filename)
{
- if (filename != NULL && *filename != '\0')
+ if (filename != nullptr && *filename != '\0')
{
wchar_t *imgtype = wcsrchr(filename, '.');
- if (imgtype != NULL)
+ if (imgtype != nullptr)
{
size_t len = mir_wstrlen(imgtype);
imgtype++;
@@ -787,7 +787,7 @@ wchar_t *gg_img_hasextension(wchar_t *filename) return --imgtype;
}
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -800,7 +800,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) size_t tPathLen;
int i, res;
- if (hImagesFolder == NULL || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, L"")) {
+ if (hImagesFolder == nullptr || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, L"")) {
wchar_t *tmpPath = Utils_ReplaceVarsW( L"%miranda_userdata%");
tPathLen = mir_snwprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName);
mir_free(tmpPath);
@@ -823,7 +823,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) }
mir_snwprintf(szPath + tPathLen, MAX_PATH - tPathLen, L"\\%s", dat->lpszFileName);
- if ((pImgext = gg_img_hasextension(szPath)) == NULL)
+ if ((pImgext = gg_img_hasextension(szPath)) == nullptr)
pImgext = szPath + mir_wstrlen(szPath);
wcsncpy_s(imgext, pImgext, _TRUNCATE);
for (i = 1; ; ++i)
@@ -853,7 +853,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) T2Utf szMessage(image_msg);
PROTORECVEVENT pre = {0};
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.szMessage = szMessage;
ProtoChainRecvMsg(hContact, &pre);
debugLogW(L"img_displayasmsg(): Image saved to %s.", szPath);
@@ -885,7 +885,7 @@ BOOL GGPROTO::img_opened(uin_t uin) int GGPROTO::img_display(MCONTACT hContact, void *img)
{
list_t l = imagedlgs;
- GGIMAGEDLGDATA *dat = NULL;
+ GGIMAGEDLGDATA *dat = nullptr;
if (!img) return FALSE;
@@ -899,7 +899,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img) l = l->next;
}
- if (!l) dat = NULL;
+ if (!l) dat = nullptr;
if (!dat)
{
@@ -908,7 +908,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img) while (WaitForSingleObjectEx(dat->hEvent, INFINITE, TRUE) != WAIT_OBJECT_0);
CloseHandle(dat->hEvent);
- dat->hEvent = NULL;
+ dat->hEvent = nullptr;
list_add(&imagedlgs, dat, 0);
}
@@ -917,7 +917,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img) SendMessage(dat->hWnd, WM_ADDIMAGE, 0, (LPARAM)img);
if (/*db_get_b(NULL, "Chat", "bFlashWindowHighlight", 0) != 0 && */
GetActiveWindow() != dat->hWnd && GetForegroundWindow() != dat->hWnd)
- SetTimer(dat->hWnd, TIMERID_FLASHWND, 900, NULL);
+ SetTimer(dat->hWnd, TIMERID_FLASHWND, 900, nullptr);
return TRUE;
}
@@ -927,7 +927,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img) //
const wchar_t *gg_img_guessfileextension(const char *lpData)
{
- if (lpData != NULL)
+ if (lpData != nullptr)
{
if (memcmp(lpData, "BM", 2) == 0)
return L".bmp";
@@ -948,11 +948,11 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) {
if (!szFileName &&
(!e || !e->event.image_reply.size || !e->event.image_reply.image || !e->event.image_reply.filename))
- return NULL;
+ return nullptr;
GGIMAGEENTRY *dat = (GGIMAGEENTRY *)calloc(1, sizeof(GGIMAGEENTRY));
- if (dat == NULL)
- return NULL;
+ if (dat == nullptr)
+ return nullptr;
// Copy the file name
if (szFileName)
@@ -964,7 +964,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) wchar_t error[512];
mir_snwprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
- return NULL;
+ return nullptr;
}
fseek(fp, 0, SEEK_END);
dat->nSize = ftell(fp);
@@ -973,7 +973,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) fclose(fp);
free(dat);
debugLogW(L"img_loadpicture(): Zero file size \"%s\" failed.", szFileName);
- return NULL;
+ return nullptr;
}
// Maximum acceptable image size
if (dat->nSize > 255 * 1024)
@@ -981,8 +981,8 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) fclose(fp);
free(dat);
debugLogW(L"img_loadpicture(): Image size of \"%s\" exceeds 255 KB.", szFileName);
- MessageBox(NULL, TranslateT("Image exceeds maximum allowed size of 255 KB."), m_tszUserName, MB_OK | MB_ICONEXCLAMATION);
- return NULL;
+ MessageBox(nullptr, TranslateT("Image exceeds maximum allowed size of 255 KB."), m_tszUserName, MB_OK | MB_ICONEXCLAMATION);
+ return nullptr;
}
fseek(fp, 0, SEEK_SET);
dat->lpData = (char*)malloc(dat->nSize);
@@ -992,7 +992,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) fclose(fp);
free(dat);
debugLogW(L"img_loadpicture(): Reading file \"%s\" failed.", szFileName);
- return NULL;
+ return nullptr;
}
fclose(fp);
dat->lpszFileName = wcsdup(szFileName);
@@ -1010,14 +1010,14 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) const wchar_t *szImgType = gg_img_guessfileextension(dat->lpData);
if (*szImgType) {
dat->lpszFileName = (wchar_t*)calloc(sizeof(wchar_t), mir_wstrlen(tmpFileName) + mir_wstrlen(szImgType) + 1);
- if (dat->lpszFileName != NULL) {
+ if (dat->lpszFileName != nullptr) {
mir_wstrcpy(dat->lpszFileName, tmpFileName);
mir_wstrcat(dat->lpszFileName, szImgType);
}
}
}
- if (dat->lpszFileName == NULL)
+ if (dat->lpszFileName == nullptr)
dat->lpszFileName = wcsdup( _A2T( e->event.image_reply.filename));
}
@@ -1048,7 +1048,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) free(dat->lpszFileName);
free(dat);
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////
@@ -1076,7 +1076,7 @@ INT_PTR GGPROTO::img_recvimage(WPARAM wParam, LPARAM lParam) //
int gg_img_remove(GGIMAGEDLGDATA *dat)
{
- GGIMAGEENTRY *temp = NULL, *img = NULL;
+ GGIMAGEENTRY *temp = nullptr, *img = nullptr;
GGPROTO *gg;
if (!dat) return FALSE;
@@ -1129,7 +1129,7 @@ GGIMAGEDLGDATA* gg_img_find(GGPROTO *gg, uin_t uin, uint32_t crc32) gg->gg_LeaveCriticalSection(&gg->img_mutex, "gg_img_find", 62, 2, "img_mutex", 1);
gg->debugLogA("gg_img_find(): Image not found on the list. It might be released before calling this function.");
- return NULL;
+ return nullptr;
}
@@ -1158,14 +1158,14 @@ BOOL GGPROTO::img_sendonrequest(gg_event* e) //
INT_PTR GGPROTO::img_sendimg(WPARAM hContact, LPARAM)
{
- GGIMAGEDLGDATA *dat = NULL;
+ GGIMAGEDLGDATA *dat = nullptr;
gg_EnterCriticalSection(&img_mutex, "img_sendimg", 64, "img_mutex", 1);
if (!dat)
{
dat = (GGIMAGEDLGDATA *)calloc(1, sizeof(GGIMAGEDLGDATA));
dat->hContact = hContact;
- dat->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ dat->hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
dat->gg = this;
ResetEvent(dat->hEvent);
@@ -1177,7 +1177,7 @@ INT_PTR GGPROTO::img_sendimg(WPARAM hContact, LPARAM) while (WaitForSingleObjectEx(dat->hEvent, INFINITE, TRUE) != WAIT_OBJECT_0);
CloseHandle(dat->hEvent);
- dat->hEvent = NULL;
+ dat->hEvent = nullptr;
list_add(&imagedlgs, dat, 0);
}
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index b2b686b4dc..d80dc75a35 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -22,7 +22,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
{
- string_t s = string_init(NULL);
+ string_t s = string_init(nullptr);
char *contacts;
// Readup contacts
@@ -125,7 +125,7 @@ char *strndup(char *str, int c) void GGPROTO::parsecontacts(char *contacts)
{
- char *p = strchr(contacts, ':'), *n = NULL;
+ char *p = strchr(contacts, ':'), *n = nullptr;
char *strFirstName, *strLastName, *strNickname, *strNick, *strPhone, *strGroup, *strUin, *strMail;
uin_t uin;
@@ -136,7 +136,7 @@ void GGPROTO::parsecontacts(char *contacts) while(p)
{
// Processing line
- strFirstName = strLastName = strNickname = strNick = strPhone = strGroup = strUin = strMail = NULL;
+ strFirstName = strLastName = strNickname = strNick = strPhone = strGroup = strUin = strMail = nullptr;
uin = 0;
// FirstName
@@ -205,7 +205,7 @@ void GGPROTO::parsecontacts(char *contacts) n = strchr(p, '\n');
p = (n + 1);
}
- if (!n) p = NULL;
+ if (!n) p = nullptr;
// Loadup contact
if (uin && strNick)
@@ -256,7 +256,7 @@ INT_PTR GGPROTO::import_server(WPARAM, LPARAM) // Check if connected
if (!isonline())
{
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("You have to be connected before you can import/export contacts from/to server."),
m_tszUserName, MB_OK | MB_ICONSTOP
);
@@ -274,12 +274,12 @@ INT_PTR GGPROTO::import_server(WPARAM, LPARAM) // Making contacts list
gg_EnterCriticalSection(&sess_mutex, "import_server", 65, "sess_mutex", 1);
- if (gg_userlist_request(sess, GG_USERLIST_GET, NULL) == -1)
+ if (gg_userlist_request(sess, GG_USERLIST_GET, nullptr) == -1)
{
wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 1, "sess_mutex", 1);
mir_snwprintf(error, TranslateT("List cannot be imported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"import_server(): Cannot import list. errno:%d: %s", errno, ws_strerror(errno));
}
gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 2, "sess_mutex", 1);
@@ -294,7 +294,7 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) {
// Check if connected
if (!isonline()) {
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("You have to be connected before you can import/export contacts from/to server."),
m_tszUserName, MB_OK | MB_ICONSTOP
);
@@ -312,12 +312,12 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) // Making contacts list
gg_EnterCriticalSection(&sess_mutex, "remove_server", 66, "sess_mutex", 1);
- if (gg_userlist_request(sess, GG_USERLIST_PUT, NULL) == -1)
+ if (gg_userlist_request(sess, GG_USERLIST_PUT, nullptr) == -1)
{
wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 1, "sess_mutex", 1);
mir_snwprintf(error, TranslateT("List cannot be removed because of error: %s (Error: %d)"), ws_strerror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"remove_server(): Cannot remove list. errno=%d: %s", errno, ws_strerror(errno));
}
gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 2, "sess_mutex", 1);
@@ -384,14 +384,14 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) parsecontacts(contacts);
mir_free(contacts);
- MessageBox(NULL, TranslateT("List import successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("List import successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
return 0;
}
else
{
wchar_t error[256];
mir_snwprintf(error, TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"import_text(): Cannot import list from file \"%s\". errno=%d: %s", str, errno, _tcserror(errno));
if (f)
fclose(f);
@@ -447,13 +447,13 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) fclose(f);
free(contacts);
- MessageBox(NULL, TranslateT("List export successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("List export successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
else
{
wchar_t error[128];
mir_snwprintf(error, TranslateT("List cannot be exported to file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"export_text(): Cannot export list to file \"%s\". errno=%d: %s", str, errno, _tcserror(errno));
}
@@ -468,7 +468,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) // Check if connected
if (!isonline())
{
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("You have to be connected before you can import/export contacts from/to server."),
m_tszUserName, MB_OK | MB_ICONSTOP
);
@@ -497,7 +497,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 1, "sess_mutex", 1);
mir_snwprintf(error, TranslateT("List cannot be exported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"export_server(): Cannot export list. errno=%d: %s", errno, ws_strerror(errno));
}
gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 2, "sess_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/keepalive.cpp b/protocols/Gadu-Gadu/src/keepalive.cpp index f55a224cb6..426f72d0f0 100644 --- a/protocols/Gadu-Gadu/src/keepalive.cpp +++ b/protocols/Gadu-Gadu/src/keepalive.cpp @@ -24,7 +24,7 @@ * does not get full pointer but just 2 byte lower bytes.
*/
#define MAX_TIMERS 8
-GGPROTO *g_timers[MAX_TIMERS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+GGPROTO *g_timers[MAX_TIMERS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
static VOID CALLBACK gg_keepalive(HWND, UINT, UINT_PTR idEvent, DWORD)
{
@@ -55,13 +55,13 @@ void GGPROTO::keepalive_init() if (getByte(GG_KEY_KEEPALIVE, GG_KEYDEF_KEEPALIVE))
{
int i;
- for(i = 0; i < MAX_TIMERS && g_timers[i] != NULL; i++);
+ for(i = 0; i < MAX_TIMERS && g_timers[i] != nullptr; i++);
if (i < MAX_TIMERS)
{
#ifdef DEBUGMODE
debugLogA("keepalive_init(): Initializing Timer %d", i);
#endif
- timer = SetTimer(NULL, 0, 1000 * 30, gg_keepalive);
+ timer = SetTimer(nullptr, 0, 1000 * 30, gg_keepalive);
g_timers[i] = this;
}
}
@@ -75,10 +75,10 @@ void GGPROTO::keepalive_destroy() if (timer)
{
int i;
- KillTimer(NULL, timer);
+ KillTimer(nullptr, timer);
for(i = 0; i < MAX_TIMERS; i++)
if (g_timers[i] == this) {
- g_timers[i] = NULL;
+ g_timers[i] = nullptr;
break;
}
timer = 0;
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index 6fc1a996ca..6463c5ccf6 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -45,12 +45,12 @@ static INT_PTR gg_parselink(WPARAM, LPARAM lParam) if (g_Instances.getCount() == 0)
return 0;
- if (arg == NULL)
+ if (arg == nullptr)
return 1;
arg = strchr(arg, ':');
- if (arg == NULL)
+ if (arg == nullptr)
return 1;
for (++arg; *arg == '/'; ++arg);
@@ -59,13 +59,13 @@ static INT_PTR gg_parselink(WPARAM, LPARAM lParam) if (!uin)
return 1;
- GGPROTO *gg = NULL;
+ GGPROTO *gg = nullptr;
for (int i=0; i < g_Instances.getCount(); i++) {
gg = g_Instances[i];
if (gg->m_iStatus > ID_STATUS_OFFLINE) {
++items;
- Menu_ModifyItem(gg->hInstanceMenuItem, NULL, Skin_LoadProtoIcon(gg->m_szModuleName, gg->m_iStatus));
+ Menu_ModifyItem(gg->hInstanceMenuItem, nullptr, Skin_LoadProtoIcon(gg->m_szModuleName, gg->m_iStatus));
}
else Menu_ShowItem(gg->hInstanceMenuItem, false);
}
@@ -76,17 +76,17 @@ static INT_PTR gg_parselink(WPARAM, LPARAM lParam) HMENU hMenu = CreatePopupMenu();
Menu_Build(hMenu, hInstanceMenu);
- int cmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
+ int cmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, nullptr);
DestroyMenu(hMenu);
if (cmd)
Menu_ProcessCommandById(cmd, (LPARAM)&gg);
}
- if (gg == NULL)
+ if (gg == nullptr)
return 0;
- MCONTACT hContact = gg->getcontact(uin, 1, 0, NULL);
+ MCONTACT hContact = gg->getcontact(uin, 1, 0, nullptr);
if (hContact != NULL)
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
return 0;
@@ -95,13 +95,13 @@ static INT_PTR gg_parselink(WPARAM, LPARAM lParam) void gg_links_instancemenu_init()
{
CreateServiceFunction(GGS_MENUCHOOSE, gg_menuchoose);
- hInstanceMenu = Menu_AddObject("GGAccountChooser", LPGEN("Gadu-Gadu account chooser"), 0, GGS_MENUCHOOSE);
+ hInstanceMenu = Menu_AddObject("GGAccountChooser", LPGEN("Gadu-Gadu account chooser"), nullptr, GGS_MENUCHOOSE);
CMenuItem mi;
mi.name.a = "Cancel";
mi.position = 9999999;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_DELETE);
- Menu_AddItem(hInstanceMenu, &mi, NULL);
+ Menu_AddItem(hInstanceMenu, &mi, nullptr);
}
void gg_links_init()
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 52074931a6..5c0f21cf74 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -57,7 +57,7 @@ char *oauth_uri_escape(const char *str) char *res;
int size, ix = 0;
- if (str == NULL) return mir_strdup("");
+ if (str == nullptr) return mir_strdup("");
size = (int)mir_strlen(str) + 1;
res = (char *)mir_alloc(size);
@@ -86,7 +86,7 @@ char *oauth_generate_signature(LIST<OAUTHPARAMETER> ¶ms, const char *httpmet OAUTHPARAMETER *p;
int i, ix = 0, size;
- if (httpmethod == NULL || url == NULL || !params.getCount()) return mir_strdup("");
+ if (httpmethod == nullptr || url == nullptr || !params.getCount()) return mir_strdup("");
urlnorm = (char *)mir_alloc(mir_strlen(url) + 1);
while (*url) {
@@ -95,9 +95,9 @@ char *oauth_generate_signature(LIST<OAUTHPARAMETER> ¶ms, const char *httpmet url++;
}
urlnorm[ix] = 0;
- if ((res = strstr(urlnorm, ":80")) != NULL)
+ if ((res = strstr(urlnorm, ":80")) != nullptr)
memmove(res, res + 3, mir_strlen(res) - 2);
- else if ((res = strstr(urlnorm, ":443")) != NULL)
+ else if ((res = strstr(urlnorm, ":443")) != nullptr)
memmove(res, res + 4, mir_strlen(res) - 3);
urlenc = oauth_uri_escape(urlnorm);
@@ -135,7 +135,7 @@ char *oauth_getparam(LIST<OAUTHPARAMETER> ¶ms, const char *name) OAUTHPARAMETER *p;
int i;
- if (name == NULL) return NULL;
+ if (name == nullptr) return nullptr;
for (i = 0; i < params.getCount(); i++) {
p = params[i];
@@ -143,7 +143,7 @@ char *oauth_getparam(LIST<OAUTHPARAMETER> ¶ms, const char *name) return p->value;
}
- return NULL;
+ return nullptr;
}
void oauth_setparam(LIST<OAUTHPARAMETER> ¶ms, const char *name, const char *value)
@@ -151,7 +151,7 @@ void oauth_setparam(LIST<OAUTHPARAMETER> ¶ms, const char *name, const char * OAUTHPARAMETER *p;
int i;
- if (name == NULL) return;
+ if (name == nullptr) return;
for (i = 0; i < params.getCount(); i++) {
p = params[i];
@@ -183,12 +183,12 @@ void oauth_freeparams(LIST<OAUTHPARAMETER> ¶ms) int oauth_sign_request(LIST<OAUTHPARAMETER> ¶ms, const char *httpmethod, const char *url,
const char *consumer_secret, const char *token_secret)
{
- char *sign = NULL, *signmethod;
+ char *sign = nullptr, *signmethod;
if (!params.getCount()) return -1;
signmethod = oauth_getparam(params, "oauth_signature_method");
- if (signmethod == NULL) return -1;
+ if (signmethod == nullptr) return -1;
if (!mir_strcmp(signmethod, "HMAC-SHA1")) {
ptrA text( oauth_generate_signature(params, httpmethod, url));
@@ -224,7 +224,7 @@ char* oauth_generate_nonce() char randnum[16];
Utils_GetRandom(randnum, sizeof(randnum));
- CMStringA str(FORMAT, "%ld%s", time(NULL), randnum);
+ CMStringA str(FORMAT, "%ld%s", time(nullptr), randnum);
BYTE digest[16];
mir_md5_hash((BYTE*)str.GetString(), str.GetLength(), digest);
@@ -238,7 +238,7 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD int i, size;
char *res, timestamp[22];
- if (httpmethod == NULL || url == NULL) return NULL;
+ if (httpmethod == nullptr || url == nullptr) return nullptr;
LIST<OAUTHPARAMETER> oauth_parameters(1, paramsortFunc);
oauth_setparam(oauth_parameters, "oauth_consumer_key", consumer_key);
@@ -248,15 +248,15 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD case RSASHA1: oauth_setparam(oauth_parameters, "oauth_signature_method", "RSA-SHA1"); break;
default: oauth_setparam(oauth_parameters, "oauth_signature_method", "PLAINTEXT"); break;
};
- mir_snprintf(timestamp, "%ld", time(NULL));
+ mir_snprintf(timestamp, "%ld", time(nullptr));
oauth_setparam(oauth_parameters, "oauth_timestamp", timestamp);
oauth_setparam(oauth_parameters, "oauth_nonce", ptrA(oauth_generate_nonce()));
- if (token != NULL && *token)
+ if (token != nullptr && *token)
oauth_setparam(oauth_parameters, "oauth_token", token);
if (oauth_sign_request(oauth_parameters, httpmethod, url, consumer_secret, token_secret)) {
oauth_freeparams(oauth_parameters);
- return NULL;
+ return nullptr;
}
size = 7;
@@ -284,9 +284,9 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD int GGPROTO::oauth_receivetoken()
{
- char szUrl[256], uin[32], *str, *token = NULL, *token_secret = NULL;
+ char szUrl[256], uin[32], *str, *token = nullptr, *token_secret = nullptr;
int res = 0;
- HNETLIBCONN nlc = NULL;
+ HNETLIBCONN nlc = nullptr;
UIN2IDA( getDword(GG_KEY_UIN, 0), uin);
char *password = getStringA(GG_KEY_PASSWORD);
@@ -294,7 +294,7 @@ int GGPROTO::oauth_receivetoken() // 1. Obtaining an Unauthorized Request Token
debugLogA("oauth_receivetoken(): Obtaining an Unauthorized Request Token...");
mir_strcpy(szUrl, "http://api.gadu-gadu.pl/request_token");
- str = oauth_auth_header("POST", szUrl, HMACSHA1, uin, password, NULL, NULL);
+ str = oauth_auth_header("POST", szUrl, HMACSHA1, uin, password, nullptr, nullptr);
NETLIBHTTPHEADER httpHeaders[3];
httpHeaders[0].szName = "User-Agent";
@@ -316,13 +316,13 @@ int GGPROTO::oauth_receivetoken() nlc = resp->nlc;
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
wchar_t *xmlAction = mir_a2u(resp->pData);
- HXML hXml = xmlParseString(xmlAction, 0, L"result");
- if (hXml != NULL) {
+ HXML hXml = xmlParseString(xmlAction, nullptr, L"result");
+ if (hXml != nullptr) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
- token = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
+ token = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
node = xmlGetChildByPath(hXml, L"oauth_token_secret", 0);
- token_secret = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
+ token_secret = node != nullptr ? mir_u2a(xmlGetText(node)) : nullptr;
xmlDestroyNode(hXml);
}
@@ -369,8 +369,8 @@ int GGPROTO::oauth_receivetoken() str = oauth_auth_header("POST", szUrl, HMACSHA1, uin, password, token, token_secret);
mir_free(token);
mir_free(token_secret);
- token = NULL;
- token_secret = NULL;
+ token = nullptr;
+ token_secret = nullptr;
memset(&req, 0, sizeof(req));
req.cbSize = sizeof(req);
@@ -387,8 +387,8 @@ int GGPROTO::oauth_receivetoken() if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
wchar_t *xmlAction = mir_a2u(resp->pData);
- HXML hXml = xmlParseString(xmlAction, 0, L"result");
- if (hXml != NULL) {
+ HXML hXml = xmlParseString(xmlAction, nullptr, L"result");
+ if (hXml != nullptr) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
token = mir_u2a(xmlGetText(node));
@@ -408,7 +408,7 @@ int GGPROTO::oauth_receivetoken() mir_free(password);
mir_free(str);
- if (token != NULL && token_secret != NULL) {
+ if (token != nullptr && token_secret != nullptr) {
setString(GG_KEY_TOKEN, token);
setString(GG_KEY_TOKENSECRET, token_secret);
debugLogA("oauth_receivetoken(): Access Token obtained successfully.");
diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp index 6a11db6a33..49b70004f5 100644 --- a/protocols/Gadu-Gadu/src/ownerinfo.cpp +++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp @@ -58,14 +58,14 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) {
wchar_t error[128];
mir_snwprintf(error, TranslateT("Password could not be reminded because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLogW(L"remindpasswordthread(): Password could not be reminded. errno=%d: %s", errno, ws_strerror(errno));
}
else
{
gg_pubdir_free(h);
debugLogA("remindpasswordthread(): Password remind successful.");
- MessageBox(NULL, TranslateT("Password was sent to your e-mail."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Password was sent to your e-mail."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
free(rp);
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index dcc88ee18c..a1527e3b46 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -38,7 +38,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_COMMAND:
{
PopupData* puData = (PopupData*)PUGetPluginData(hWnd);
- if (puData != NULL)
+ if (puData != nullptr)
{
if (puData->flags & GG_POPUP_MULTILOGON)
puData->gg->sessions_view(0, 0);
@@ -54,7 +54,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar case UM_FREEPLUGINDATA:
{
PopupData* puData = (PopupData*)PUGetPluginData(hWnd);
- if (puData != NULL && puData != (PopupData*)CALLSERVICE_NOTFOUND)
+ if (puData != nullptr && puData != (PopupData*)CALLSERVICE_NOTFOUND)
{
mir_free(puData->title);
mir_free(puData->text);
@@ -94,7 +94,7 @@ void GGPROTO::initpopups() puc.colorBack = RGB(191, 0, 0); // Red
puc.colorText = RGB(255, 245, 225); // Yellow
puc.iSeconds = 60;
- puc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
+ puc.hIcon = (HICON)LoadImage(nullptr, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
mir_snprintf(szName, "%s_%s", m_szModuleName, "Error");
hPopupError = Popup_RegisterClass(&puc);
@@ -129,19 +129,19 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) BOOL bShow = TRUE;
if (puData->flags & GG_POPUP_ONCE) {
- HWND hWnd = FindWindow(NULL, gg->m_tszUserName);
- while (hWnd != NULL) {
- if (FindWindowEx(hWnd, NULL, NULL, puData->text) != NULL) {
+ HWND hWnd = FindWindow(nullptr, gg->m_tszUserName);
+ while (hWnd != nullptr) {
+ if (FindWindowEx(hWnd, nullptr, nullptr, puData->text) != nullptr) {
bShow = FALSE;
break;
}
- hWnd = FindWindowEx(NULL, hWnd, NULL, gg->m_tszUserName);
+ hWnd = FindWindowEx(nullptr, hWnd, nullptr, gg->m_tszUserName);
}
}
if (bShow) {
UINT uIcon = puData->flags & GG_POPUP_ERROR ? MB_ICONERROR : puData->flags & GG_POPUP_WARNING ? MB_ICONEXCLAMATION : MB_ICONINFORMATION;
- MessageBox(NULL, puData->text, gg->m_tszUserName, MB_OK | uIcon);
+ MessageBox(nullptr, puData->text, gg->m_tszUserName, MB_OK | uIcon);
}
}
mir_free(puData->title);
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 78542d1802..cd060f3609 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -38,7 +38,7 @@ char *gg_status2db(int status, const char *suffix) case ID_STATUS_INVISIBLE: prefix = "Inv"; break;
case ID_STATUS_ONTHEPHONE: prefix = "Otp"; break;
case ID_STATUS_OUTTOLUNCH: prefix = "Otl"; break;
- default: return NULL;
+ default: return nullptr;
}
static char str[64];
@@ -95,11 +95,11 @@ int GGPROTO::refreshstatus(int status) debugLogA("refreshstatus(): Waiting pth_sess thread - OK");
debugLogA("refreshstatus(): ForkThreadEx 21 GGPROTO::mainthread");
#endif
- pth_sess.hThread = ForkThreadEx(&GGPROTO::mainthread, NULL, &pth_sess.dwThreadId);
+ pth_sess.hThread = ForkThreadEx(&GGPROTO::mainthread, nullptr, &pth_sess.dwThreadId);
}
else
{
- wchar_t *szMsg = NULL;
+ wchar_t *szMsg = nullptr;
// Select proper msg
gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 69, "modemsg_mutex", 1);
szMsg = getstatusmsg(status);
@@ -118,7 +118,7 @@ int GGPROTO::refreshstatus(int status) gg_LeaveCriticalSection(&sess_mutex, "refreshstatus", 71, 1, "sess_mutex", 1);
}
// Change status of the contact with our own UIN (if got yourself added to the contact list)
- changecontactstatus( getDword(GG_KEY_UIN, 0), status_m2gg(status, szMsg != NULL), szMsg, 0, 0, 0, 0);
+ changecontactstatus( getDword(GG_KEY_UIN, 0), status_m2gg(status, szMsg != nullptr), szMsg, 0, 0, 0, 0);
broadcastnewstatus(status);
}
@@ -212,7 +212,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) pai->format = getByte(pai->hContact, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE);
- ptrA AvatarHash(NULL);
+ ptrA AvatarHash(nullptr);
ptrA AvatarURL( getStringA(pai->hContact, GG_KEY_AVATARURL));
ptrA AvatarTs( getStringA(pai->hContact, GG_KEY_AVATARTS));
if (AvatarURL != NULL && AvatarTs != NULL) {
@@ -287,7 +287,7 @@ INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam) wchar_t *szFilename = (wchar_t*)wParam;
int len = (int)lParam;
- if (szFilename == NULL || len <= 0) {
+ if (szFilename == nullptr || len <= 0) {
debugLogA("getmyavatar(): Incoming request for self avatar information. szFilename == NULL. return -1 (error)");
return -1;
}
@@ -319,8 +319,8 @@ INT_PTR GGPROTO::setmyavatar(WPARAM, LPARAM lParam) if (!getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS))
return -2;
- if (szFilename == NULL) {
- MessageBox(NULL,
+ if (szFilename == nullptr) {
+ MessageBox(nullptr,
TranslateT("To remove your Gadu-Gadu avatar, you must use the gg.pl website."),
m_tszUserName, MB_OK | MB_ICONINFORMATION);
return -1;
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 724c2c9cef..f13ddecb2b 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -148,7 +148,7 @@ static BOOL IsOverAction(HWND hwndDlg) return (hti.pt.x > textPosX && hti.pt.x < textPosX + textSize.cx);
}
-static HCURSOR hHandCursor = NULL;
+static HCURSOR hHandCursor = nullptr;
#define WM_MULTILOGONINFO (WM_USER + 10)
#define HM_PROTOACK (WM_USER + 11)
@@ -172,8 +172,8 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w SetWindowText(hwndDlg, newTitle);
Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_SESSIONS));
- if (hHandCursor == NULL)
- hHandCursor = LoadCursor(NULL, IDC_HAND);
+ if (hHandCursor == nullptr)
+ hHandCursor = LoadCursor(nullptr, IDC_HAND);
hProtoAckEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_PROTOACK);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hProtoAckEvent);
@@ -242,7 +242,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w RECT rc;
HWND hwndHeader = ListView_GetHeader(nm->nmcd.hdr.hwndFrom);
GetClientRect(nm->nmcd.hdr.hwndFrom, &rc);
- if (hwndHeader != NULL) {
+ if (hwndHeader != nullptr) {
RECT rcHeader;
GetClientRect(hwndHeader, &rcHeader);
rc.top += rcHeader.bottom;
@@ -251,7 +251,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w SIZE textSize;
GetTextExtentPoint32(nm->nmcd.hdc, szText, cbLen, &textSize);
int textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
- ExtTextOut(nm->nmcd.hdc, textPosX, rc.top + textSize.cy, ETO_OPAQUE, &rc, szText, cbLen, NULL);
+ ExtTextOut(nm->nmcd.hdc, textPosX, rc.top + textSize.cy, ETO_OPAQUE, &rc, szText, cbLen, nullptr);
}
// FALL THROUGH
@@ -316,7 +316,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w hMenu = CreatePopupMenu();
AppendMenu(hMenu, MFT_STRING, 10001, TranslateT("Copy Text"));
AppendMenu(hMenu, MFT_STRING, 10002, TranslateT("Whois"));
- iSelection = TrackPopupMenu(hMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ iSelection = TrackPopupMenu(hMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr);
switch (iSelection) {
case 10001:
{
@@ -331,7 +331,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
ListView_GetItemText(hList, lvhti.iItem, 2, szLoginTime, _countof(szLoginTime));
mir_snwprintf(szText, L"%s\t%s\t%s", szClientName, szIP, szLoginTime);
- if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(szText) + 1)) != NULL)
+ if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(szText) + 1)) != nullptr)
{
mir_wstrcpy((wchar_t*)GlobalLock(hData), szText);
GlobalUnlock(hData);
@@ -382,7 +382,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w {
HANDLE hProtoAckEvent = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (hProtoAckEvent) UnhookEvent(hProtoAckEvent);
- gg->hwndSessionsDlg = NULL;
+ gg->hwndSessionsDlg = nullptr;
Window_FreeIcon_IcoLib(hwndDlg);
break;
}
@@ -397,7 +397,7 @@ INT_PTR GGPROTO::sessions_view(WPARAM, LPARAM) SetForegroundWindow(hwndSessionsDlg);
SetFocus(hwndSessionsDlg);
}
- else CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_SESSIONS), NULL, gg_sessions_viewdlg, (LPARAM)this);
+ else CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_SESSIONS), nullptr, gg_sessions_viewdlg, (LPARAM)this);
return 0;
}
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index 351b0df053..be13895b5d 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -76,7 +76,7 @@ INT_PTR CALLBACK gg_tokendlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (dat && dat->hBitmap)
{
- HDC hdcBmp = NULL;
+ HDC hdcBmp = nullptr;
int nWidth, nHeight;
BITMAP bmp;
@@ -115,7 +115,7 @@ int GGPROTO::gettoken(GGTOKEN *token) if (!h || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) {
wchar_t error[128];
mir_snwprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
}
@@ -124,7 +124,7 @@ int GGPROTO::gettoken(GGTOKEN *token) if (!t || !h->body) {
wchar_t error[128];
mir_snwprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error));
- MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
}
@@ -142,15 +142,15 @@ int GGPROTO::gettoken(GGTOKEN *token) memio.fif = FIF_UNKNOWN; /* detect */
memio.flags = 0;
dat.hBitmap = (HBITMAP) CallService(MS_IMG_LOADFROMMEM, (WPARAM) &memio, 0);
- if (dat.hBitmap == NULL)
+ if (dat.hBitmap == nullptr)
{
- MessageBox(NULL, TranslateT("Could not load token image."), m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, TranslateT("Could not load token image."), m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
}
// Load token dialog
- if (DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_TOKEN), NULL, gg_tokendlgproc, (LPARAM)&dat) == IDCANCEL)
+ if (DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_TOKEN), nullptr, gg_tokendlgproc, (LPARAM)&dat) == IDCANCEL)
return FALSE;
// Fillup patterns
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 6fea4ce96e..8136cd8552 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -26,24 +26,24 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail)
{
// Connection handles
- struct gg_http *h = NULL;
- struct gg_pubdir *s = NULL;
+ struct gg_http *h = nullptr;
+ struct gg_pubdir *s = nullptr;
GGTOKEN token;
#ifdef DEBUGMODE
gg->debugLogA("gg_doregister(): Starting.");
#endif
- if (!newPass || !newEmail) return NULL;
+ if (!newPass || !newEmail) return nullptr;
// Load token
- if (!gg->gettoken(&token)) return NULL;
+ if (!gg->gettoken(&token)) return nullptr;
if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || !s->uin) {
wchar_t error[128];
mir_snwprintf(error, TranslateT("Cannot register new account because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Registration rejected") : ws_strerror(errno)));
- MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLogW(L"gg_doregister(): Cannot register. errno=%d: %s", errno, ws_strerror(errno));
}
else {
@@ -53,7 +53,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) gg->setString(GG_KEY_EMAIL, newEmail);
gg_pubdir_free(h);
gg->debugLogA("gg_doregister(): Account registration succesful.");
- MessageBox( NULL,
+ MessageBox( nullptr,
TranslateT("You have registered new account.\nPlease fill up your personal details in \"Main menu -> View/change my details...\""),
gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
@@ -62,7 +62,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) gg->debugLogA("gg_doregister(): End.");
#endif
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -72,16 +72,16 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) {
// Connection handles
struct gg_http *h;
- struct gg_pubdir *s = NULL;
+ struct gg_pubdir *s = nullptr;
GGTOKEN token;
#ifdef DEBUGMODE
gg->debugLogA("gg_dounregister(): Starting.");
#endif
- if (!uin || !password) return NULL;
+ if (!uin || !password) return nullptr;
// Load token
- if (!gg->gettoken(&token)) return NULL;
+ if (!gg->gettoken(&token)) return nullptr;
if (!(h = gg_unregister3(uin, password, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || s->uin != uin)
{
@@ -89,7 +89,7 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) mir_snwprintf(error, TranslateT("Your account cannot be removed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Bad number or password") : ws_strerror(errno)));
- MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLogW(L"gg_dounregister(): Cannot remove account. errno=%d: %s", errno, ws_strerror(errno));
}
else
@@ -98,14 +98,14 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) gg->delSetting(GG_KEY_PASSWORD);
gg->delSetting(GG_KEY_UIN);
gg->debugLogA("gg_dounregister(): Account %d has been removed.", uin);
- MessageBox(NULL, TranslateT("Your account has been removed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Your account has been removed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
#ifdef DEBUGMODE
gg->debugLogA("gg_dounregister(): End.");
#endif
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -117,13 +117,13 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) char email[255] = "\0"; DBVARIANT dbv_email;
// Connection handles
struct gg_http *h;
- struct gg_pubdir *s = NULL;
+ struct gg_pubdir *s = nullptr;
GGTOKEN token;
#ifdef DEBUGMODE
gg->debugLogA("gg_dochpass(): Starting.");
#endif
- if (!uin || !password || !newPass) return NULL;
+ if (!uin || !password || !newPass) return nullptr;
if (!gg->getString(GG_KEY_EMAIL, &dbv_email))
{
@@ -133,7 +133,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) // Load token
if (!gg->gettoken(&token))
- return NULL;
+ return nullptr;
if (!(h = gg_change_passwd4(uin, email, password, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success)
{
@@ -141,7 +141,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) mir_snwprintf(error, TranslateT("Your password cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Invalid data entered") : ws_strerror(errno)));
- MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLogW(L"gg_dochpass(): Cannot change password. errno=%d: %s", errno, ws_strerror(errno));
}
else
@@ -149,14 +149,14 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) gg_pubdir_free(h);
gg->setString(GG_KEY_PASSWORD, newPass);
gg->debugLogA("gg_dochpass(): Password change succesful.");
- MessageBox(NULL, TranslateT("Your password has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Your password has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
#ifdef DEBUGMODE
gg->debugLogA("gg_dochpass(): End.");
#endif
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -167,22 +167,22 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne #ifdef DEBUGMODE
gg->debugLogA("gg_dochemail(): Starting.");
#endif
- if (!uin || !email || !newEmail) return NULL;
+ if (!uin || !email || !newEmail) return nullptr;
// Load token
GGTOKEN token;
if (!gg->gettoken(&token))
- return NULL;
+ return nullptr;
// Connection handles
- struct gg_pubdir *s = NULL;
+ struct gg_pubdir *s = nullptr;
struct gg_http *h = gg_change_passwd4(uin, newEmail, password, password, token.id, token.val, 0);
if (!h || !(s = (gg_pubdir*)h->data) || !s->success)
{
wchar_t error[128];
mir_snwprintf(error, TranslateT("Your e-mail cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) : (s ? TranslateT("Bad old e-mail or password") : ws_strerror(errno)));
- MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLogW(L"gg_dochemail(): Cannot change e-mail. errno=%d: %s", errno, ws_strerror(errno));
}
else
@@ -190,14 +190,14 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne gg_pubdir_free(h);
gg->setString(GG_KEY_EMAIL, newEmail);
gg->debugLogA("gg_dochemail(): E-mail change succesful.");
- MessageBox(NULL, TranslateT("Your e-mail has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Your e-mail has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
#ifdef DEBUGMODE
gg->debugLogA("gg_dochemail(): End.");
#endif
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/ICQCorp/src/corp.cpp b/protocols/ICQCorp/src/corp.cpp index cd6388e59d..72d9de6ee7 100644 --- a/protocols/ICQCorp/src/corp.cpp +++ b/protocols/ICQCorp/src/corp.cpp @@ -104,13 +104,13 @@ void T(char *format, ...) static HANDLE hFile = INVALID_HANDLE_VALUE;
if (hFile == INVALID_HANDLE_VALUE) {
- hFile = CreateFile("ICQ Corp.log", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL);
- SetFilePointer(hFile, 0, 0, FILE_END);
+ hFile = CreateFile("ICQ Corp.log", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_ALWAYS, 0, nullptr);
+ SetFilePointer(hFile, 0, nullptr, FILE_END);
}
DWORD result;
- WriteFile(hFile, bufferTime, (DWORD)mir_strlen(bufferTime), &result, NULL);
- WriteFile(hFile, buffer, (DWORD)mir_strlen(buffer), &result, NULL);
+ WriteFile(hFile, bufferTime, (DWORD)mir_strlen(bufferTime), &result, nullptr);
+ WriteFile(hFile, buffer, (DWORD)mir_strlen(buffer), &result, nullptr);
}
#endif
diff --git a/protocols/ICQCorp/src/event.cpp b/protocols/ICQCorp/src/event.cpp index 70ccbedf3f..6499a1d37b 100644 --- a/protocols/ICQCorp/src/event.cpp +++ b/protocols/ICQCorp/src/event.cpp @@ -25,7 +25,7 @@ std::vector <ICQEvent *> icqEvents; static void WINAPI eventTimerProc(HWND, UINT, UINT_PTR hTimer, DWORD)
{
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
for (size_t i = 0; i < icqEvents.size(); i++)
if (hTimer == icqEvents[i]->hTimer)
@@ -40,7 +40,7 @@ ICQEvent* getEvent(SOCKET hSocket, unsigned int sequence) if (icqEvents[i]->isEvent(hSocket, sequence))
return icqEvents[i];
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -77,7 +77,7 @@ bool ICQEvent::start() return false;
if (cmd != ICQ_CMDxTCP_START)
- hTimer = SetTimer(NULL, 0, MAX_WAIT_ACK, eventTimerProc);
+ hTimer = SetTimer(nullptr, 0, MAX_WAIT_ACK, eventTimerProc);
return true;
}
@@ -86,7 +86,7 @@ bool ICQEvent::start() void ICQEvent::stop()
{
if (hTimer) {
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
hTimer = NULL;
}
}
diff --git a/protocols/ICQCorp/src/options.cpp b/protocols/ICQCorp/src/options.cpp index 7aa7a49ec1..dbe5e9189c 100644 --- a/protocols/ICQCorp/src/options.cpp +++ b/protocols/ICQCorp/src/options.cpp @@ -45,12 +45,12 @@ static INT_PTR CALLBACK icqOptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_dw(NULL, protoName, "UIN", (DWORD)GetDlgItemInt(hWnd, IDC_OPT_UIN, NULL, FALSE));
+ db_set_dw(NULL, protoName, "UIN", (DWORD)GetDlgItemInt(hWnd, IDC_OPT_UIN, nullptr, FALSE));
GetDlgItemText(hWnd, IDC_OPT_PASSWORD, str, sizeof(str));
db_set_s(NULL, protoName, "Password", str);
GetDlgItemText(hWnd, IDC_OPT_SERVER, str, sizeof(str));
db_set_s(NULL, protoName, "Server", str);
- db_set_w(NULL, protoName, "Port", (WORD)GetDlgItemInt(hWnd, IDC_OPT_PORT, NULL, FALSE));
+ db_set_w(NULL, protoName, "Port", (WORD)GetDlgItemInt(hWnd, IDC_OPT_PORT, nullptr, FALSE));
return TRUE;
}
break;
diff --git a/protocols/ICQCorp/src/packet.cpp b/protocols/ICQCorp/src/packet.cpp index bce974f68a..9fe991e557 100644 --- a/protocols/ICQCorp/src/packet.cpp +++ b/protocols/ICQCorp/src/packet.cpp @@ -159,9 +159,9 @@ Packet& Packet::operator >> (char *&in) unsigned short s;
operator >> (s);
- if (nextData + s > buff + sizeVal) in = 0;
+ if (nextData + s > buff + sizeVal) in = nullptr;
else {
- if (in == NULL) in = new char[s];
+ if (in == nullptr) in = new char[s];
memcpy(in, nextData, s);
nextData += s;
}
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index 4193dc2091..e38e9b9e31 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -150,7 +150,7 @@ bool ICQ::load() WSADATA data;
if (WSAStartup(MAKEWORD(2, 2), &data)) {
- MessageBox(NULL, Translate("ICQ Corporate plugin used only WinSock v2.2 or later."), protoName, MB_ICONWARNING | MB_OK);
+ MessageBox(nullptr, Translate("ICQ Corporate plugin used only WinSock v2.2 or later."), protoName, MB_ICONWARNING | MB_OK);
return false;
}
@@ -161,11 +161,11 @@ bool ICQ::load() awayMessage = new char[1];
awayMessage[0] = 0;
- WNDCLASS wc = { 0, messageWndProc, 0, 0, hInstance, NULL, NULL, NULL, NULL, protoName };
+ WNDCLASS wc = { 0, messageWndProc, 0, 0, hInstance, nullptr, nullptr, nullptr, nullptr, protoName };
if (!RegisterClass(&wc)) return false;
- hWnd = CreateWindowEx(0, protoName, NULL, 0, 0, 0, 0, 0, (unsigned short)GetVersion() >= 5 ? HWND_MESSAGE : 0, NULL, hInstance, NULL);
- if (hWnd == NULL) return false;
+ hWnd = CreateWindowEx(0, protoName, nullptr, 0, 0, 0, 0, 0, (unsigned short)GetVersion() >= 5 ? HWND_MESSAGE : nullptr, nullptr, hInstance, nullptr);
+ if (hWnd == nullptr) return false;
return true;
}
@@ -176,7 +176,7 @@ void ICQ::unload() {
if (statusVal != ID_STATUS_OFFLINE) logoff(false);
- KillTimer(NULL, pingTimer);
+ KillTimer(nullptr, pingTimer);
pingTimer = NULL;
delete[] awayMessage;
@@ -199,7 +199,7 @@ bool ICQ::logon(unsigned short logonStatus) db_free(&dbv);
}
else {
- MessageBox(NULL, Translate("You need specify ICQ Corporate login server."), protoName, MB_ICONWARNING | MB_OK);
+ MessageBox(nullptr, Translate("You need specify ICQ Corporate login server."), protoName, MB_ICONWARNING | MB_OK);
return false;
}
@@ -213,7 +213,7 @@ bool ICQ::logon(unsigned short logonStatus) }
if (pingTimer == NULL)
- pingTimer = SetTimer(NULL, 0, PING_FREQUENCY, pingTimerProc);
+ pingTimer = SetTimer(nullptr, 0, PING_FREQUENCY, pingTimerProc);
updateContactList();
@@ -323,7 +323,7 @@ ICQEvent *ICQ::sendICQ(Socket &socket, Packet &packet, unsigned short cmd, unsig ICQEvent *result;
if (!socket.connected())
- return NULL;
+ return nullptr;
if (cmd != ICQ_CMDxTCP_START)
sequenceVal++;
@@ -331,7 +331,7 @@ ICQEvent *ICQ::sendICQ(Socket &socket, Packet &packet, unsigned short cmd, unsig icqEvents.push_back(result = new ICQEvent(cmd, subCmd, sequence, uin, &socket, &packet, reply));
if (!result->start()) {
cancelEvent(result);
- return NULL;
+ return nullptr;
}
return result;
}
@@ -432,7 +432,7 @@ void ICQ::cancelEvent(ICQEvent *&e) icqEvents.pop_back();
delete e;
- e = NULL;
+ e = nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -442,7 +442,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) unsigned short version, command, newCommand, theSequence, theSequence1, searchSequence, junkShort;
unsigned int checkUin, userIP, realIP, junkl, newStatus, userPort, timedataStamp;
unsigned char junkChar;
- char *message = NULL;
+ char *message = nullptr;
ICQUser *u;
ICQEvent *e;
@@ -467,7 +467,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) packet >> message;
T("%s\n", message);
- MessageBox(NULL, message, protoName, MB_ICONERROR | MB_OK);
+ MessageBox(nullptr, message, protoName, MB_ICONERROR | MB_OK);
delete[] message;
break;
@@ -477,7 +477,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) T("[udp] user %d is online\n", checkUin);
ackUDP(theSequence);
- if ((u = getUserByUIN(checkUin, false)) == NULL) break;
+ if ((u = getUserByUIN(checkUin, false)) == nullptr) break;
packet >> userIP
>> userPort
@@ -499,7 +499,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) T("[udp] user %d is offline\n", checkUin);
ackUDP(theSequence);
- if ((u = getUserByUIN(checkUin, false)) == NULL) break;
+ if ((u = getUserByUIN(checkUin, false)) == nullptr) break;
u->setStatus(ID_STATUS_OFFLINE);
u->socket.closeConnection();
@@ -514,9 +514,9 @@ unsigned short ICQ::processUdpPacket(Packet &packet) T("[udp] user information packet (%d)\n", theSequence);
ackUDP(theSequence);
- if ((e = getEvent(udpSocket.handleVal, theSequence1)) == NULL) break;
+ if ((e = getEvent(udpSocket.handleVal, theSequence1)) == nullptr) break;
checkUin = e->uin;
- if ((u = getUserByUIN(checkUin, false)) == NULL) break;
+ if ((u = getUserByUIN(checkUin, false)) == nullptr) break;
char *buffer;
buffer = new char[1024];
@@ -603,7 +603,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) break;
}
- if (e->reply == 0) ProtoBroadcastAck(protoName, u->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, 0, 0);
+ if (e->reply == 0) ProtoBroadcastAck(protoName, u->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr, 0);
doneEvent(true, udpSocket.handleVal, theSequence1);
delete[] buffer;
break;
@@ -612,7 +612,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) T("[udp] invalid uin\n");
ackUDP(theSequence);
- if ((e = getEvent(udpSocket.handleVal, theSequence1)) == NULL) break;
+ if ((e = getEvent(udpSocket.handleVal, theSequence1)) == nullptr) break;
checkUin = e->uin;
T("invalid uin: %d\n", checkUin);
@@ -626,7 +626,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) packet >> newStatus;
- if ((u = getUserByUIN(checkUin, false)) == NULL) break;
+ if ((u = getUserByUIN(checkUin, false)) == nullptr) break;
u->setStatus(toIdStatus(newStatus));
break;
@@ -642,10 +642,10 @@ unsigned short ICQ::processUdpPacket(Packet &packet) char *alias, *firstName, *lastName, *email;
unsigned char auth;
- alias = NULL;
- firstName = NULL;
- lastName = NULL;
- email = NULL;
+ alias = nullptr;
+ firstName = nullptr;
+ lastName = nullptr;
+ email = nullptr;
packet >> checkUin >> alias >> firstName >> lastName >> email >> auth;
{
ICQSEARCHRESULT psr = { 0 };
@@ -696,7 +696,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) packet >> checkUin
>> newCommand;
- processSystemMessage(packet, checkUin, newCommand, time(NULL));
+ processSystemMessage(packet, checkUin, newCommand, time(nullptr));
break;
case ICQ_CMDxRCV_SYSxMSGxDONE: // end of system messages
@@ -778,7 +778,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) packet >> checkUin
>> newCommand;
- processSystemMessage(packet, checkUin, newCommand, time(NULL));
+ processSystemMessage(packet, checkUin, newCommand, time(nullptr));
break;
case ICQ_CMDxRCV_BROADCASTxDONE:
@@ -822,8 +822,8 @@ unsigned short ICQ::processUdpPacket(Packet &packet) case ICQ_CMDxRCV_WRONGxPASSWD: // incorrect password sent in logon
T("[udp] incorrect password.\n");
- ProtoBroadcastAck(protoName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
- MessageBox(NULL, Translate("Your ICQ Corp number and password combination was rejected by the ICQ Corporate server. Please go to Options -> Network -> ICQCorp and try again."), protoName, MB_ICONERROR | MB_OK);
+ ProtoBroadcastAck(protoName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPASSWORD);
+ MessageBox(nullptr, Translate("Your ICQ Corp number and password combination was rejected by the ICQ Corporate server. Please go to Options -> Network -> ICQCorp and try again."), protoName, MB_ICONERROR | MB_OK);
break;
case ICQ_CMDxRCV_BUSY: // server too busy to respond
@@ -849,7 +849,7 @@ void ICQ::processSystemMessage(Packet &packet, unsigned long checkUin, unsigned u = getUserByUIN(checkUin);
- message = NULL;
+ message = nullptr;
packet >> message;
switch (newCommand) {
@@ -1023,7 +1023,7 @@ ICQUser *ICQ::getUserByUIN(unsigned long uin, bool allowAdd) }
T("ICQ sent unknown user %d\n", uin);
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1040,7 +1040,7 @@ ICQUser *ICQ::getUserByContact(MCONTACT hContact) u = icqUsers[i];
if (u->hContact == hContact) return u;
}
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1118,7 +1118,7 @@ void ICQ::updateContactList() for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
proto = GetContactProto(hContact);
if (proto && !mir_strcmp(proto, protoName)) {
- if ((u = getUserByContact(hContact)) == NULL) {
+ if ((u = getUserByContact(hContact)) == nullptr) {
u = new ICQUser();
u->hContact = hContact;
u->uin = db_get_dw(hContact, protoName, "UIN", 0);
@@ -1361,7 +1361,7 @@ ICQEvent *ICQ::send(ICQUser *u, unsigned short cmd, char *cmdStr, char *m) {
ICQEvent *result;
- if (u->statusVal > ID_STATUS_OFFLINE && (result = sendTCP(u, cmd, cmdStr, m)) != NULL) return result;
+ if (u->statusVal > ID_STATUS_OFFLINE && (result = sendTCP(u, cmd, cmdStr, m)) != nullptr) return result;
else return sendUDP(u, cmd, cmdStr, m);
}
@@ -1408,7 +1408,7 @@ bool ICQ::openConnection(TCPSocket &socket) ICQEvent *ICQ::sendTCP(ICQUser *u, unsigned short cmd, char *cmdStr, char *m)
{
if (!u->socket.connected() && !openConnection(u->socket))
- return NULL;
+ return nullptr;
unsigned int status;
switch (statusVal) {
@@ -1540,7 +1540,7 @@ ICQEvent *ICQ::sendReadAwayMsg(ICQUser *u) case ID_STATUS_NA: cmd = ICQ_CMDxTCP_READxNAxMSG; break;
case ID_STATUS_OCCUPIED: cmd = ICQ_CMDxTCP_READxOCCUPIEDxMSG; break;
case ID_STATUS_FREECHAT: cmd = ICQ_CMDxTCP_READxFREECHATxMSG; break;
- default: return NULL;
+ default: return nullptr;
}
return sendTCP(u, cmd, "away message request", "");
@@ -1551,7 +1551,7 @@ ICQEvent *ICQ::sendReadAwayMsg(ICQUser *u) ICQTransfer *ICQ::sendFile(ICQUser *u, char *description, char *filename, unsigned int size, char **files)
{
if (!u->socket.connected() && !openConnection(u->socket))
- return NULL;
+ return nullptr;
unsigned int i;
@@ -1560,7 +1560,7 @@ ICQTransfer *ICQ::sendFile(ICQUser *u, char *description, char *filename, unsign for (i = 0; files[i]; i++);
transfer->files = new char*[i + 1];
for (i = 0; files[i]; i++) transfer->files[i] = _strdup(files[i]);
- transfer->files[i] = 0;
+ transfer->files[i] = nullptr;
transfer->description = _strdup(description);
transfer->count = i;
@@ -1568,7 +1568,7 @@ ICQTransfer *ICQ::sendFile(ICQUser *u, char *description, char *filename, unsign transfer->path = _strdup(transfer->files[0]);
char *s = strrchr(transfer->path, '\\');
- if (s != NULL)
+ if (s != nullptr)
*s = 0;
icqTransfers.push_back(transfer);
@@ -1752,7 +1752,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket) unsigned int i, checkUin, senderIp, localIp, userStatus, senderPort, junkLong, thePort, theTCPSequence = 0;
unsigned short version, command, junkShort, newCommand, /*messageLen,*/ cicqVersion;
unsigned char cicqChar, junkChar;
- char *message = NULL;
+ char *message = nullptr;
ICQUser *u;
static unsigned int chatUin, chatSequence;
@@ -1779,7 +1779,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket) packet >> theTCPSequence;
ackTCP(packet, u, newCommand, theTCPSequence);
- addMessage(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_MSG, theTCPSequence, time(NULL));
+ addMessage(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_MSG, theTCPSequence, time(nullptr));
break;
case ICQ_CMDxTCP_CHAT:
@@ -1800,14 +1800,14 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket) packet >> theTCPSequence;
ackTCP(packet, u, newCommand, theTCPSequence);
- addUrl(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_URL, theTCPSequence, time(NULL));
+ addUrl(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_URL, theTCPSequence, time(nullptr));
break;
case ICQ_CMDxTCP_FILE:
unsigned int size;
char *fileName;
- fileName = NULL;
+ fileName = nullptr;
packet >> junkLong
>> fileName
>> size
@@ -1816,7 +1816,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket) T("[tcp] file transfer request from %d (%d)\n", checkUin, theTCPSequence);
- addFileReq(u, message, fileName, size, ICQ_CMDxTCP_START, ICQ_CMDxTCP_FILE, theTCPSequence, time(NULL));
+ addFileReq(u, message, fileName, size, ICQ_CMDxTCP_START, ICQ_CMDxTCP_FILE, theTCPSequence, time(nullptr));
delete[] fileName;
break;
@@ -1901,7 +1901,7 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket) case ICQ_CMDxTCP_READxDNDxMSG:
case ICQ_CMDxTCP_READxFREECHATxMSG:
packet >> theTCPSequence;
- addAwayMsg(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_READxAWAYxMSG, theTCPSequence, time(NULL));
+ addAwayMsg(u, message, ICQ_CMDxTCP_START, ICQ_CMDxTCP_READxAWAYxMSG, theTCPSequence, time(nullptr));
break;
}
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index c9a3442b65..d182c0bc33 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -164,7 +164,7 @@ static INT_PTR icqGetInfo(WPARAM, LPARAM lParam) CCSDATA *ccs = (CCSDATA *)lParam;
ICQUser *u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || icq.statusVal <= ID_STATUS_OFFLINE)
+ if (u == nullptr || icq.statusVal <= ID_STATUS_OFFLINE)
return 1;
icq.getUserInfo(u, ccs->wParam & SGIF_MINIMAL);
@@ -180,7 +180,7 @@ static INT_PTR icqSendMessage(WPARAM, LPARAM lParam) CCSDATA *ccs = (CCSDATA *)lParam;
ICQUser *u = icq.getUserByContact(ccs->hContact);
// uin = db_get_dw(ccs->hContact, ICQCORP_PROTONAME, "UIN", 0);
- if (u == NULL || icq.statusVal <= ID_STATUS_OFFLINE)
+ if (u == nullptr || icq.statusVal <= ID_STATUS_OFFLINE)
return 0;
ICQEvent *icqEvent = icq.sendMessage(u, ptrA(mir_utf8decodeA((char*)ccs->lParam)));
@@ -220,7 +220,7 @@ static INT_PTR icqSendUrl(WPARAM, LPARAM lParam) T("[ ] send url\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || icq.statusVal <= ID_STATUS_OFFLINE)
+ if (u == nullptr || icq.statusVal <= ID_STATUS_OFFLINE)
return 0;
icqEvent = icq.sendUrl(u, (char*)ccs->lParam);
@@ -277,7 +277,7 @@ static INT_PTR icqGetAwayMsg(WPARAM, LPARAM lParam) T("[ ] send get away msg\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || u->statusVal <= ID_STATUS_ONLINE) return 0;
+ if (u == nullptr || u->statusVal <= ID_STATUS_ONLINE) return 0;
icqEvent = icq.sendReadAwayMsg(u);
return icqEvent ? icqEvent->sequence : 0;
@@ -308,7 +308,7 @@ static INT_PTR icqSendFile(WPARAM, LPARAM lParam) T("[ ] send file\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || u->statusVal == ID_STATUS_OFFLINE || icq.statusVal <= ID_STATUS_OFFLINE) return 0;
+ if (u == nullptr || u->statusVal == ID_STATUS_OFFLINE || icq.statusVal <= ID_STATUS_OFFLINE) return 0;
unsigned long filesCount, directoriesCount, filesSize = 0;
char filename[MAX_PATH], format[32];
@@ -347,7 +347,7 @@ static INT_PTR icqFileAllow(WPARAM, LPARAM lParam) T("[ ] send accept file request\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || u->statusVal == ID_STATUS_OFFLINE) return 0;
+ if (u == nullptr || u->statusVal == ID_STATUS_OFFLINE) return 0;
t->path = _strdup((char*)ccs->lParam);
@@ -366,7 +366,7 @@ static INT_PTR icqFileDeny(WPARAM, LPARAM lParam) T("[ ] send refuse file request\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || u->statusVal == ID_STATUS_OFFLINE) return 0;
+ if (u == nullptr || u->statusVal == ID_STATUS_OFFLINE) return 0;
icq.refuseFile(u, t->sequence, (char*)ccs->lParam);
@@ -393,7 +393,7 @@ static INT_PTR icqFileCancel(WPARAM, LPARAM lParam) T("[ ] file cancel\n");
u = icq.getUserByContact(ccs->hContact);
- if (u == NULL || u->statusVal == ID_STATUS_OFFLINE) return 0;
+ if (u == nullptr || u->statusVal == ID_STATUS_OFFLINE) return 0;
// icq.refuseFile(u, t->sequence, (char*)ccs->lParam);
@@ -485,7 +485,7 @@ static int icqContactDeleted(WPARAM wParam, LPARAM) T("[ ] contact deleted\n");
- if ((u = icq.getUserByContact((MCONTACT)wParam)) != NULL) icq.removeUser(u);
+ if ((u = icq.getUserByContact((MCONTACT)wParam)) != nullptr) icq.removeUser(u);
return 0;
}
diff --git a/protocols/ICQCorp/src/socket.cpp b/protocols/ICQCorp/src/socket.cpp index eae8642411..7b32969a38 100644 --- a/protocols/ICQCorp/src/socket.cpp +++ b/protocols/ICQCorp/src/socket.cpp @@ -111,7 +111,7 @@ unsigned long Socket::lookup(char *h) // try and resolve hostname
struct hostent *host = gethostbyname(h);
- if (host == NULL) // Couldn't resolve hostname/ip
+ if (host == nullptr) // Couldn't resolve hostname/ip
return 0;
// return the ip
diff --git a/protocols/ICQCorp/src/transfer.cpp b/protocols/ICQCorp/src/transfer.cpp index a6c6b992e6..3bf64e3c1e 100644 --- a/protocols/ICQCorp/src/transfer.cpp +++ b/protocols/ICQCorp/src/transfer.cpp @@ -25,7 +25,7 @@ std::vector <ICQTransfer *> icqTransfers; void WINAPI transferTimerProc(HWND, UINT, UINT_PTR hTimer, DWORD)
{
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
for (size_t i = 0; i < icqTransfers.size(); i++)
if (hTimer == icqTransfers[i]->hTimer)
@@ -40,14 +40,14 @@ ICQTransfer::ICQTransfer(ICQUser *u, unsigned int theSequence) : uin = u->uin;
hContact = u->hContact;
sequence = theSequence;
- files = NULL;
- description = NULL;
- path = NULL;
+ files = nullptr;
+ description = nullptr;
+ path = nullptr;
sending = 0;
speed = 100;
count = 0;
current = -1;
- fileName = NULL;
+ fileName = nullptr;
fileSize = 0;
fileProgress = 0;
totalSize = 0;
@@ -70,7 +70,7 @@ void ICQTransfer::processTcpPacket(Packet &packet) {
unsigned int /*i,*/ status, junkLong;
unsigned char cmd/*, junkChar*/;
- char *name = NULL, *directoryName = NULL;
+ char *name = nullptr, *directoryName = nullptr;
packet >> cmd;
switch (cmd) {
@@ -160,7 +160,7 @@ void ICQTransfer::processTcpPacket(Packet &packet) case 0x06:
unsigned long result;
- WriteFile(hFile, packet.data(), packet.dataSize(), &result, NULL);
+ WriteFile(hFile, packet.data(), packet.dataSize(), &result, nullptr);
fileProgress += result;
totalProgress += result;
@@ -283,7 +283,7 @@ void ICQTransfer::sendPacket0x06() packet << (unsigned char)0x06;
unsigned long result;
- ReadFile(hFile, packet.data(), 2048, &result, NULL);
+ ReadFile(hFile, packet.data(), 2048, &result, nullptr);
if (result == 0)
return;
@@ -354,7 +354,7 @@ void ICQTransfer::process() ack(ACKRESULT_DATA);
if (fileProgress < fileSize)
- hTimer = SetTimer(NULL, 0, 1, transferTimerProc);
+ hTimer = SetTimer(nullptr, 0, 1, transferTimerProc);
else if (current < count - 1)
sendPacket0x02();
}
@@ -425,29 +425,29 @@ void ICQTransfer::openFile() }
directory = 0;
- hFile = CreateFile(fileName, sending ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL);
+ hFile = CreateFile(fileName, sending ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
char msg[2048];
T("can't open file %s\n", fileName);
sprintf(msg, "%s\n%s", sending ? Translate("Your file transfer has been aborted because one of the files that you selected to send is no longer readable from the disk. You may have deleted or moved it.") : Translate("Your file receive has been aborted because Miranda could not open the destination file in order to write to it. You may be trying to save to a read-only folder."), fileName);
- MessageBox(NULL, msg, Translate(protoName), MB_ICONWARNING | MB_OK);
+ MessageBox(nullptr, msg, Translate(protoName), MB_ICONWARNING | MB_OK);
return;
}
__int64 fileTime;
if (sending) {
fileProgress = 0;
- fileSize = GetFileSize(hFile, NULL);
+ fileSize = GetFileSize(hFile, nullptr);
- GetFileTime(hFile, NULL, NULL, (LPFILETIME)&fileTime);
+ GetFileTime(hFile, nullptr, nullptr, (LPFILETIME)&fileTime);
fileDate = fileTime / 10000000 - 11644473600i64;
}
else {
- fileProgress = GetFileSize(hFile, NULL);
+ fileProgress = GetFileSize(hFile, nullptr);
fileTime = (11644473600i64 + (__int64)fileDate) * 10000000;
- SetFileTime(hFile, NULL, NULL, (LPFILETIME)&fileTime);
+ SetFileTime(hFile, nullptr, nullptr, (LPFILETIME)&fileTime);
}
}
@@ -464,7 +464,7 @@ void ICQTransfer::closeFile() void ICQTransfer::setFilePosition()
{
if (hFile != INVALID_HANDLE_VALUE)
- SetFilePointer(hFile, fileProgress, NULL, FILE_BEGIN);
+ SetFilePointer(hFile, fileProgress, nullptr, FILE_BEGIN);
}
///////////////////////////////////////////////////////////////////////////////
@@ -475,7 +475,7 @@ void ICQTransfer::createDirectory() SetCurrentDirectory(path);
fileName = files[current];
- CreateDirectory(fileName, NULL);
+ CreateDirectory(fileName, nullptr);
fileProgress = 0;
}
diff --git a/protocols/ICQCorp/src/user.cpp b/protocols/ICQCorp/src/user.cpp index c66eec6539..576210c16a 100644 --- a/protocols/ICQCorp/src/user.cpp +++ b/protocols/ICQCorp/src/user.cpp @@ -92,7 +92,7 @@ static char* iptoa(unsigned int ip) static void setTextValue(HWND hWnd, int id, char *value)
{
- bool unspecified = value == NULL;
+ bool unspecified = value == nullptr;
EnableWindow(GetDlgItem(hWnd, id), !unspecified);
SetDlgItemText(hWnd, id, unspecified ? Translate("<not specified>") : value);
@@ -120,18 +120,18 @@ static INT_PTR CALLBACK icqUserInfoDlgProc(HWND hWnd, UINT msg, WPARAM wParam, L setTextValue(hWnd, IDC_INFO_UIN, buffer);
ip = db_get_dw(hContact, protoName, "IP", 0);
- setTextValue(hWnd, IDC_INFO_IP, ip ? iptoa(ip) : NULL);
+ setTextValue(hWnd, IDC_INFO_IP, ip ? iptoa(ip) : nullptr);
ip = db_get_dw(hContact, protoName, "RealIP", 0);
- setTextValue(hWnd, IDC_INFO_REALIP, ip ? iptoa(ip) : NULL);
+ setTextValue(hWnd, IDC_INFO_REALIP, ip ? iptoa(ip) : nullptr);
port = db_get_w(hContact, protoName, "Port", 0);
_itoa(port, buffer, 10);
- setTextValue(hWnd, IDC_INFO_PORT, port ? buffer : NULL);
+ setTextValue(hWnd, IDC_INFO_PORT, port ? buffer : nullptr);
- setTextValue(hWnd, IDC_INFO_VERSION, NULL);
- setTextValue(hWnd, IDC_INFO_MIRVER, NULL);
- setTextValue(hWnd, IDC_INFO_PING, NULL);
+ setTextValue(hWnd, IDC_INFO_VERSION, nullptr);
+ setTextValue(hWnd, IDC_INFO_MIRVER, nullptr);
+ setTextValue(hWnd, IDC_INFO_PING, nullptr);
}
break;
@@ -147,7 +147,7 @@ static INT_PTR CALLBACK icqUserInfoDlgProc(HWND hWnd, UINT msg, WPARAM wParam, L int icqUserInfoInitialise(WPARAM wParam, LPARAM lParam)
{
char *proto = GetContactProto(lParam);
- if ((proto == NULL || mir_strcmp(proto, protoName)) && lParam)
+ if ((proto == nullptr || mir_strcmp(proto, protoName)) && lParam)
return 0;
OPTIONSDIALOGPAGE odp = { 0 };
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index 1b5cf219c1..8409c501e7 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -29,14 +29,14 @@ BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmas char szService[256];
bool bFlag = false;
- CONTACT usertemp = { name, NULL, NULL, false, false, true };
+ CONTACT usertemp = { name, nullptr, nullptr, false, false, true };
MCONTACT hc = CList_FindContact(&usertemp);
if (hc && db_get_b(hc, "CList", "NotOnList", 0) == 0 && db_get_b(hc, "CList", "Hidden", 0) == 0)
bFlag = true;
CMStringW contactname = name; contactname += DCCSTRING;
- CONTACT user = { contactname, NULL, NULL, false, false, true };
+ CONTACT user = { contactname, nullptr, nullptr, false, false, true };
hContact = CList_AddContact(&user, false, false);
setByte(hContact, "DCC", 1);
@@ -82,7 +82,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmas MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline)
{
- if (user->name == NULL)
+ if (user->name == nullptr)
return 0;
MCONTACT hContact = CList_FindContact(user);
@@ -198,7 +198,7 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user) hContact_temp = hContact;
}
}
- else if (wcschr(user->name, ' ') == 0) {
+ else if (wcschr(user->name, ' ') == nullptr) {
if ((DBDefault && !mir_wstrcmpi(DBDefault, user->name) || DBNick && !mir_wstrcmpi(DBNick, user->name) ||
DBWildcard && WCCmp(DBWildcard, lowercasename))
&& (WCCmp(DBUser, user->user) && WCCmp(DBHost, user->host))) {
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index a7d5974d56..5601a07dfc 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -30,7 +30,7 @@ using namespace irc; VOID CALLBACK IdentTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
{
CIrcProto *ppro = GetTimerOwner(idEvent);
- if (ppro == NULL)
+ if (ppro == nullptr)
return;
ppro->KillChatTimer(ppro->IdentTimer);
@@ -44,7 +44,7 @@ VOID CALLBACK IdentTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
{
CIrcProto *ppro = GetTimerOwner(idEvent);
- if (ppro == NULL)
+ if (ppro == nullptr)
return;
ppro->KillChatTimer(ppro->InitTimer);
@@ -61,7 +61,7 @@ VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) VOID CALLBACK KeepAliveTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
{
CIrcProto *ppro = GetTimerOwner(idEvent);
- if (ppro == NULL)
+ if (ppro == nullptr)
return;
if (!ppro->m_sendKeepAlive || (ppro->m_iStatus == ID_STATUS_OFFLINE || ppro->m_iStatus == ID_STATUS_CONNECTING)) {
@@ -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(0));
+ mir_snwprintf(temp2, L"PING %u", time(nullptr));
if (ppro->IsConnected())
ppro->SendIrcMessage(temp2, false);
@@ -82,7 +82,7 @@ VOID CALLBACK KeepAliveTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD)
{
CIrcProto *ppro = GetTimerOwner(idEvent);
- if (ppro == NULL)
+ if (ppro == nullptr)
return;
if (!ppro->m_channelAwayNotification ||
@@ -126,7 +126,7 @@ VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD) VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
{
CIrcProto *ppro = GetTimerOwner(idEvent);
- if (ppro == NULL)
+ if (ppro == nullptr)
return;
if (ppro->m_iStatus == ID_STATUS_OFFLINE || ppro->m_iStatus == ID_STATUS_CONNECTING ||
@@ -164,8 +164,8 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) db_free(&dbv);
DBVARIANT dbv2;
- wchar_t* DBNick = NULL;
- wchar_t* DBWildcard = NULL;
+ wchar_t* DBNick = nullptr;
+ wchar_t* DBWildcard = nullptr;
if (!ppro->getWString(hContact, "Nick", &dbv))
DBNick = dbv.ptszVal;
if (!ppro->getWString(hContact, "UWildcard", &dbv2))
@@ -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(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.flags = DBEF_SENT + DBEF_UTF;
dbei.pBlob = (PBYTE)mir_utf8encodeW(S);
dbei.cbBlob = (DWORD)mir_strlen((char*)dbei.pBlob) + 1;
@@ -242,7 +242,7 @@ void __cdecl CIrcProto::ResolveIPThread(void *di) {
mir_cslock lock(m_resolve);
- if (ipr != NULL && (ipr->iType == IP_AUTO && mir_strlen(m_myHost) == 0 || ipr->iType == IP_MANUAL)) {
+ if (ipr != nullptr && (ipr->iType == IP_AUTO && mir_strlen(m_myHost) == 0 || ipr->iType == IP_MANUAL)) {
hostent* myhost = gethostbyname(ipr->sAddr);
if (myhost) {
IN_ADDR in;
@@ -361,8 +361,8 @@ bool CIrcProto::OnIrc_JOIN(const CIrcMessage* pmsg) {
if (pmsg->parameters.getCount() > 0 && pmsg->m_bIncoming && pmsg->prefix.sNick != m_info.sNick) {
CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
- DoEvent(GC_EVENT_JOIN, pmsg->parameters[0], pmsg->prefix.sNick, NULL, TranslateT("Normal"), host, NULL, true, false);
- DoEvent(GC_EVENT_SETCONTACTSTATUS, pmsg->parameters[0], pmsg->prefix.sNick, NULL, NULL, NULL, ID_STATUS_ONLINE, FALSE, FALSE);
+ DoEvent(GC_EVENT_JOIN, pmsg->parameters[0], pmsg->prefix.sNick, nullptr, TranslateT("Normal"), host, NULL, true, false);
+ DoEvent(GC_EVENT_SETCONTACTSTATUS, pmsg->parameters[0], pmsg->prefix.sNick, nullptr, nullptr, nullptr, ID_STATUS_ONLINE, FALSE, FALSE);
}
else ShowMessage(pmsg);
@@ -373,11 +373,11 @@ bool CIrcProto::OnIrc_QUIT(const CIrcMessage* pmsg) {
if (pmsg->m_bIncoming) {
CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
- DoEvent(GC_EVENT_QUIT, NULL, pmsg->prefix.sNick, pmsg->parameters.getCount() > 0 ? pmsg->parameters[0].c_str() : NULL, NULL, host, NULL, true, false);
+ DoEvent(GC_EVENT_QUIT, nullptr, pmsg->prefix.sNick, pmsg->parameters.getCount() > 0 ? pmsg->parameters[0].c_str() : nullptr, nullptr, host, NULL, true, false);
CONTACT user = { pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, false, false, false };
CList_SetOffline(&user);
if (pmsg->prefix.sNick == m_info.sNick)
- Chat_Control(m_szModuleName, NULL, SESSION_OFFLINE);
+ Chat_Control(m_szModuleName, nullptr, SESSION_OFFLINE);
}
else ShowMessage(pmsg);
@@ -388,7 +388,7 @@ bool CIrcProto::OnIrc_PART(const CIrcMessage* pmsg) {
if (pmsg->parameters.getCount() > 0 && pmsg->m_bIncoming) {
CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
- DoEvent(GC_EVENT_PART, pmsg->parameters[0], pmsg->prefix.sNick, pmsg->parameters.getCount() > 1 ? pmsg->parameters[1].c_str() : NULL, NULL, host, NULL, true, false);
+ DoEvent(GC_EVENT_PART, pmsg->parameters[0], pmsg->prefix.sNick, pmsg->parameters.getCount() > 1 ? pmsg->parameters[1].c_str() : nullptr, nullptr, host, NULL, true, false);
if (pmsg->prefix.sNick == m_info.sNick) {
CMStringW S = MakeWndID(pmsg->parameters[0]);
Chat_Control(m_szModuleName, S, SESSION_OFFLINE);
@@ -402,7 +402,7 @@ bool CIrcProto::OnIrc_PART(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_KICK(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1)
- DoEvent(GC_EVENT_KICK, pmsg->parameters[0], pmsg->parameters[1], pmsg->parameters.getCount() > 2 ? pmsg->parameters[2].c_str() : NULL, pmsg->prefix.sNick, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_KICK, pmsg->parameters[0], pmsg->parameters[1], pmsg->parameters.getCount() > 2 ? pmsg->parameters[2].c_str() : nullptr, pmsg->prefix.sNick, nullptr, NULL, true, false);
else
ShowMessage(pmsg);
@@ -450,7 +450,7 @@ bool CIrcProto::OnIrc_MODEQUERY(const CIrcMessage* pmsg) p1++;
}
- AddWindowItemData(pmsg->parameters[1], sLimit.IsEmpty() ? 0 : sLimit.c_str(), pmsg->parameters[2], sPassword.IsEmpty() ? 0 : sPassword.c_str(), 0);
+ AddWindowItemData(pmsg->parameters[1], sLimit.IsEmpty() ? nullptr : sLimit.c_str(), pmsg->parameters[2], sPassword.IsEmpty() ? nullptr : sPassword.c_str(), nullptr);
}
ShowMessage(pmsg);
return true;
@@ -515,7 +515,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) Chat_SetUserInfo(m_szModuleName, windowName, wi);
}
- DoEvent(bAdd ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS, pmsg->parameters[0], pmsg->parameters[iParametercount], pmsg->prefix.sNick, sStatus, NULL, NULL, m_oldStyleModes ? false : true, false);
+ DoEvent(bAdd ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS, pmsg->parameters[0], pmsg->parameters[iParametercount], pmsg->prefix.sNick, sStatus, nullptr, NULL, m_oldStyleModes ? false : true, false);
iParametercount++;
}
}
@@ -537,7 +537,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) for (int i = 2; i < (int)pmsg->parameters.getCount(); i++)
sMessage += L" " + pmsg->parameters[i];
- DoEvent(GC_EVENT_INFORMATION, pmsg->parameters[0], pmsg->prefix.sNick, sMessage, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, pmsg->parameters[0], pmsg->prefix.sNick, sMessage, nullptr, nullptr, NULL, true, false);
}
else if (bContainsValidModes) {
for (int i = iParametercount; i < (int)pmsg->parameters.getCount(); i++)
@@ -545,7 +545,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) wchar_t temp[4000];
mir_snwprintf(temp, TranslateT("%s sets mode %s%s"), pmsg->prefix.sNick.c_str(), sModes.c_str(), sParams.c_str());
- DoEvent(GC_EVENT_INFORMATION, pmsg->parameters[0].c_str(), pmsg->prefix.sNick, temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, pmsg->parameters[0].c_str(), pmsg->prefix.sNick, temp, nullptr, nullptr, NULL, true, false);
}
if (flag)
@@ -559,7 +559,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) for (int i = 2; i < (int)pmsg->parameters.getCount(); i++)
sMessage += L" " + pmsg->parameters[i];
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, pmsg->prefix.sNick, sMessage, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, pmsg->prefix.sNick, sMessage, nullptr, nullptr, NULL, true, false);
}
}
else ShowMessage(pmsg);
@@ -578,8 +578,8 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage* pmsg) }
CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
- DoEvent(GC_EVENT_NICK, NULL, pmsg->prefix.sNick, pmsg->parameters[0], NULL, host, NULL, true, bIsMe);
- Chat_ChangeUserId(m_szModuleName, NULL, pmsg->prefix.sNick, pmsg->parameters[0]);
+ DoEvent(GC_EVENT_NICK, nullptr, pmsg->prefix.sNick, pmsg->parameters[0], nullptr, host, NULL, true, bIsMe);
+ Chat_ChangeUserId(m_szModuleName, nullptr, pmsg->prefix.sNick, pmsg->parameters[0]);
CONTACT user = { pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
@@ -631,7 +631,7 @@ bool CIrcProto::OnIrc_NOTICE(const CIrcMessage* pmsg) }
else S2 = L"";
}
- DoEvent(GC_EVENT_NOTICE, S2.IsEmpty() ? 0 : S2.c_str(), S, pmsg->parameters[1], NULL, S3, NULL, true, false);
+ DoEvent(GC_EVENT_NOTICE, S2.IsEmpty() ? nullptr : S2.c_str(), S, pmsg->parameters[1], nullptr, S3, NULL, true, false);
}
}
else ShowMessage(pmsg);
@@ -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(NULL);
+ pre.timestamp = (DWORD)time(nullptr);
pre.szMessage = mir_utf8encodeW(mess);
setWString(hContact, "User", pmsg->prefix.sUser);
setWString(hContact, "Host", pmsg->prefix.sHost);
@@ -717,7 +717,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg) if (!(pmsg->m_bIncoming && m_ignore && IsIgnored(pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'm'))) {
if (!pmsg->m_bIncoming)
mess.Replace(L"%%", L"%");
- DoEvent(GC_EVENT_MESSAGE, pmsg->parameters[0], pmsg->m_bIncoming ? pmsg->prefix.sNick : m_info.sNick, mess, NULL, NULL, NULL, true, pmsg->m_bIncoming ? false : true);
+ DoEvent(GC_EVENT_MESSAGE, pmsg->parameters[0], pmsg->m_bIncoming ? pmsg->prefix.sNick : m_info.sNick, mess, nullptr, nullptr, NULL, true, pmsg->m_bIncoming ? false : true);
}
return true;
}
@@ -743,7 +743,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) CMStringW temp(FORMAT,
TranslateT("CTCP ERROR: Malformed CTCP command received from %s!%s@%s. Possible attempt to take control of your IRC client registered"),
pmsg->prefix.sNick.c_str(), pmsg->prefix.sUser.c_str(), pmsg->prefix.sHost.c_str());
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick, temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick, temp, nullptr, nullptr, NULL, true, false);
return true;
}
@@ -783,7 +783,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) if (!pmsg->m_bIncoming)
mess.Replace(L"%%", L"%");
- DoEvent(GC_EVENT_ACTION, pmsg->parameters[0], pmsg->m_bIncoming ? pmsg->prefix.sNick : m_info.sNick, mess, NULL, NULL, NULL, true, pmsg->m_bIncoming ? false : true);
+ DoEvent(GC_EVENT_ACTION, pmsg->parameters[0], pmsg->m_bIncoming ? pmsg->prefix.sNick : m_info.sNick, mess, nullptr, nullptr, NULL, true, pmsg->m_bIncoming ? false : true);
}
}
else if (pmsg->m_bIncoming) {
@@ -801,7 +801,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) wchar_t temp[300];
mir_snwprintf(temp, TranslateT("CTCP FINGER requested by %s"), pmsg->prefix.sNick.c_str());
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, temp, nullptr, nullptr, NULL, true, false);
}
// incoming VERSION
@@ -810,7 +810,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) wchar_t temp[300];
mir_snwprintf(temp, TranslateT("CTCP VERSION requested by %s"), pmsg->prefix.sNick.c_str());
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, temp, nullptr, nullptr, NULL, true, false);
}
// incoming SOURCE
@@ -819,7 +819,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) wchar_t temp[300];
mir_snwprintf(temp, TranslateT("CTCP SOURCE requested by %s"), pmsg->prefix.sNick.c_str());
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, temp, nullptr, nullptr, NULL, true, false);
}
// incoming USERINFO
@@ -828,7 +828,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) wchar_t temp[300];
mir_snwprintf(temp, TranslateT("CTCP USERINFO requested by %s"), pmsg->prefix.sNick.c_str());
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, temp, nullptr, nullptr, NULL, true, false);
}
// incoming PING
@@ -837,18 +837,18 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) wchar_t temp[300];
mir_snwprintf(temp, TranslateT("CTCP PING requested by %s"), pmsg->prefix.sNick.c_str());
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, temp, nullptr, nullptr, NULL, true, false);
}
// incoming TIME
else if (pmsg->m_bIncoming && command == L"time") {
wchar_t temp[300];
- time_t tim = time(NULL);
+ time_t tim = time(nullptr);
mir_wstrncpy(temp, _wctime(&tim), 25);
PostIrcMessage(L"/NOTICE %s \001TIME %s\001", pmsg->prefix.sNick.c_str(), temp);
mir_snwprintf(temp, TranslateT("CTCP TIME requested by %s"), pmsg->prefix.sNick.c_str());
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, temp, nullptr, nullptr, NULL, true, false);
}
// incoming DCC request... lots of stuff happening here...
@@ -878,7 +878,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) begin = mess.Find(' ', end);
if (begin >= 0) {
CMStringW rest = mess.Mid(begin);
- dwAdr = wcstoul(GetWord(rest, 0), NULL, 10);
+ dwAdr = wcstoul(GetWord(rest, 0), nullptr, 10);
iPort = _wtoi(GetWord(rest, 1));
dwSize = _wtoi64(GetWord(rest, 2));
sToken = GetWord(rest, 3);
@@ -931,7 +931,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) free(p1);
- dwAdr = wcstoul(GetWord(mess, index - (bIsChat ? 2 : 3)), NULL, 10);
+ dwAdr = wcstoul(GetWord(mess, index - (bIsChat ? 2 : 3)), nullptr, 10);
iPort = _wtoi(GetWord(mess, index - (bIsChat ? 1 : 2)));
dwSize = _wtoi64(GetWord(mess, index - 1));
sToken = GetWord(mess, index);
@@ -1027,7 +1027,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) mir_snwprintf(szTemp, TranslateT("DCC ERROR: Malformed CTCP request from %s [%s]"), pmsg->prefix.sNick.c_str(), mess.c_str());
if (szTemp[0]) {
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick, szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick, szTemp, nullptr, nullptr, NULL, true, false);
return true;
}
@@ -1049,7 +1049,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) mir_snwprintf(szTemp, TranslateT("DCC ERROR: Malformed CTCP request from %s [%s]"), pmsg->prefix.sNick.c_str(), mess.c_str());
if (szTemp[0]) {
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick, szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick, szTemp, nullptr, nullptr, NULL, true, false);
return true;
}
@@ -1065,7 +1065,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // incoming chat request
if (bIsChat) {
- CONTACT user = { pmsg->prefix.sNick, 0, 0, false, false, true };
+ CONTACT user = { pmsg->prefix.sNick, nullptr, nullptr, false, false, true };
MCONTACT hContact = CList_FindContact(&user);
// check if it should be ignored
@@ -1079,7 +1079,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) else {
wchar_t szTemp[512];
mir_snwprintf(szTemp, TranslateT("DCC: Chat request from %s denied"), pmsg->prefix.sNick.c_str());
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick, szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick, szTemp, nullptr, nullptr, NULL, true, false);
}
}
@@ -1163,7 +1163,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
- pre.timestamp = (DWORD)time(NULL);
+ pre.timestamp = (DWORD)time(nullptr);
pre.fileCount = 1;
pre.files.w = &tszTemp;
pre.lParam = (LPARAM)di;
@@ -1176,7 +1176,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) else if (pmsg->m_bIncoming) {
wchar_t temp[300];
mir_snwprintf(temp, TranslateT("CTCP %s requested by %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str());
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, temp, nullptr, nullptr, NULL, true, false);
}
}
@@ -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(0) - (int)_wtol(GetWordAddress(mess, 1));
+ int s = (int)time(nullptr) - (int)_wtol(GetWordAddress(mess, 1));
wchar_t szTmp[30];
if (s == 1)
mir_snwprintf(szTmp, TranslateT("%u second"), s);
@@ -1219,13 +1219,13 @@ 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(0) - (int)_wtol(GetWordAddress(mess, 1));
+ int s = (int)time(nullptr) - (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, NULL, szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, szTemp, nullptr, nullptr, NULL, true, false);
}
else {
mir_snwprintf(szTemp, TranslateT("CTCP %s reply from %s: %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str(), GetWordAddress(mess, 1));
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, szTemp, nullptr, nullptr, NULL, true, false);
}
}
@@ -1316,17 +1316,17 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) else
btOwnMode = 0;
}
- gce.time = gce.bIsMe ? time(0) : 0;
+ gce.time = gce.bIsMe ? time(nullptr) : 0;
Chat_Event(&gce);
- DoEvent(GC_EVENT_SETCONTACTSTATUS, sChanName, sTemp, NULL, NULL, NULL, ID_STATUS_ONLINE, FALSE, FALSE);
+ DoEvent(GC_EVENT_SETCONTACTSTATUS, sChanName, sTemp, nullptr, nullptr, nullptr, ID_STATUS_ONLINE, FALSE, FALSE);
// fix for networks like freshirc where they allow more than one prefix
if (PrefixToStatus(sTemp2[0]) != pwszNormal) {
sTemp2.Delete(0, 1);
sStat = PrefixToStatus(sTemp2[0]);
while (sStat != pwszNormal) {
- DoEvent(GC_EVENT_ADDSTATUS, sID, sTemp, L"system", sStat, NULL, NULL, false, false, 0);
+ DoEvent(GC_EVENT_ADDSTATUS, sID, sTemp, L"system", sStat, nullptr, NULL, false, false, 0);
sTemp2.Delete(0, 1);
sStat = PrefixToStatus(sTemp2[0]);
}
@@ -1343,16 +1343,16 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) if (!wi)
wi = new CHANNELINFO;
wi->OwnMode = btOwnMode;
- wi->pszLimit = 0;
- wi->pszMode = 0;
- wi->pszPassword = 0;
- wi->pszTopic = 0;
+ wi->pszLimit = nullptr;
+ wi->pszMode = nullptr;
+ wi->pszPassword = nullptr;
+ wi->pszTopic = nullptr;
wi->codepage = getCodepage();
Chat_SetUserInfo(m_szModuleName, sID, wi);
if (!sTopic.IsEmpty() && !mir_wstrcmpi(GetWord(sTopic, 0), sChanName)) {
- DoEvent(GC_EVENT_TOPIC, sChanName, sTopicName.IsEmpty() ? NULL : sTopicName.c_str(), GetWordAddress(sTopic, 1), NULL, sTopicTime.IsEmpty() ? NULL : sTopicTime.c_str(), NULL, true, false);
- AddWindowItemData(sChanName, 0, 0, 0, GetWordAddress(sTopic, 1));
+ DoEvent(GC_EVENT_TOPIC, sChanName, sTopicName.IsEmpty() ? nullptr : sTopicName.c_str(), GetWordAddress(sTopic, 1), nullptr, sTopicTime.IsEmpty() ? nullptr : sTopicTime.c_str(), NULL, true, false);
+ AddWindowItemData(sChanName, nullptr, nullptr, nullptr, GetWordAddress(sTopic, 1));
sTopic = L"";
sTopicName = L"";
sTopicTime = L"";
@@ -1414,7 +1414,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_INITIALTOPIC(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 2) {
- AddWindowItemData(pmsg->parameters[1], 0, 0, 0, pmsg->parameters[2]);
+ AddWindowItemData(pmsg->parameters[1], nullptr, nullptr, nullptr, pmsg->parameters[2]);
sTopic = pmsg->parameters[1] + L" " + pmsg->parameters[2];
sTopicName = L"";
sTopicTime = L"";
@@ -1440,8 +1440,8 @@ bool CIrcProto::OnIrc_INITIALTOPICNAME(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_TOPIC(const CIrcMessage* pmsg)
{
if (pmsg->parameters.getCount() > 1 && pmsg->m_bIncoming) {
- DoEvent(GC_EVENT_TOPIC, pmsg->parameters[0], pmsg->prefix.sNick, pmsg->parameters[1], NULL, sTopicTime.IsEmpty() ? NULL : sTopicTime.c_str(), NULL, true, false);
- AddWindowItemData(pmsg->parameters[0], 0, 0, 0, pmsg->parameters[1]);
+ DoEvent(GC_EVENT_TOPIC, pmsg->parameters[0], pmsg->prefix.sNick, pmsg->parameters[1], nullptr, sTopicTime.IsEmpty() ? nullptr : sTopicTime.c_str(), NULL, true, false);
+ AddWindowItemData(pmsg->parameters[0], nullptr, nullptr, nullptr, pmsg->parameters[1]);
}
ShowMessage(pmsg);
return true;
@@ -1450,7 +1450,7 @@ bool CIrcProto::OnIrc_TOPIC(const CIrcMessage* pmsg) static void __stdcall sttShowDlgList(void* param)
{
CIrcProto *ppro = (CIrcProto*)param;
- if (ppro->m_listDlg == NULL) {
+ if (ppro->m_listDlg == nullptr) {
ppro->m_listDlg = new CListDlg(ppro);
ppro->m_listDlg->Show();
}
@@ -1490,7 +1490,7 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg) wchar_t* find = wcsstr(temp, L"[+");
wchar_t* find2 = wcsstr(temp, L"]");
wchar_t* save = temp;
- if (find == temp && find2 != NULL && find + 8 >= find2) {
+ if (find == temp && find2 != nullptr && find + 8 >= find2) {
temp = wcsstr(temp, L"]");
if (mir_wstrlen(temp) > 1) {
temp++;
@@ -1607,7 +1607,7 @@ static void __stdcall sttShowWhoisWnd(void* param) {
CIrcMessage* pmsg = (CIrcMessage*)param;
CIrcProto *ppro = (CIrcProto*)pmsg->m_proto;
- if (ppro->m_whoisDlg == NULL) {
+ if (ppro->m_whoisDlg == nullptr) {
ppro->m_whoisDlg = new CWhoisDlg(ppro);
ppro->m_whoisDlg->Show();
}
@@ -1661,7 +1661,7 @@ bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_WHOIS_END(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1 && m_manualWhoisCount < 1) {
- CONTACT user = { pmsg->parameters[1], NULL, NULL, false, false, true };
+ CONTACT user = { pmsg->parameters[1], nullptr, nullptr, false, false, true };
MCONTACT hContact = CList_FindContact(&user);
if (hContact)
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)WhoisAwayReply.c_str());
@@ -1736,7 +1736,7 @@ bool CIrcProto::OnIrc_WHOIS_NO_USER(const CIrcMessage* pmsg) if (m_whoisDlg)
m_whoisDlg->ShowMessageNoUser(pmsg);
- CONTACT user = { pmsg->parameters[1], NULL, NULL, false, false, false };
+ CONTACT user = { pmsg->parameters[1], nullptr, nullptr, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
if (hContact) {
AddOutgoingMessageToDB(hContact, (CMStringW)L"> " + pmsg->parameters[2] + (CMStringW)L": " + pmsg->parameters[1]);
@@ -1770,7 +1770,7 @@ static void __stdcall sttShowNickWnd(void* param) {
CIrcMessage* pmsg = (CIrcMessage*)param;
CIrcProto *ppro = pmsg->m_proto;
- if (ppro->m_nickDlg == NULL) {
+ if (ppro->m_nickDlg == nullptr) {
ppro->m_nickDlg = new CNickDlg(ppro);
ppro->m_nickDlg->Show();
}
@@ -1890,9 +1890,9 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) if (GetWord(m_whoReply, 3)[0] == 'G') {
S += User;
S += L"\t";
- DoEvent(GC_EVENT_SETCONTACTSTATUS, pmsg->parameters[1], User, NULL, NULL, NULL, ID_STATUS_AWAY, FALSE, FALSE);
+ DoEvent(GC_EVENT_SETCONTACTSTATUS, pmsg->parameters[1], User, nullptr, nullptr, nullptr, ID_STATUS_AWAY, FALSE, FALSE);
}
- else DoEvent(GC_EVENT_SETCONTACTSTATUS, pmsg->parameters[1], User, NULL, NULL, NULL, ID_STATUS_ONLINE, FALSE, FALSE);
+ else DoEvent(GC_EVENT_SETCONTACTSTATUS, pmsg->parameters[1], User, nullptr, nullptr, nullptr, ID_STATUS_ONLINE, FALSE, FALSE);
CMStringW SS = GetWordAddress(m_whoReply, 4);
if (SS.IsEmpty())
@@ -1901,7 +1901,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) User = GetWord(m_whoReply, 0);
}
- Chat_SetStatusEx(m_szModuleName, pmsg->parameters[1], GC_SSE_TABDELIMITED, S.IsEmpty() ? NULL : S.c_str());
+ Chat_SetStatusEx(m_szModuleName, pmsg->parameters[1], GC_SSE_TABDELIMITED, S.IsEmpty() ? nullptr : S.c_str());
return true;
}
@@ -1909,7 +1909,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) ptrW UserList(mir_wstrdup(m_whoReply));
const wchar_t* p1 = UserList;
m_whoReply = L"";
- CONTACT ccUser = { pmsg->parameters[1], NULL, NULL, false, true, false };
+ CONTACT ccUser = { pmsg->parameters[1], nullptr, nullptr, false, true, false };
MCONTACT hContact = CList_FindContact(&ccUser);
if (hContact && getByte(hContact, "AdvancedMode", 0) == 1) {
@@ -2012,7 +2012,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) if (pmsg->m_bIncoming) {
command = GetNextUserhostReason(1);
if (!command.IsEmpty() && command != L"U" && pmsg->parameters.getCount() > 1) {
- CONTACT finduser = { NULL, NULL, NULL, false, false, false };
+ CONTACT finduser = { nullptr, nullptr, nullptr, false, false, false };
int awaystatus = 0;
CMStringW sTemp;
CMStringW host;
@@ -2124,7 +2124,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) // Post message
if (!mess.IsEmpty())
- PostIrcMessageWnd(NULL, NULL, mess);
+ PostIrcMessageWnd(nullptr, NULL, mess);
}
// Status-check post-processing: make buddies in ckeck-list offline
@@ -2251,9 +2251,9 @@ void CIrcProto::OnIrcDisconnected() CMStringW sDisconn = L"\035\002";
sDisconn += TranslateT("*Disconnected*");
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, sDisconn, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, sDisconn, nullptr, nullptr, NULL, true, false);
- Chat_Control(m_szModuleName, NULL, SESSION_OFFLINE);
+ Chat_Control(m_szModuleName, nullptr, SESSION_OFFLINE);
if (!Miranda_IsTerminated())
CList_SetAllOffline(m_disconnectDCCChats);
@@ -2291,9 +2291,9 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) bPerformDone = true;
nickflag = true;
- Menu_ModifyItem(hMenuJoin, NULL, INVALID_HANDLE_VALUE, 0);
- Menu_ModifyItem(hMenuList, NULL, INVALID_HANDLE_VALUE, 0);
- Menu_ModifyItem(hMenuNick, NULL, INVALID_HANDLE_VALUE, 0);
+ Menu_ModifyItem(hMenuJoin, nullptr, INVALID_HANDLE_VALUE, 0);
+ Menu_ModifyItem(hMenuList, nullptr, INVALID_HANDLE_VALUE, 0);
+ Menu_ModifyItem(hMenuNick, nullptr, INVALID_HANDLE_VALUE, 0);
int Temp = m_iStatus;
m_iStatus = ID_STATUS_ONLINE;
@@ -2341,7 +2341,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) static void __cdecl AwayWarningThread(LPVOID)
{
Thread_SetName("IRC: AwayWarningThread");
- MessageBox(NULL, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK);
+ MessageBox(nullptr, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK);
}
int CIrcProto::DoPerform(const char* event)
@@ -2352,9 +2352,9 @@ int CIrcProto::DoPerform(const char* event) DBVARIANT dbv;
if (!getWString(sSetting, &dbv)) {
if (!my_strstri(dbv.ptszVal, L"/away"))
- PostIrcMessageWnd(NULL, NULL, dbv.ptszVal);
+ PostIrcMessageWnd(nullptr, NULL, dbv.ptszVal);
else
- mir_forkthread(AwayWarningThread, NULL);
+ mir_forkthread(AwayWarningThread, nullptr);
db_free(&dbv);
return 1;
}
@@ -2374,7 +2374,7 @@ int CIrcProto::IsIgnored(CMStringW user, char type) if (type == 0 && !mir_wstrcmpi(user, C.mask))
return i + 1;
- bool bUserContainsWild = (wcschr(user, '*') != NULL || wcschr(user, '?') != NULL);
+ bool bUserContainsWild = (wcschr(user, '*') != nullptr || wcschr(user, '?') != nullptr);
if (!bUserContainsWild && WCCmp(C.mask, user) ||
bUserContainsWild && !mir_wstrcmpi(user, C.mask)) {
if (C.flags.IsEmpty() || C.flags[0] != '+')
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index 84df4d72a5..6d0e79c5bf 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -108,7 +108,7 @@ CMStringW CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) if (p3)
p3 += 2;
}
- if (p3 != NULL) {
+ if (p3 != nullptr) {
hasAlias = true;
const wchar_t* p4 = wcsstr(p3, L"\r\n");
if (!p4)
@@ -195,7 +195,7 @@ CMStringW CIrcProto::DoIdentifiers(CMStringW text, const wchar_t*) static void __stdcall sttSetTimerOn(void* _pro)
{
CIrcProto *ppro = (CIrcProto*)_pro;
- ppro->DoEvent(GC_EVENT_INFORMATION, NULL, ppro->m_info.sNick.c_str(), TranslateT("The buddy check function is enabled"), NULL, NULL, NULL, true, false);
+ ppro->DoEvent(GC_EVENT_INFORMATION, nullptr, ppro->m_info.sNick.c_str(), TranslateT("The buddy check function is enabled"), nullptr, nullptr, NULL, true, false);
ppro->SetChatTimer(ppro->OnlineNotifTimer, 500, OnlineNotifTimerProc);
if (ppro->m_channelAwayNotification)
ppro->SetChatTimer(ppro->OnlineNotifTimer3, 1500, OnlineNotifTimerProc3);
@@ -204,7 +204,7 @@ static void __stdcall sttSetTimerOn(void* _pro) static void __stdcall sttSetTimerOff(void* _pro)
{
CIrcProto *ppro = (CIrcProto*)_pro;
- ppro->DoEvent(GC_EVENT_INFORMATION, NULL, ppro->m_info.sNick.c_str(), TranslateT("The buddy check function is disabled"), NULL, NULL, NULL, true, false);
+ ppro->DoEvent(GC_EVENT_INFORMATION, nullptr, ppro->m_info.sNick.c_str(), TranslateT("The buddy check function is disabled"), nullptr, nullptr, NULL, true, false);
ppro->KillChatTimer(ppro->OnlineNotifTimer);
ppro->KillChatTimer(ppro->OnlineNotifTimer3);
}
@@ -230,7 +230,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo if (swscanf(one.c_str(), L"%d", &ms) == 1 && ms > 0 && ms <= 4000)
Sleep(ms);
else
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Incorrect parameters. Usage: /sleep [ms], ms should be greater than 0 and less than 4000."), NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("Incorrect parameters. Usage: /sleep [ms], ms should be greater than 0 and less than 4000."), nullptr, nullptr, NULL, true, false);
}
return true;
}
@@ -258,19 +258,19 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo wchar_t temp[500];
if (one.IsEmpty()) {
if (m_ignore)
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is enabled"), NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("Ignore system is enabled"), nullptr, nullptr, NULL, true, false);
else
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is disabled"), NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("Ignore system is disabled"), nullptr, nullptr, NULL, true, false);
return true;
}
if (!mir_wstrcmpi(one.c_str(), L"on")) {
m_ignore = 1;
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is enabled"), NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("Ignore system is enabled"), nullptr, nullptr, NULL, true, false);
return true;
}
if (!mir_wstrcmpi(one.c_str(), L"off")) {
m_ignore = 0;
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is disabled"), NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("Ignore system is disabled"), nullptr, nullptr, NULL, true, false);
return true;
}
if (!wcschr(one.c_str(), '!') && !wcschr(one.c_str(), '@'))
@@ -301,7 +301,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo AddIgnore(one.c_str(), IgnoreFlags.c_str(), szNetwork.c_str());
mir_snwprintf(temp, TranslateT("%s on %s is now ignored (+%s)"), one.c_str(), szNetwork.c_str(), IgnoreFlags.c_str());
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), temp, nullptr, nullptr, NULL, true, false);
}
return true;
}
@@ -315,7 +315,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo mir_snwprintf(temp, TranslateT("%s is not ignored now"), one.c_str());
else
mir_snwprintf(temp, TranslateT("%s was not ignored"), one.c_str());
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), temp, nullptr, nullptr, NULL, true, false);
return true;
}
@@ -367,7 +367,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo if (!Chat_GetInfo(&gci))
mir_snwprintf(szTemp, L"users: %u", gci.iCount);
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), szTemp, nullptr, nullptr, NULL, true, false);
return true;
}
@@ -377,11 +377,11 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo if (!mir_wstrcmpi(one.c_str(), L"on")) {
bEcho = TRUE;
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Outgoing commands are shown"), NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("Outgoing commands are shown"), nullptr, nullptr, NULL, true, false);
}
if (!mir_wstrcmpi(one.c_str(), L"off")) {
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Outgoing commands are not shown"), NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("Outgoing commands are not shown"), nullptr, nullptr, NULL, true, false);
bEcho = FALSE;
}
@@ -391,9 +391,9 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo if (command == L"/buddycheck") {
if (one.IsEmpty()) {
if ((m_autoOnlineNotification && !bTempDisableCheck) || bTempForceCheck)
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("The buddy check function is enabled"), NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("The buddy check function is enabled"), nullptr, nullptr, NULL, true, false);
else
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("The buddy check function is disabled"), NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("The buddy check function is disabled"), nullptr, nullptr, NULL, true, false);
return true;
}
if (!mir_wstrcmpi(one.c_str(), L"on")) {
@@ -412,11 +412,11 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo m_iTempCheckTime = 10;
if (m_iTempCheckTime == 0)
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("The time interval for the buddy check function is now at default setting"), NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("The time interval for the buddy check function is now at default setting"), nullptr, nullptr, NULL, true, false);
else {
wchar_t temp[200];
mir_snwprintf(temp, TranslateT("The time interval for the buddy check function is now %u seconds"), m_iTempCheckTime);
- DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), temp, nullptr, nullptr, NULL, true, false);
}
}
return true;
@@ -432,7 +432,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo if (command == L"/channelmanager") {
if (window && !hContact && IsChannel(window)) {
if (IsConnected()) {
- if (m_managerDlg != NULL) {
+ if (m_managerDlg != nullptr) {
SetActiveWindow(m_managerDlg->GetHwnd());
m_managerDlg->Close();
}
@@ -477,7 +477,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo }
if (command == L"/list") {
- if (m_listDlg == NULL) {
+ if (m_listDlg == nullptr) {
m_listDlg = new CListDlg(this);
m_listDlg->Show();
}
@@ -486,7 +486,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo int minutes2 = (int)m_noOfChannels / 9000;
CMStringW szMsg(FORMAT, TranslateT("This command is not recommended on a network of this size!\r\nIt will probably cause high CPU usage and/or high bandwidth\r\nusage for around %u to %u minute(s).\r\n\r\nDo you want to continue?"), minutes2, minutes);
- if (m_noOfChannels < 4000 || (m_noOfChannels >= 4000 && MessageBox(NULL, szMsg, TranslateT("IRC warning"), MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDYES)) {
+ if (m_noOfChannels < 4000 || (m_noOfChannels >= 4000 && MessageBox(nullptr, szMsg, TranslateT("IRC warning"), MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDYES)) {
ListView_DeleteAllItems(GetDlgItem(m_listDlg->GetHwnd(), IDC_INFO_LISTVIEW));
PostIrcMessage(L"/lusers");
return false;
@@ -511,7 +511,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo CMStringW S = L"/ME " + DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
S.Replace(L"%", L"%%");
- Chat_SendUserMessage(m_szModuleName, NULL, S);
+ Chat_SendUserMessage(m_szModuleName, nullptr, S);
return true;
}
@@ -521,7 +521,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo CMStringW S = DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
S.Replace(L"%", L"%%");
- Chat_SendUserMessage(m_szModuleName, NULL, S);
+ Chat_SendUserMessage(m_szModuleName, nullptr, S);
return true;
}
@@ -540,7 +540,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo if (one.IsEmpty() || IsChannel(one.c_str()))
return true;
- CONTACT user = { one, NULL, NULL, false, false, false };
+ CONTACT user = { one, nullptr, nullptr, false, false, false };
MCONTACT hContact2 = CList_AddContact(&user, false, false);
if (hContact2) {
if (getByte(hContact, "AdvancedMode", 0) == 0)
@@ -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(0));
+ mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s %u\001", one.c_str(), two.c_str(), time(nullptr));
else
mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s\001", one.c_str(), GetWordAddress(text.c_str(), 2));
PostIrcMessageWnd(window, hContact, szTemp);
@@ -593,7 +593,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo if (mir_wstrcmpi(two.c_str(), L"dcc") != 0) {
mir_snwprintf(szTemp, TranslateT("CTCP %s request sent to %s"), two.c_str(), one.c_str());
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, m_info.sNick.c_str(), szTemp, nullptr, nullptr, NULL, true, false);
}
return true;
@@ -613,7 +613,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
if (ulAdr) {
- CONTACT user = { two, NULL, NULL, false, false, true };
+ CONTACT user = { two, nullptr, nullptr, false, false, true };
MCONTACT ccNew = CList_AddContact(&user, false, false);
if (ccNew) {
CMStringW s;
@@ -641,14 +641,14 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo wchar_t* pp[2];
wchar_t* p = (wchar_t*)temp.c_str();
pp[0] = p;
- pp[1] = NULL;
+ pp[1] = nullptr;
CallService(MS_FILE_SENDSPECIFICFILEST, ccNew, (LPARAM)pp);
}
}
}
else {
mir_snwprintf(szTemp, TranslateT("DCC ERROR: Unable to automatically resolve external IP"));
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), szTemp, nullptr, nullptr, NULL, true, false);
}
return true;
}
@@ -664,7 +664,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo if (ulAdr) {
CMStringW contact = two; contact += DCCSTRING;
- CONTACT user = { contact, NULL, NULL, false, false, true };
+ CONTACT user = { contact, nullptr, nullptr, false, false, true };
MCONTACT ccNew = CList_AddContact(&user, false, false);
setByte(ccNew, "DCC", 1);
@@ -687,16 +687,16 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo if (iPort != 0) {
PostIrcMessage(L"/CTCP %s DCC CHAT chat %u %u", two.c_str(), ulAdr, iPort);
mir_snwprintf(szTemp, TranslateT("DCC CHAT request sent to %s"), two.c_str(), one.c_str());
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), szTemp, nullptr, nullptr, NULL, true, false);
}
else {
mir_snwprintf(szTemp, TranslateT("DCC ERROR: Unable to bind port"));
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), szTemp, nullptr, nullptr, NULL, true, false);
}
}
else {
mir_snwprintf(szTemp, TranslateT("DCC ERROR: Unable to automatically resolve external IP"));
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), szTemp, nullptr, nullptr, NULL, true, false);
}
}
return true;
@@ -723,9 +723,9 @@ static void __stdcall DoInputRequestAliasApcStub(void* _par) CIrcProto *ppro = param->ppro;
wchar_t* str = param->str;
- wchar_t* infotext = NULL;
- wchar_t* title = NULL;
- wchar_t* defaulttext = NULL;
+ wchar_t* infotext = nullptr;
+ wchar_t* title = nullptr;
+ wchar_t* defaulttext = nullptr;
CMStringW command = (wchar_t*)str;
wchar_t* p = wcsstr((wchar_t*)str, L"%question");
if (p[9] == '=' && p[10] == '\"') {
@@ -788,7 +788,7 @@ bool CIrcProto::PostIrcMessage(const wchar_t* fmt, ...) mir_vsnwprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
- return PostIrcMessageWnd(NULL, NULL, szBuf);
+ return PostIrcMessageWnd(nullptr, NULL, szBuf);
}
bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wchar_t *szBuf)
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index e621777293..1fe7a849f1 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -165,7 +165,7 @@ end_of_prefix: int CIrcProto::getCodepage() const { - return (con != NULL) ? codepage : CP_ACP; + return (con != nullptr) ? codepage : CP_ACP; } void CIrcProto::SendIrcMessage(const wchar_t* msg, bool bNotify, int cp) @@ -199,19 +199,19 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) ncon.szHost = info.sServer.c_str(); ncon.wPort = info.iPort; con = Netlib_OpenConnection(m_hNetlibUser, &ncon); - if (con == NULL) { + if (con == nullptr) { wchar_t szTemp[300]; mir_snwprintf(szTemp, L"\0035%s \002%s\002 (%S: %u).", TranslateT("Failed to connect to"), si.sNetwork.c_str(), si.sServer.c_str(), si.iPort); - DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false); + DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, szTemp, nullptr, nullptr, NULL, true, false); return false; } FindLocalIP(con); // get the local ip used for filetransfers etc if (info.m_iSSL > 0) { - if (!Netlib_StartSsl(con, 0) && info.m_iSSL == 2) { + if (!Netlib_StartSsl(con, nullptr) && info.m_iSSL == 2) { Netlib_CloseHandle(con); - con = NULL; + con = nullptr; m_info.Reset(); return false; } @@ -225,7 +225,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) m_info = info; // start receiving messages from host - ForkThread(&CIrcProto::ThreadProc, NULL); + ForkThread(&CIrcProto::ThreadProc, nullptr); Sleep(100); if (info.sPassword.GetLength()) NLSend("PASS %s\r\n", info.sPassword.c_str()); @@ -242,14 +242,14 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) HostName = L"host"; NLSend(L"USER %s %s %s :%s\r\n", userID.c_str(), HostName.c_str(), L"server", info.sFullName.c_str()); - return con != NULL; + return con != nullptr; } void CIrcProto::Disconnect(void) { static const DWORD dwServerTimeout = 5 * 1000; - if (con == NULL) + if (con == nullptr) return; KillIdent(); @@ -326,7 +326,7 @@ void CIrcProto::KillIdent() { if (hBindPort) { HANDLE hPort = hBindPort; - hBindPort = NULL; + hBindPort = nullptr; Netlib_CloseHandle(hPort); } } @@ -342,7 +342,7 @@ void CIrcProto::createMessageFromPchar(const char* p) { wchar_t* ptszMsg; if (codepage != CP_UTF8 && m_utfAutodetect) { - if (mir_utf8decodecp(NEWSTR_ALLOCA(p), codepage, &ptszMsg) == NULL) + if (mir_utf8decodecp(NEWSTR_ALLOCA(p), codepage, &ptszMsg) == nullptr) ptszMsg = mir_a2u_cp(p, codepage); } else ptszMsg = mir_a2u_cp(p, codepage); @@ -428,11 +428,11 @@ void CIrcProto::DoReceive() if (con) { Netlib_CloseHandle(con); - con = NULL; + con = nullptr; } // notify monitor objects that the connection has been closed - Notify(NULL); + Notify(nullptr); } void __cdecl CIrcProto::ThreadProc(void*) @@ -490,7 +490,7 @@ CDccSession* CIrcProto::FindDCCSession(MCONTACT hContact) if (m_dcc_chats[i]->di->hContact == hContact) return m_dcc_chats[i]; - return 0; + return nullptr; } CDccSession* CIrcProto::FindDCCSession(DCCINFO *pdci) @@ -501,7 +501,7 @@ CDccSession* CIrcProto::FindDCCSession(DCCINFO *pdci) if (m_dcc_xfers[i]->di == pdci) return m_dcc_xfers[i]; - return 0; + return nullptr; } CDccSession* CIrcProto::FindDCCSendByPort(int iPort) @@ -514,7 +514,7 @@ CDccSession* CIrcProto::FindDCCSendByPort(int iPort) return p; } - return 0; + return nullptr; } CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t* szName) @@ -533,7 +533,7 @@ CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t* szNam } } - return 0; + return nullptr; } CDccSession* CIrcProto::FindPassiveDCCSend(int iToken) @@ -544,7 +544,7 @@ CDccSession* CIrcProto::FindPassiveDCCSend(int iToken) if (m_dcc_xfers[i]->iToken == iToken) return m_dcc_xfers[i]; - return 0; + return nullptr; } CDccSession* CIrcProto::FindPassiveDCCRecv(CMStringW sName, CMStringW sToken) @@ -557,7 +557,7 @@ CDccSession* CIrcProto::FindPassiveDCCRecv(CMStringW sName, CMStringW sToken) return p; } - return 0; + return nullptr; } void CIrcProto::DisconnectAllDCCSessions(bool Shutdown) @@ -575,13 +575,13 @@ void CIrcProto::CheckDCCTimeout(void) for (int i = 0; i < m_dcc_chats.getCount(); i++) { CDccSession* p = m_dcc_chats[i]; - if (time(0) > p->tLastActivity + DCCCHATTIMEOUT) + if (time(nullptr) > p->tLastActivity + DCCCHATTIMEOUT) p->Disconnect(); } for (int j = 0; j < m_dcc_xfers.getCount(); j++) { CDccSession* p = m_dcc_xfers[j]; - if (time(0) > p->tLastActivity + DCCSENDTIMEOUT) + if (time(nullptr) > p->tLastActivity + DCCSENDTIMEOUT) p->Disconnect(); } } @@ -652,7 +652,7 @@ void CIrcSessionInfo::Reset() void CIrcProto::OnIrcMessage(const CIrcMessage* pmsg) { - if (pmsg != NULL) { + if (pmsg != nullptr) { PfnIrcMessageHandler pfn = FindMethod(pmsg->sCommand.c_str()); if (pfn) { // call member function. if it returns 'false', @@ -668,9 +668,9 @@ void CIrcProto::OnIrcMessage(const CIrcMessage* pmsg) PfnIrcMessageHandler CIrcProto::FindMethod(const wchar_t* lpszName) { - CIrcHandler temp(lpszName, NULL); + CIrcHandler temp(lpszName, nullptr); CIrcHandler* p = m_handlers.find(&temp); - return (p == NULL) ? NULL : p->m_handler; + return (p == nullptr) ? nullptr : p->m_handler; } //////////////////////////////////////////////////////////////////// @@ -696,7 +696,7 @@ unsigned long ConvertIPToInteger(char* IP) IN_ADDR in; IN_ADDR intemp; - if (IP == 0 || mir_strlen(IP) == 0) + if (IP == nullptr || mir_strlen(IP) == 0) return 0; intemp.S_un.S_addr = inet_addr(IP); @@ -713,17 +713,17 @@ unsigned long ConvertIPToInteger(char* IP) // initialize basic stuff needed for the dcc objects, also start a timer for checking the status of connections (timeouts) CDccSession::CDccSession(CIrcProto* _pro, DCCINFO *pdci) : m_proto(_pro), - NewFileName(0), + NewFileName(nullptr), dwWhatNeedsDoing(0), tLastPercentageUpdate(0), dwTotal(0), iGlobalToken(), dwResumePos(0), - hEvent(0), - con(0), - hBindPort(0) + hEvent(nullptr), + con(nullptr), + hBindPort(nullptr) { - tLastActivity = time(0); + tLastActivity = time(nullptr); di = pdci; // Setup values passed to the constructor @@ -731,7 +731,7 @@ CDccSession::CDccSession(CIrcProto* _pro, DCCINFO *pdci) : pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); if (di->iType == DCC_SEND && di->bSender == false) - hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); if (nDcc == 0) m_proto->SetChatTimer(m_proto->DCCTimer, 20 * 1000, DCCTimerProc); @@ -770,10 +770,10 @@ CDccSession::~CDccSession() // destroy all that needs destroying if (di->iType == DCC_SEND) m_proto->RemoveDCCSession(di); - if (hEvent != NULL) { + if (hEvent != nullptr) { SetEvent(hEvent); CloseHandle(hEvent); - hEvent = NULL; + hEvent = nullptr; } delete di; @@ -788,7 +788,7 @@ CDccSession::~CDccSession() // destroy all that needs destroying int CDccSession::NLSend(const unsigned char* buf, int cbBuf) { - tLastActivity = time(0); + tLastActivity = time(nullptr); if (con) return Netlib_Send(con, (const char*)buf, cbBuf, di->iType == DCC_CHAT ? MSG_DUMPASTEXT : MSG_NODUMP); @@ -803,7 +803,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(0); + tLastActivity = time(nullptr); return n; } @@ -855,7 +855,7 @@ int CDccSession::SetupConnection() // Set up stuff needed for the filetransfer dialog (if it is a filetransfer) if (di->iType == DCC_SEND) { file[0] = (wchar_t*)di->sFileAndPath.c_str(); - file[1] = 0; + file[1] = nullptr; pfts.tszCurrentFile = (wchar_t*)di->sFileAndPath.c_str(); pfts.tszWorkingDir = (wchar_t*)di->sPath.c_str(); @@ -868,7 +868,7 @@ int CDccSession::SetupConnection() pfts.ptszFiles = file; pfts.totalProgress = 0; pfts.currentFileProgress = 0; - pfts.currentFileTime = (unsigned long)time(0); + pfts.currentFileTime = (unsigned long)time(nullptr); } // create a listening socket for outgoing chat/send requests. The remote computer connects to this computer. Used for both chat and filetransfer. @@ -878,7 +878,7 @@ int CDccSession::SetupConnection() nb.pExtra = this; hBindPort = Netlib_BindPort(m_proto->hNetlibDCC, &nb); - if (hBindPort == NULL) { + if (hBindPort == nullptr) { delete this; // dcc objects destroy themselves when the connection has been closed or failed for some reasson. return 0; } @@ -929,7 +929,7 @@ int CDccSession::SetupConnection() pfts.currentFileSize = pfts.totalBytes; delete[] NewFileName; - NewFileName = NULL; + NewFileName = nullptr; } break; @@ -955,8 +955,8 @@ int CDccSession::SetupConnection() nb.pExtra = this; hBindPort = Netlib_BindPort(m_proto->hNetlibDCC, &nb); - if (hBindPort == NULL) { - m_proto->DoEvent(GC_EVENT_INFORMATION, 0, m_proto->m_info.sNick.c_str(), LPGENW("DCC ERROR: Unable to bind local port for passive file transfer"), NULL, NULL, NULL, true, false); + if (hBindPort == nullptr) { + m_proto->DoEvent(GC_EVENT_INFORMATION, nullptr, m_proto->m_info.sNick.c_str(), LPGENW("DCC ERROR: Unable to bind local port for passive file transfer"), nullptr, nullptr, NULL, true, false); delete this; // dcc objects destroy themselves when the connection has been closed or failed for some reasson. return 0; } @@ -994,7 +994,7 @@ int CDccSession::SetupConnection() } // if for some reason the plugin has failed to connect to the remote computer the object is destroyed. - if (con == NULL) { + if (con == nullptr) { delete this; return FALSE; // failed to connect } @@ -1006,14 +1006,14 @@ int CDccSession::SetupConnection() // spawn a new thread to handle receiving/sending of data for the new chat/filetransfer connection to the remote computer mir_forkthread(ThreadProc, this); - return con != NULL; + return con != nullptr; } // called by netlib for incoming connections on a listening socket (chat/filetransfer) int CDccSession::IncomingConnection(HNETLIBCONN hConnection, DWORD dwIP) { con = hConnection; - if (con == NULL) { + if (con == nullptr) { delete this; return false; // failed to connect } @@ -1039,7 +1039,7 @@ void __cdecl CDccSession::ThreadProc(void *pparam) // the connection to) can connect and not evil IRCopers with haxxored IRCDs if (pThis->hBindPort) { Netlib_CloseHandle(pThis->hBindPort); - pThis->hBindPort = NULL; + pThis->hBindPort = nullptr; } if (pThis->di->iType == DCC_CHAT) @@ -1089,7 +1089,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(0); + tLastActivity = time(nullptr); // create a packet receiver to handle receiving ack's from the remote computer. HANDLE hPackrcver = Netlib_CreatePacketReceiver(con, sizeof(DWORD)); @@ -1160,8 +1160,8 @@ void CDccSession::DoSendFile() } // update the filetransfer dialog's 'percentage-ready meter' once per second only to save cpu - if (tLastPercentageUpdate < time(0)) { - tLastPercentageUpdate = time(0); + if (tLastPercentageUpdate < time(nullptr)) { + tLastPercentageUpdate = time(nullptr); pfts.totalProgress = dwTotal; pfts.currentFileProgress = dwTotal; ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts); @@ -1170,7 +1170,7 @@ void CDccSession::DoSendFile() // close the connection once the whole file has been sent an completely ack'ed if (dwLastAck >= di->dwSize) { Netlib_CloseHandle(con); - con = NULL; + con = nullptr; } } @@ -1178,11 +1178,11 @@ void CDccSession::DoSendFile() // need to close the connection if it isn't allready if (con) { Netlib_CloseHandle(con); - con = NULL; + con = nullptr; } // ack the progress one final time - tLastActivity = time(0); + tLastActivity = time(nullptr); pfts.totalProgress = dwTotal; pfts.currentFileProgress = dwTotal; ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts); @@ -1193,7 +1193,7 @@ void CDccSession::DoSendFile() ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (void *)di, 0); if (con) { Netlib_CloseHandle(con); - con = NULL; + con = nullptr; } } } @@ -1257,8 +1257,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(0)) { - tLastPercentageUpdate = time(0); + if (tLastPercentageUpdate < time(nullptr)) { + tLastPercentageUpdate = time(nullptr); pfts.totalProgress = dwTotal; pfts.currentFileProgress = dwTotal; ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (void *)di, (LPARAM)&pfts); @@ -1267,7 +1267,7 @@ void CDccSession::DoReceiveFile() // if file size is known and everything is received then disconnect if (di->dwSize && di->dwSize == dwTotal) { Netlib_CloseHandle(con); - con = NULL; + con = nullptr; } } // receiving loop broken locally or by remote computer, just some cleaning up left.... @@ -1281,7 +1281,7 @@ void CDccSession::DoReceiveFile() ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (void *)di, 0); if (con) { // file not possible to open for writing so we ack FAILURE and close the handle Netlib_CloseHandle(con); - con = NULL; + con = nullptr; } } @@ -1328,7 +1328,7 @@ void CDccSession::DoChatReceive() if (*pStart) { // send it off to some messaging module PROTORECVEVENT pre = { 0 }; - pre.timestamp = (DWORD)time(NULL); + pre.timestamp = (DWORD)time(nullptr); pre.szMessage = pStart; ProtoChainRecvMsg(di->hContact, &pre); } @@ -1350,14 +1350,14 @@ int CDccSession::Disconnect() { if (hBindPort) { Netlib_CloseHandle(hBindPort); - hBindPort = NULL; + hBindPort = nullptr; } // if 'con' exists it is cuz a connection exists. // Terminating 'con' will cause any spawned threads to die and then the object will destroy itself. if (con) { Netlib_CloseHandle(con); - con = NULL; + con = nullptr; } else delete this; // if 'con' do not exist (no connection made so far from the object) the object is destroyed @@ -1400,7 +1400,7 @@ void DoIdent(HNETLIBCONN hConnection, DWORD, void* extra) LBL_Parse: char* EOLPos = strstr(szBuf, "\r\n"); - if (EOLPos == NULL) + if (EOLPos == nullptr) continue; EOLPos[0] = EOLPos[1] = '\0'; diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 85ea258941..5ce755d6cb 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -39,7 +39,7 @@ CIrcProto::CIrcProto(const char* szModuleName, const wchar_t* tszUserName) : vUserhostReasons(10),
vWhoInProgress(10)
{
- m_evWndCreate = ::CreateEvent(NULL, FALSE, FALSE, NULL);
+ m_evWndCreate = ::CreateEvent(nullptr, FALSE, FALSE, nullptr);
CreateProtoService(PS_GETMYAWAYMSG, &CIrcProto::GetMyAwayMsg);
@@ -140,11 +140,11 @@ CIrcProto::~CIrcProto() {
if (con) {
Netlib_CloseHandle(con);
- con = NULL;
+ con = nullptr;
}
- Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = NULL;
- Netlib_CloseHandle(hNetlibDCC); hNetlibDCC = NULL;
+ Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = nullptr;
+ Netlib_CloseHandle(hNetlibDCC); hNetlibDCC = nullptr;
mir_free(m_alias);
@@ -210,9 +210,9 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) mir_snwprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_perform.ini", m_szModuleName);
wchar_t *szLoadFileName = Utils_ReplaceVarsW(szTemp);
char* pszPerformData = IrcLoadFile(szLoadFileName);
- if (pszPerformData != NULL) {
+ if (pszPerformData != nullptr) {
char *p1 = pszPerformData, *p2 = pszPerformData;
- while ((p1 = strstr(p2, "NETWORK: ")) != NULL) {
+ while ((p1 = strstr(p2, "NETWORK: ")) != nullptr) {
p1 += 9;
p2 = strchr(p1, '\n');
CMStringA sNetwork(p1, int(p2 - p1 - 1));
@@ -284,7 +284,7 @@ MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr) wchar_t *id = psr->id.w ? psr->id.w : psr->nick.w;
id = psr->flags & PSR_UNICODE ? mir_wstrdup((wchar_t*)id) : mir_a2u((char*)id);
- CONTACT user = { id, NULL, NULL, true, false, false };
+ CONTACT user = { id, nullptr, nullptr, true, false, false };
MCONTACT hContact = CList_AddContact(&user, true, false);
if (hContact) {
@@ -487,7 +487,7 @@ HANDLE __cdecl CIrcProto::SearchBasic(const wchar_t* szId) }
}
- return 0;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -495,14 +495,14 @@ HANDLE __cdecl CIrcProto::SearchBasic(const wchar_t* szId) HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** ppszFiles)
{
- DCCINFO* dci = NULL;
+ DCCINFO* dci = nullptr;
int iPort = 0;
int index = 0;
unsigned __int64 size = 0;
// do not send to channels :-P
if (isChatRoom(hContact))
- return 0;
+ return nullptr;
// stop if it is an active type filetransfer and the user's IP is not known
unsigned long ulAdr = 0;
@@ -512,8 +512,8 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
if (!m_DCCPassive && !ulAdr) {
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), TranslateT("DCC ERROR: Unable to automatically resolve external IP"), NULL, NULL, NULL, true, false);
- return 0;
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("DCC ERROR: Unable to automatically resolve external IP"), nullptr, nullptr, NULL, true, false);
+ return nullptr;
}
if (ppszFiles[index]) {
@@ -529,8 +529,8 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** }
if (size == 0) {
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), TranslateT("DCC ERROR: No valid files specified"), NULL, NULL, NULL, true, false);
- return 0;
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), TranslateT("DCC ERROR: No valid files specified"), nullptr, nullptr, NULL, true, false);
+ return nullptr;
}
DBVARIANT dbv;
@@ -579,7 +579,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** mir_snwprintf(szTemp,
TranslateT("DCC reversed file transfer request sent to %s [%s]"),
dci->sContactName.c_str(), sFileCorrect.c_str());
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), szTemp, nullptr, nullptr, NULL, true, false);
if (m_sendNotice) {
mir_snwprintf(szTemp,
@@ -598,7 +598,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** mir_snwprintf(szTemp,
TranslateT("DCC file transfer request sent to %s [%s]"),
dci->sContactName.c_str(), sFileCorrect.c_str());
- DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(), szTemp, nullptr, nullptr, NULL, true, false);
if (m_sendNotice) {
mir_snwprintf(szTemp,
@@ -607,8 +607,8 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** PostIrcMessage(szTemp);
}
}
- else DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(),
- TranslateT("DCC ERROR: Unable to bind local port"), NULL, NULL, NULL, true, false);
+ else DoEvent(GC_EVENT_INFORMATION, nullptr, m_info.sNick.c_str(),
+ TranslateT("DCC ERROR: Unable to bind local port"), nullptr, nullptr, NULL, true, false);
}
// fix for sending multiple files
@@ -626,7 +626,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** if (dci)
return dci;
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -645,13 +645,13 @@ struct TFakeAckParam void __cdecl CIrcProto::AckMessageFail(void *info)
{
Thread_SetName("IRC: AckMessageFail");
- ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The protocol is not online"));
+ ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)Translate("The protocol is not online"));
}
void __cdecl CIrcProto::AckMessageFailDcc(void *info)
{
Thread_SetName("IRC: AckMessageFailDcc");
- ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The dcc chat connection is not active"));
+ ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)Translate("The dcc chat connection is not active"));
}
void __cdecl CIrcProto::AckMessageSuccess(void *info)
@@ -678,7 +678,7 @@ int __cdecl CIrcProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) wchar_t *result;
mir_utf8decode(NEWSTR_ALLOCA(pszSrc), &result);
- PostIrcMessageWnd(NULL, hContact, result);
+ PostIrcMessageWnd(nullptr, hContact, result);
mir_free(result);
int seq = InterlockedIncrement(&g_msgid);
@@ -698,7 +698,7 @@ int CIrcProto::SetStatusInternal(int iNewStatus, bool bIsInternal) {
if (iNewStatus != ID_STATUS_OFFLINE && !m_network[0]) {
if (m_nick[0] && !m_disableDefaultServer) {
- if (m_quickDlg == NULL) {
+ if (m_quickDlg == nullptr) {
m_quickDlg = new CQuickDlg(this);
m_quickComboSelection = m_serverComboSelection + 1;
m_quickDlg->Show();
@@ -767,7 +767,7 @@ HANDLE __cdecl CIrcProto::GetAwayMsg(MCONTACT hContact) int i = getWord(hContact, "Status", ID_STATUS_OFFLINE);
if (i != ID_STATUS_AWAY) {
db_free(&dbv);
- return 0;
+ return nullptr;
}
CMStringW S = L"WHOIS ";
S += dbv.ptszVal;
@@ -793,8 +793,8 @@ int __cdecl CIrcProto::SetAwayMsg(int status, const wchar_t* msg) default:
CMStringW newStatus = msg;
newStatus.Replace(L"\r\n", L" ");
- if (m_statusMessage.IsEmpty() || msg == NULL || m_statusMessage != newStatus) {
- if (msg == NULL || *msg == 0)
+ if (m_statusMessage.IsEmpty() || msg == nullptr || m_statusMessage != newStatus) {
+ if (msg == nullptr || *msg == 0)
m_statusMessage = STR_AWAYMESSAGE;
else
m_statusMessage = newStatus;
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp index 4629c9fa31..8ca2aa485d 100644 --- a/protocols/IRCG/src/main.cpp +++ b/protocols/IRCG/src/main.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. CHAT_MANAGER *pci;
CLIST_INTERFACE *pcli;
-HINSTANCE hInst = NULL;
+HINSTANCE hInst = nullptr;
int hLangpack;
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index d0df6b7b72..749df2f0e8 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include <win2k.h>
-static const CIrcProto* pZero = NULL;
+static const CIrcProto* pZero = nullptr;
void CIrcProto::ReadSettings(TDbSetting* sets, int count)
{
@@ -56,7 +56,7 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) if (p->size != -1)
*ptr = 0;
else
- *(char**)ptr = NULL;
+ *(char**)ptr = nullptr;
}
break;
case DBVT_WCHAR:
@@ -71,7 +71,7 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) }
else {
if (p->size != -1) {
- if (p->defStr == NULL)
+ if (p->defStr == nullptr)
*ptr = 0;
else
mir_wstrncpy((wchar_t*)ptr, p->defStr, (int)p->size);
@@ -213,7 +213,7 @@ HICON LoadIconEx(int iconId, bool big) if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
- return NULL;
+ return nullptr;
}
HANDLE GetIconHandle(int iconId)
@@ -222,7 +222,7 @@ HANDLE GetIconHandle(int iconId) if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -383,7 +383,7 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto> int iItem = m_owner->m_serverCombo.AddStringA(pData->m_name, (LPARAM)pData);
m_owner->m_serverCombo.SetCurSel(iItem);
- m_owner->OnServerCombo(NULL);
+ m_owner->OnServerCombo(nullptr);
m_owner->m_serverlistModified = true;
Close();
@@ -607,7 +607,7 @@ void CConnectPrefsDlg::OnDeleteServer(CCtrlButton*) if (i >= m_serverCombo.GetCount())
i--;
m_serverCombo.SetCurSel(i);
- OnServerCombo(NULL);
+ OnServerCombo(nullptr);
SendMessage(GetParent(m_hwnd), PSM_CHANGED, 0, 0);
m_serverlistModified = true;
}
@@ -750,7 +750,7 @@ void CConnectPrefsDlg::OnApply() if (j != CB_ERR && j != 0) {
for (int index2 = 0; index2 < j; index2++) {
pData = (SERVER_INFO*)m_serverCombo.GetItemData(index2);
- if (pData == NULL || (INT_PTR)pData == CB_ERR)
+ if (pData == nullptr || (INT_PTR)pData == CB_ERR)
continue;
char TextLine[512];
@@ -761,7 +761,7 @@ void CConnectPrefsDlg::OnApply() db_set_s(NULL, SERVERSMODULE, pData->m_name, TextLine);
// combobox might contain new items
- if (g_servers.find(pData) == NULL)
+ if (g_servers.find(pData) == nullptr)
g_servers.insert(pData);
}
}
@@ -1036,7 +1036,7 @@ void COtherPrefsDlg::OnInitDialog() }
m_performCombo.SetCurSel(0);
- OnPerformCombo(NULL);
+ OnPerformCombo(nullptr);
m_autodetect.SetState(m_proto->m_utfAutodetect);
}
@@ -1049,7 +1049,7 @@ void COtherPrefsDlg::OnPerformCombo(CCtrlData*) {
int i = m_performCombo.GetCurSel();
PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData(i);
- if (pPerf == 0)
+ if (pPerf == nullptr)
m_pertormEdit.SetTextA("");
else
m_pertormEdit.SetText(pPerf->mText.c_str());
@@ -1089,12 +1089,12 @@ void COtherPrefsDlg::OnAdd(CCtrlButton*) wchar_t* temp = m_pertormEdit.GetText();
if (my_strstri(temp, L"/away"))
- MessageBox(NULL, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK);
+ MessageBox(nullptr, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK);
else {
int i = m_performCombo.GetCurSel();
if (i != CB_ERR) {
PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData(i);
- if (pPerf != NULL)
+ if (pPerf != nullptr)
pPerf->mText = temp;
m_add.Disable();
@@ -1109,7 +1109,7 @@ void COtherPrefsDlg::OnDelete(CCtrlButton*) int i = m_performCombo.GetCurSel();
if (i != CB_ERR) {
PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData(i);
- if (pPerf != NULL) {
+ if (pPerf != nullptr) {
pPerf->mText = L"";
m_pertormEdit.SetTextA("");
m_delete.Disable();
@@ -1126,7 +1126,7 @@ void COtherPrefsDlg::OnDestroy() if (i != CB_ERR && i != 0) {
for (int index = 0; index < i; index++) {
PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData(index);
- if ((INT_PTR)pPerf != CB_ERR && pPerf != NULL)
+ if ((INT_PTR)pPerf != CB_ERR && pPerf != nullptr)
delete pPerf;
}
}
@@ -1147,7 +1147,7 @@ void COtherPrefsDlg::OnApply() m_proto->m_perform = m_perform.GetState();
m_proto->m_scriptingEnabled = m_scripting.GetState();
if (m_add.Enabled())
- OnAdd(NULL);
+ OnAdd(nullptr);
if (m_performlistModified) {
int count = m_performCombo.GetCount();
@@ -1190,7 +1190,7 @@ CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const wchar_t* mask, CIgnorePrefsD {
m_hwndParent = _owner->GetHwnd();
- if (mask == NULL)
+ if (mask == nullptr)
szOldMask[0] = 0;
else
wcsncpy(szOldMask, mask, _countof(szOldMask));
@@ -1316,7 +1316,7 @@ void CIrcProto::InitIgnore(void) mir_snwprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_ignore.ini", m_szModuleName);
wchar_t *szLoadFileName = Utils_ReplaceVarsW(szTemp);
char* pszIgnoreData = IrcLoadFile(szLoadFileName);
- if (pszIgnoreData != NULL) {
+ if (pszIgnoreData != nullptr) {
char *p1 = pszIgnoreData;
while (*p1 != '\0') {
while (*p1 == '\r' || *p1 == '\n')
@@ -1429,7 +1429,7 @@ void CIgnorePrefsDlg::OnInitDialog() lvC.iSubItem = index;
lvC.cx = COLUMNS_SIZES[index];
- wchar_t* text = NULL;
+ wchar_t* text = nullptr;
switch (index) {
case 0: text = TranslateT("Ignore mask"); break;
case 1: text = TranslateT("Flags"); break;
@@ -1476,7 +1476,7 @@ void CIgnorePrefsDlg::OnIgnoreChat(CCtrlData*) void CIgnorePrefsDlg::OnAdd(CCtrlButton*)
{
- CAddIgnoreDlg *dlg = new CAddIgnoreDlg(m_proto, NULL, this);
+ CAddIgnoreDlg *dlg = new CAddIgnoreDlg(m_proto, nullptr, this);
dlg->Show();
SetWindowText(dlg->GetHwnd(), TranslateT("Add ignore"));
m_add.Disable();
@@ -1550,7 +1550,7 @@ void CIgnorePrefsDlg::OnApply() void CIgnorePrefsDlg::OnDestroy()
{
- m_proto->m_ignoreDlg = NULL;
+ m_proto->m_ignoreDlg = nullptr;
m_proto->m_ignoreItems.destroy();
int i = m_list.GetItemCount();
@@ -1697,7 +1697,7 @@ void CIrcProto::InitPrefs(void) m_mySpecifiedHostIP[0] = 0;
- if (m_alias == NULL)
+ if (m_alias == nullptr)
m_alias = mir_wstrdup(L"/op /mode ## +ooo $1 $2 $3\r\n/dop /mode ## -ooo $1 $2 $3\r\n/voice /mode ## +vvv $1 $2 $3\r\n/dvoice /mode ## -vvv $1 $2 $3\r\n/j /join #$1 $2-\r\n/p /part ## $1-\r\n/w /whois $1\r\n/k /kick ## $1 $2-\r\n/q /query $1\r\n/logon /log on ##\r\n/logoff /log off ##\r\n/save /log buffer $1\r\n/slap /me slaps $1 around a bit with a large trout");
m_quickComboSelection = getDword("QuickComboSelection", m_serverComboSelection + 1);
@@ -1819,7 +1819,7 @@ INT_PTR CIrcProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam) static void sttImportIni(const wchar_t* szIniFile)
{
FILE* serverFile = _wfopen(szIniFile, L"r");
- if (serverFile == NULL)
+ if (serverFile == nullptr)
return;
char buf1[500], buf2[200];
diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp index 9eb5181e91..a1a95b346c 100644 --- a/protocols/IRCG/src/output.cpp +++ b/protocols/IRCG/src/output.cpp @@ -142,17 +142,17 @@ BOOL CIrcProto::ShowMessage(const CIrcMessage* pmsg) if ((iTemp > 400 || iTemp < 500) && pmsg->sCommand[0] == '4' //all error messages
|| pmsg->sCommand == L"303" //ISON command
|| pmsg->sCommand == L"INVITE"
- || ((pmsg->sCommand == L"NOTICE") && ((pmsg->parameters.getCount() > 2) ? (wcsstr(pmsg->parameters[1].c_str(), L"\001") == NULL) : false)) // CTCP answers should go to m_network Log window!
+ || ((pmsg->sCommand == L"NOTICE") && ((pmsg->parameters.getCount() > 2) ? (wcsstr(pmsg->parameters[1].c_str(), L"\001") == nullptr) : false)) // CTCP answers should go to m_network Log window!
|| pmsg->sCommand == L"515") //chanserv error
{
- DoEvent(GC_EVENT_INFORMATION, NULL, pmsg->m_bIncoming ? pmsg->prefix.sNick.c_str() : m_info.sNick.c_str(), mess.c_str(), NULL, NULL, NULL, true, pmsg->m_bIncoming ? false : true);
+ DoEvent(GC_EVENT_INFORMATION, nullptr, pmsg->m_bIncoming ? pmsg->prefix.sNick.c_str() : m_info.sNick.c_str(), mess.c_str(), nullptr, nullptr, NULL, true, pmsg->m_bIncoming ? false : true);
return TRUE;
}
if (m_useServer) {
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW,
(pmsg->m_bIncoming) ? pmsg->prefix.sNick.c_str() : m_info.sNick.c_str(),
- mess.c_str(), NULL, NULL, NULL, true, pmsg->m_bIncoming ? false : true);
+ mess.c_str(), nullptr, nullptr, NULL, true, pmsg->m_bIncoming ? false : true);
return true;
}
return false;
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index d510422a84..ee3c57ab90 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -82,23 +82,23 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam) if (gch->ptszText)
gchook->ptszText = wcsdup(gch->ptszText);
else
- gchook->ptszText = NULL;
+ gchook->ptszText = nullptr;
if (gch->ptszUID)
gchook->ptszUID = wcsdup(gch->ptszUID);
else
- gchook->ptszUID = NULL;
+ gchook->ptszUID = nullptr;
if (gch->ptszID) {
CMStringW S = MakeWndID(gch->ptszID);
gchook->ptszID = wcsdup(S.c_str());
}
- else gchook->ptszID = NULL;
+ else gchook->ptszID = nullptr;
if (gch->pszModule)
gchook->pszModule = _strdup(gch->pszModule);
else
- gchook->pszModule = NULL;
+ gchook->pszModule = nullptr;
mir_forkthread(GuiOutThread, gchook);
return 0;
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 144b98f9bb..d7c9228f97 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -67,14 +67,14 @@ static HGENMENU hUMenuChanSettings, hUMenuWhois, hUMenuDisconnect, hUMenuIgnore; static CIrcProto* IrcGetInstanceByHContact(MCONTACT hContact)
{
char* szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
for (int i = 0; i < g_Instances.getCount(); i++)
if (!mir_strcmp(szProto, g_Instances[i]->m_szModuleName))
return g_Instances[i];
- return NULL;
+ return nullptr;
}
static INT_PTR IrcMenuChanSettings(WPARAM wParam, LPARAM lParam)
@@ -293,7 +293,7 @@ INT_PTR __cdecl CIrcProto::OnMenuIgnore(WPARAM wp, LPARAM) DBVARIANT dbv;
if (!getWString(hContact, "Nick", &dbv)) {
if (!isChatRoom(hContact)) {
- char* host = NULL;
+ char* host = nullptr;
DBVARIANT dbv1;
if (!getString(hContact, "Host", &dbv1))
host = dbv1.pszVal;
@@ -529,7 +529,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) TranslateT("Please enter your authentication code"), TranslateT("Authenticate nick"));
break;
case 7: // nickserv drop nick
- if (MessageBox(0, TranslateT("Are you sure you want to unregister your current nick?"), TranslateT("Delete nick"),
+ if (MessageBox(nullptr, TranslateT("Are you sure you want to unregister your current nick?"), TranslateT("Delete nick"),
MB_ICONERROR + MB_YESNO + MB_DEFBUTTON2) == IDYES)
PostIrcMessage(L"/nickserv DROP");
break;
@@ -818,7 +818,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) }
if (gcmi->Type == MENU_ON_NICKLIST) {
- CONTACT user = { (wchar_t*)gcmi->pszUID, NULL, NULL, false, false, false };
+ CONTACT user = { (wchar_t*)gcmi->pszUID, nullptr, nullptr, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
BOOL bIsInList = (hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 0);
@@ -832,12 +832,12 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) nickItems[23].bDisabled = ulAdr == 0 ? TRUE : FALSE; // DCC submenu
CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, gcmi->pszID);
- BOOL bServOwner = strchr(sUserModes.c_str(), 'q') == NULL ? FALSE : TRUE;
- BOOL bServAdmin = strchr(sUserModes.c_str(), 'a') == NULL ? FALSE : TRUE;
+ BOOL bServOwner = strchr(sUserModes.c_str(), 'q') == nullptr ? FALSE : TRUE;
+ BOOL bServAdmin = strchr(sUserModes.c_str(), 'a') == nullptr ? FALSE : TRUE;
BOOL bOwner = bServOwner ? ((wi->OwnMode >> 4) & 01) : FALSE;
BOOL bAdmin = bServAdmin ? ((wi->OwnMode >> 3) & 01) : FALSE;
- BOOL bOp = strchr(sUserModes.c_str(), 'o') == NULL ? FALSE : ((wi->OwnMode >> 2) & 01);
- BOOL bHalfop = strchr(sUserModes.c_str(), 'h') == NULL ? FALSE : ((wi->OwnMode >> 1) & 01);
+ BOOL bOp = strchr(sUserModes.c_str(), 'o') == nullptr ? FALSE : ((wi->OwnMode >> 2) & 01);
+ BOOL bHalfop = strchr(sUserModes.c_str(), 'h') == nullptr ? FALSE : ((wi->OwnMode >> 1) & 01);
BOOL bForceEnable = GetAsyncKeyState(VK_CONTROL);
@@ -975,7 +975,7 @@ void __cdecl CIrcProto::ConnectServerThread(void*) else {
Temp = m_iDesiredStatus;
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NONETWORK);
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)Temp, ID_STATUS_OFFLINE);
Sleep(100);
}
@@ -1019,14 +1019,14 @@ void CIrcProto::ConnectToServer(void) sChannelModes = "btnimklps";
if (!m_bConnectThreadRunning)
- ForkThread(&CIrcProto::ConnectServerThread, 0);
+ ForkThread(&CIrcProto::ConnectServerThread, nullptr);
else if (m_bConnectRequested < 1)
InterlockedIncrement((long *)&m_bConnectRequested);
wchar_t szTemp[300];
mir_snwprintf(szTemp, L"\033%s \002%s\002 (%S: %u)",
TranslateT("Connecting to"), si.sNetwork.c_str(), si.sServer.c_str(), si.iPort);
- DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
+ DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, szTemp, nullptr, nullptr, NULL, true, false);
}
void CIrcProto::DisconnectFromServer(void)
@@ -1035,7 +1035,7 @@ void CIrcProto::DisconnectFromServer(void) DoPerform("Event: Disconnect");
Chat_Terminate(m_szModuleName, nullptr);
- ForkThread(&CIrcProto::DisconnectServerThread, 0);
+ ForkThread(&CIrcProto::DisconnectServerThread, nullptr);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 2ae539db46..78434b4cf8 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -53,7 +53,7 @@ CMStringW __stdcall GetWord(const wchar_t* text, int index) {
if (text && *text) {
wchar_t* p1 = (wchar_t*)text;
- wchar_t* p2 = NULL;
+ wchar_t* p2 = nullptr;
while (*p1 == ' ')
p1++;
@@ -122,10 +122,10 @@ void __stdcall RemoveLinebreaks(CMStringW &Message) char* __stdcall IrcLoadFile(wchar_t* szPath)
{
- char * szContainer = NULL;
+ char * szContainer = nullptr;
DWORD dwSiz = 0;
FILE *hFile = _wfopen(szPath, L"rb");
- if (hFile != NULL) {
+ if (hFile != nullptr) {
fseek(hFile, 0, SEEK_END); // seek to end
dwSiz = ftell(hFile); // size
fseek(hFile, 0, SEEK_SET); // seek back to original pos
@@ -136,15 +136,15 @@ char* __stdcall IrcLoadFile(wchar_t* szPath) return szContainer;
}
- return 0;
+ return nullptr;
}
int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string)
{
- if (wild == NULL || !mir_wstrlen(wild) || string == NULL || !mir_wstrlen(string))
+ if (wild == nullptr || !mir_wstrlen(wild) || string == nullptr || !mir_wstrlen(string))
return 1;
- const wchar_t *cp = NULL, *mp = NULL;
+ const wchar_t *cp = nullptr, *mp = nullptr;
while ((*string) && (*wild != '*')) {
if ((*wild != *string) && (*wild != '?'))
return 0;
@@ -186,7 +186,7 @@ CMStringA __stdcall GetWord(const char* text, int index) {
if (text && text[0]) {
char* p1 = (char*)text;
- char* p2 = NULL;
+ char* p2 = nullptr;
while (*p1 == ' ')
p1++;
@@ -228,7 +228,7 @@ wchar_t* __stdcall my_strstri(const wchar_t* s1, const wchar_t* s2) if (!s2[k + 1])
return (wchar_t*)(s1 + i);
- return NULL;
+ return nullptr;
}
wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplacePercent)
@@ -389,7 +389,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* if (pszText)
sText = DoColorCodes(pszText, FALSE, TRUE);
- GCEVENT gce = { m_szModuleName, NULL, iEvent };
+ GCEVENT gce = { m_szModuleName, nullptr, iEvent };
if (pszWindow) {
if (mir_wstrcmpi(pszWindow, SERVERWINDOW))
sID = pszWindow + (CMStringW)L" - " + m_info.sNetwork;
@@ -397,7 +397,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* sID = pszWindow;
gce.ptszID = (wchar_t*)sID.c_str();
}
- else gce.ptszID = NULL;
+ else gce.ptszID = nullptr;
gce.ptszStatus = pszStatus;
gce.dwFlags = (bAddToLog) ? GCEF_ADDTOLOG : 0;
@@ -406,14 +406,14 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* if (iEvent == GC_EVENT_TOPIC)
gce.ptszUserInfo = pszUserInfo;
else
- gce.ptszUserInfo = m_showAddresses ? pszUserInfo : NULL;
+ gce.ptszUserInfo = m_showAddresses ? pszUserInfo : nullptr;
if (!sText.IsEmpty())
gce.ptszText = sText.c_str();
gce.dwItemData = dwItemData;
if (timestamp == 1)
- gce.time = time(NULL);
+ gce.time = time(nullptr);
else
gce.time = timestamp;
gce.bIsMe = bIsMe;
@@ -487,9 +487,9 @@ CIrcProto* GetTimerOwner(UINT_PTR nIDEvent) {
mir_cslock lck(timers_cs);
- TimerPair temp(NULL, nIDEvent);
+ TimerPair temp(nullptr, nIDEvent);
int idx = timers.getIndex(&temp);
- return (idx == -1) ? NULL : timers[idx].ppro;
+ return (idx == -1) ? nullptr : timers[idx].ppro;
}
void CIrcProto::SetChatTimer(UINT_PTR &nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc)
@@ -497,7 +497,7 @@ void CIrcProto::SetChatTimer(UINT_PTR &nIDEvent, UINT uElapse, TIMERPROC lpTimer if (nIDEvent)
KillChatTimer(nIDEvent);
- nIDEvent = SetTimer(NULL, NULL, uElapse, lpTimerFunc);
+ nIDEvent = SetTimer(nullptr, NULL, uElapse, lpTimerFunc);
mir_cslock lck(timers_cs);
timers.insert(new TimerPair(this, nIDEvent));
@@ -515,7 +515,7 @@ void CIrcProto::KillChatTimer(UINT_PTR &nIDEvent) timers.remove(idx);
}
- KillTimer(NULL, nIDEvent);
+ KillTimer(nullptr, nIDEvent);
nIDEvent = NULL;
}
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index 2813f65edc..faa5809241 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -45,7 +45,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM UserDetailsDlgProcParam *p = (UserDetailsDlgProcParam*)GetWindowLongPtr(m_hwnd, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
- p = new UserDetailsDlgProcParam(NULL, lParam);
+ p = new UserDetailsDlgProcParam(nullptr, lParam);
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LPARAM)p);
break;
@@ -107,7 +107,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_WILDCARD)) == 0 ||
GetWindowTextLength(GetDlgItem(m_hwnd, IDC_USER)) == 0 ||
GetWindowTextLength(GetDlgItem(m_hwnd, IDC_HOST)) == 0) {
- MessageBox(NULL, TranslateW(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateW(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
return FALSE;
}
@@ -118,7 +118,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM S += dbv.ptszVal;
S += L")";
if ((mir_wstrlen(temp) < 4 && mir_wstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
- MessageBox(NULL, TranslateW(S.c_str()), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateW(S.c_str()), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
db_free(&dbv);
return FALSE;
}
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index 8c19b06bd8..9b91719ad3 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -104,7 +104,7 @@ void CWhoisDlg::OnDestroy() SendDlgItemMessage(m_hwnd, IDC_CAPTION, WM_SETFONT, SendDlgItemMessage(m_hwnd, IDOK, WM_GETFONT, 0, 0), 0);
DeleteObject(hFont2);
- m_proto->m_whoisDlg = NULL;
+ m_proto->m_whoisDlg = nullptr;
}
void CWhoisDlg::OnGo(CCtrlButton*)
@@ -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(0));
+ m_proto->PostIrcMessage(L"/PRIVMSG %s \001PING %u\001", szTemp, time(nullptr));
}
void CWhoisDlg::OnUserInfo(CCtrlButton*)
@@ -175,7 +175,7 @@ void CWhoisDlg::ShowMessage(const CIrcMessage* pmsg) if (IsIconic(m_hwnd))
ShowWindow(m_hwnd, SW_SHOWNORMAL);
SendMessage(m_hwnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(m_hwnd, NULL, TRUE);
+ InvalidateRect(m_hwnd, nullptr, TRUE);
}
void CWhoisDlg::ShowMessageNoUser(const CIrcMessage *pmsg)
@@ -223,7 +223,7 @@ void CNickDlg::OnInitDialog() void CNickDlg::OnDestroy()
{
CCoolIrcDlg::OnDestroy();
- m_proto->m_nickDlg = NULL;
+ m_proto->m_nickDlg = nullptr;
}
void CNickDlg::OnOk(CCtrlButton*)
@@ -327,7 +327,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) // Match the text?
wchar_t* t = wcsstr(lvm.pszText, strFilterText);
- if (t == NULL) { // If no, then Check if in the topics
+ if (t == nullptr) { // If no, then Check if in the topics
m_list.GetItem(&lvm);
// Match the text?
@@ -393,7 +393,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) void CListDlg::OnChange(CCtrlBase *ctrl)
{
if (ctrl->GetCtrlId() == IDC_FILTER_STRING)
- m_timer = ::SetTimer(m_hwnd, LIST_TIMER, 200, NULL);
+ m_timer = ::SetTimer(m_hwnd, LIST_TIMER, 200, nullptr);
}
void CListDlg::OnDestroy()
@@ -401,7 +401,7 @@ void CListDlg::OnDestroy() if (m_timer)
::KillTimer(m_hwnd, m_timer);
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "channelList_");
- m_proto->m_listDlg = NULL;
+ m_proto->m_listDlg = nullptr;
}
struct ListViewSortParam
@@ -518,7 +518,7 @@ void CJoinDlg::OnInitDialog() void CJoinDlg::OnDestroy()
{
CCoolIrcDlg::OnDestroy();
- m_proto->m_joinDlg = NULL;
+ m_proto->m_joinDlg = nullptr;
}
void CJoinDlg::OnOk(CCtrlButton*)
@@ -599,7 +599,7 @@ void CQuickDlg::OnInitDialog() if (m_proto->m_quickComboSelection != -1) {
m_serverCombo.SetCurSel(m_proto->m_quickComboSelection);
- OnServerCombo(NULL);
+ OnServerCombo(nullptr);
}
else EnableWindow(GetDlgItem(m_hwnd, IDOK), false);
}
@@ -609,7 +609,7 @@ void CQuickDlg::OnDestroy() CCoolIrcDlg::OnDestroy();
delete m_si;
- m_proto->m_quickDlg = NULL;
+ m_proto->m_quickDlg = nullptr;
}
void CQuickDlg::OnOk(CCtrlButton*)
@@ -705,7 +705,7 @@ CQuestionDlg::CQuestionDlg(CIrcProto *_pro, CManagerDlg *owner) m_Ok(this, IDOK),
m_owner(owner)
{
- if (owner != NULL)
+ if (owner != nullptr)
m_hwndParent = owner->GetHwnd();
m_Ok.OnClick = Callback(this, &CQuestionDlg::OnOk);
}
@@ -736,7 +736,7 @@ void CQuestionDlg::OnOk(CCtrlButton*) wchar_t *text = wcsstr(m, L"%question");
wchar_t *p1 = text;
- wchar_t *p2 = NULL;
+ wchar_t *p2 = nullptr;
if (p1) {
p1 += 9;
if (*p1 == '=' && p1[1] == '\"') {
@@ -759,7 +759,7 @@ void CQuestionDlg::OnOk(CCtrlButton*) CMStringW S('\0', j + 2);
GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, S.GetBuffer(), j + 1);
S.Replace(text, l);
- m_proto->PostIrcMessageWnd(NULL, NULL, S);
+ m_proto->PostIrcMessageWnd(nullptr, NULL, S);
delete[]m;
delete[]l;
@@ -893,7 +893,7 @@ void CManagerDlg::OnInitDialog() void CManagerDlg::OnClose()
{
if (m_applyModes.Enabled() || m_applyTopic.Enabled()) {
- int i = MessageBox(NULL, TranslateT("You have not applied all changes!\n\nApply before exiting?"), TranslateT("IRC warning"), MB_YESNOCANCEL | MB_ICONWARNING | MB_DEFBUTTON3);
+ int i = MessageBox(nullptr, TranslateT("You have not applied all changes!\n\nApply before exiting?"), TranslateT("IRC warning"), MB_YESNOCANCEL | MB_ICONWARNING | MB_DEFBUTTON3);
if (i == IDCANCEL) {
m_lresult = TRUE;
return;
@@ -901,9 +901,9 @@ void CManagerDlg::OnClose() if (i == IDYES) {
if (m_applyModes.Enabled())
- OnApplyModes(NULL);
+ OnApplyModes(nullptr);
if (m_applyTopic.Enabled())
- OnApplyTopic(NULL);
+ OnApplyTopic(nullptr);
}
}
@@ -934,7 +934,7 @@ void CManagerDlg::OnClose() void CManagerDlg::OnDestroy()
{
CCoolIrcDlg::OnDestroy();
- m_proto->m_managerDlg = NULL;
+ m_proto->m_managerDlg = nullptr;
}
void CManagerDlg::OnAdd(CCtrlButton*)
@@ -1054,7 +1054,7 @@ void CManagerDlg::OnRemove(CCtrlButton*) void CManagerDlg::OnListDblClick(CCtrlListBox*)
{
- OnEdit(NULL);
+ OnEdit(nullptr);
}
void CManagerDlg::OnChangeList(CCtrlListBox*)
diff --git a/protocols/IcqOscarJ/src/capabilities.cpp b/protocols/IcqOscarJ/src/capabilities.cpp index 6ea0b843ce..d7a4bf59c0 100644 --- a/protocols/IcqOscarJ/src/capabilities.cpp +++ b/protocols/IcqOscarJ/src/capabilities.cpp @@ -161,7 +161,7 @@ capstr* MatchCapability(BYTE *buf, size_t bufsize, const capstr *cap, size_t cap buf += BINARY_CAP_SIZE;
bufsize -= BINARY_CAP_SIZE;
}
- return 0;
+ return nullptr;
}
diff --git a/protocols/IcqOscarJ/src/chan_04close.cpp b/protocols/IcqOscarJ/src/chan_04close.cpp index d02e20817b..7e1f6b2ffa 100644 --- a/protocols/IcqOscarJ/src/chan_04close.cpp +++ b/protocols/IcqOscarJ/src/chan_04close.cpp @@ -27,7 +27,7 @@ void CIcqProto::handleCloseChannel(BYTE *buf, size_t datalen, serverthread_info *info)
{
- oscar_tlv_chain *chain = NULL;
+ oscar_tlv_chain *chain = nullptr;
// Parse server reply, prepare reconnection
if (!info->bLoggedIn && datalen && !info->isNewServerReady)
@@ -68,7 +68,7 @@ void CIcqProto::handleCloseChannel(BYTE *buf, size_t datalen, serverthread_info void CIcqProto::handleLoginReply(BYTE *buf, size_t datalen, serverthread_info *info)
{
- oscar_tlv_chain *chain = NULL;
+ oscar_tlv_chain *chain = nullptr;
icq_sendCloseConnection(); // imitate icq5 behaviour
@@ -136,9 +136,9 @@ int CIcqProto::connectNewServer(serverthread_info *info) debugLogA("Closed connection to login server");
- hServerConn = NetLib_OpenConnection(m_hNetlibUser, NULL, &nloc);
+ hServerConn = NetLib_OpenConnection(m_hNetlibUser, nullptr, &nloc);
if (hServerConn && info->newServerSSL) /* Start SSL session if requested */
- if (!Netlib_StartSsl(hServerConn, NULL))
+ if (!Netlib_StartSsl(hServerConn, nullptr))
NetLib_CloseConnection(&hServerConn, FALSE);
if (hServerConn) {
@@ -189,7 +189,7 @@ void CIcqProto::handleSignonError(WORD wError) case 0x05: // Mismatch uin or password
case 0x06: // Internal Client error (bad input to authorizer)
case 0x07: // Invalid account
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPASSWORD);
memset(m_szPassword, 0, sizeof(m_szPassword));
icq_LogFatalParam(LPGEN("Connection failed.\nYour ICQ number or password was rejected (%d)."), wError);
break;
@@ -201,7 +201,7 @@ void CIcqProto::handleSignonError(WORD wError) case 0x14: // Reservation map error
case 0x15: // Reservation link error
case 0x1A: // Reservation timeout
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NOSERVER);
icq_LogFatalParam(LPGEN("Connection failed.\nThe server is temporarily unavailable (%d)."), wError);
break;
@@ -212,12 +212,12 @@ void CIcqProto::handleSignonError(WORD wError) case 0x18: // Reservation rate limit exceeded
case 0x1D: // Rate limit exceeded
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NOSERVER);
icq_LogFatalParam(LPGEN("Connection failed.\nYou have connected too quickly,\nplease wait and retry 10 to 20 minutes later (%d)."), wError);
break;
case 0x1B: // You are using an older version of ICQ. Upgrade required
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPROTOCOL);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPROTOCOL);
icq_LogMessage(LOG_FATAL, LPGEN("Connection failed.\nThe server did not accept this client version."));
break;
@@ -268,7 +268,7 @@ void CIcqProto::handleRuntimeError(WORD wError) {
switch (wError) {
case 0x01:
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_OTHERLOCATION);
icq_LogMessage(LOG_FATAL, LPGEN("You have been disconnected from the ICQ network because you logged on from another location using the same ICQ number."));
break;
diff --git a/protocols/IcqOscarJ/src/chan_05ping.cpp b/protocols/IcqOscarJ/src/chan_05ping.cpp index d9e7e1da7a..bf807cc7c5 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(0) + KEEPALIVE_INTERVAL;
+ info->tmPing = time(nullptr) + KEEPALIVE_INTERVAL;
else
info->tmPing = -1;
}
@@ -48,7 +48,7 @@ void CIcqProto::CheckKeepAlive(serverthread_info *info) if (info->tmPing == -1)
return;
- if (time(0) >= info->tmPing) {
+ if (time(nullptr) >= 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/constants.cpp b/protocols/IcqOscarJ/src/constants.cpp index 54e47f744b..d632303f7a 100644 --- a/protocols/IcqOscarJ/src/constants.cpp +++ b/protocols/IcqOscarJ/src/constants.cpp @@ -40,7 +40,7 @@ static FieldNamesItem months[] = { { 10, LPGEN("October") },
{ 11, LPGEN("November") },
{ 12, LPGEN("December") },
- { 0, NULL }
+ { 0, nullptr }
};
const int ageRange[] = { 13, 0x7FFF }; // 14, 130
diff --git a/protocols/IcqOscarJ/src/cookies.cpp b/protocols/IcqOscarJ/src/cookies.cpp index 03f6be0954..df1305de8e 100644 --- a/protocols/IcqOscarJ/src/cookies.cpp +++ b/protocols/IcqOscarJ/src/cookies.cpp @@ -31,7 +31,7 @@ void CIcqProto::RemoveExpiredCookies()
{
- time_t tNow = time(NULL);
+ time_t tNow = time(nullptr);
for (int i = cookies.getCount() - 1; i >= 0; i--)
if ((cookies[i].dwTime + COOKIE_TIMEOUT) < tNow)
@@ -52,7 +52,7 @@ DWORD CIcqProto::AllocateCookie(BYTE bType, WORD wIdent, MCONTACT hContact, void p->dwCookie = dwThisSeq;
p->hContact = hContact;
p->pvExtra = pvExtra;
- p->dwTime = time(NULL);
+ p->dwTime = time(nullptr);
cookies.insert(p);
return dwThisSeq;
@@ -214,10 +214,10 @@ void CIcqProto::InitMessageCookie(cookie_message_data *pCookie) do {
// ensure that message ids are unique
- dwMsgID1 = time(NULL);
+ dwMsgID1 = time(nullptr);
dwMsgID2 = RandRange(0, 0x0FFFF);
}
- while (FindMessageCookie(dwMsgID1, dwMsgID2, NULL, NULL, NULL));
+ while (FindMessageCookie(dwMsgID1, dwMsgID2, nullptr, nullptr, nullptr));
if (pCookie) {
pCookie->dwMsgID1 = dwMsgID1;
diff --git a/protocols/IcqOscarJ/src/db.cpp b/protocols/IcqOscarJ/src/db.cpp index fc96fbea9f..cdf2caccdd 100644 --- a/protocols/IcqOscarJ/src/db.cpp +++ b/protocols/IcqOscarJ/src/db.cpp @@ -52,7 +52,7 @@ void ChangeInfoData::LoadSettingsFromDb(int keepChanged) if (!ppro->getSetting(NULL, si.szDbSetting, &dbv)) {
switch (dbv.type) {
case DBVT_ASCIIZ:
- sid.value = (LPARAM)ppro->getSettingStringUtf(NULL, si.szDbSetting, NULL);
+ sid.value = (LPARAM)ppro->getSettingStringUtf(NULL, si.szDbSetting, nullptr);
break;
case DBVT_UTF8:
@@ -75,7 +75,7 @@ void ChangeInfoData::LoadSettingsFromDb(int keepChanged) #ifdef _DEBUG
default:
- MessageBoxA(NULL, "That's not supposed to happen either", "Huh?", MB_OK);
+ MessageBoxA(nullptr, "That's not supposed to happen either", "Huh?", MB_OK);
break;
#endif
}
diff --git a/protocols/IcqOscarJ/src/directpackets.cpp b/protocols/IcqOscarJ/src/directpackets.cpp index 055c38ea39..7ee3bed194 100644 --- a/protocols/IcqOscarJ/src/directpackets.cpp +++ b/protocols/IcqOscarJ/src/directpackets.cpp @@ -135,7 +135,7 @@ void CIcqProto::icq_sendFileDenyDirect(MCONTACT hContact, filetransfer *ft, cons {
// v7 packet
icq_packet packet;
- char *szReasonAnsi = NULL;
+ char *szReasonAnsi = nullptr;
if (!utf8_decode(szReason, &szReasonAnsi))
szReasonAnsi = _strdup(szReason); // Legacy fix
size_t cbReasonAnsi = mir_strlen(szReasonAnsi);
@@ -162,7 +162,7 @@ void CIcqProto::icq_sendFileDenyDirect(MCONTACT hContact, filetransfer *ft, cons int CIcqProto::icq_sendFileSendDirectv7(filetransfer *ft, const char *pszFiles)
{
- char *szFilesAnsi = NULL;
+ char *szFilesAnsi = nullptr;
size_t wDescrLen = mir_strlen(ft->szDescription);
if (!utf8_decode(pszFiles, &szFilesAnsi))
@@ -189,7 +189,7 @@ int CIcqProto::icq_sendFileSendDirectv7(filetransfer *ft, const char *pszFiles) int CIcqProto::icq_sendFileSendDirectv8(filetransfer *ft, const char *pszFiles)
{
- char *szFilesAnsi = NULL;
+ char *szFilesAnsi = nullptr;
size_t wDescrLen = mir_strlen(ft->szDescription);
if (!utf8_decode(pszFiles, &szFilesAnsi))
diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp index fe4ceb8961..68bdab1338 100644 --- a/protocols/IcqOscarJ/src/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/dlgproc.cpp @@ -139,7 +139,7 @@ void ChangeInfoData::PaintItemSetting(HDC hdc, RECT *rc, int i, UINT itemState) rc->right = rcBtn.left;
DrawFrameControl(hdc, &rcBtn, DFC_SCROLL, iEditItem == i ? DFCS_SCROLLDOWN | DFCS_PUSHED : DFCS_SCROLLDOWN);
}
- DrawTextUtf(hdc, text, rc, DT_END_ELLIPSIS | DT_LEFT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER, NULL);
+ DrawTextUtf(hdc, text, rc, DT_END_ELLIPSIS | DT_LEFT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER, nullptr);
}
static int ChangeInfoDlg_Resize(HWND, LPARAM, UTILRESIZECONTROL *urc)
@@ -317,7 +317,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM rcItemDescr.right = rcItemValue.left;
rcItemDescr.left += 2;
- DrawTextUtf(cd->nmcd.hdc, ICQTranslateUtfStatic(setting[cd->nmcd.lItemlParam].szDescription, str, MAX_PATH), &rcItemDescr, DT_END_ELLIPSIS | DT_LEFT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER, NULL);
+ DrawTextUtf(cd->nmcd.hdc, ICQTranslateUtfStatic(setting[cd->nmcd.lItemlParam].szDescription, str, MAX_PATH), &rcItemDescr, DT_END_ELLIPSIS | DT_LEFT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER, nullptr);
dat->PaintItemSetting(cd->nmcd.hdc, &rcItemValue, cd->nmcd.lItemlParam, cd->nmcd.uItemState);
}
@@ -431,7 +431,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableDlgItem(hwndDlg, IDC_LIST, TRUE);
ShowDlgItem(hwndDlg, IDC_UPLOADING, SW_HIDE);
UnhookEvent(dat->hAckHook);
- dat->hAckHook = NULL;
+ dat->hAckHook = nullptr;
}
}
break;
@@ -461,9 +461,9 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (dat->hUpload[i] && ack->hProcess == dat->hUpload[i]) break;
if (i == _countof(dat->hUpload)) break;
- dat->hUpload[i] = NULL;
+ dat->hUpload[i] = nullptr;
for (done = 0, i = 0; i < _countof(dat->hUpload); i++)
- done += dat->hUpload[i] == NULL;
+ done += dat->hUpload[i] == nullptr;
wchar_t buf[MAX_PATH];
mir_snwprintf(buf, TranslateT("Upload in progress...%d%%"), 100 * done / (_countof(dat->hUpload)));
SetDlgItemText(hwndDlg, IDC_UPLOADING, buf);
@@ -471,7 +471,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM dat->ClearChangeFlags();
UnhookEvent(dat->hAckHook);
- dat->hAckHook = NULL;
+ dat->hAckHook = nullptr;
EnableDlgItem(hwndDlg, IDC_LIST, TRUE);
EnableDlgItem(hwndDlg, IDC_UPLOADING, FALSE);
SetDlgItemText(hwndDlg, IDC_UPLOADING, TranslateT("Upload complete"));
@@ -479,7 +479,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
else if (ack->result == ACKRESULT_FAILED) {
UnhookEvent(dat->hAckHook);
- dat->hAckHook = NULL;
+ dat->hAckHook = nullptr;
EnableDlgItem(hwndDlg, IDC_LIST, TRUE);
EnableDlgItem(hwndDlg, IDC_UPLOADING, FALSE);
SetDlgItemText(hwndDlg, IDC_UPLOADING, TranslateT("Upload FAILED"));
@@ -492,7 +492,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_DESTROY:
if (dat->hAckHook) {
UnhookEvent(dat->hAckHook);
- dat->hAckHook = NULL;
+ dat->hAckHook = nullptr;
}
DeleteObject((HFONT)SendMessage(dat->hwndList, WM_GETFONT, 0, 0));
diff --git a/protocols/IcqOscarJ/src/editlist.cpp b/protocols/IcqOscarJ/src/editlist.cpp index 847deefdfd..af99fa4531 100644 --- a/protocols/IcqOscarJ/src/editlist.cpp +++ b/protocols/IcqOscarJ/src/editlist.cpp @@ -27,8 +27,8 @@ #include "stdafx.h"
-static ChangeInfoData *dataListEdit = NULL;
-static HWND hwndListEdit = NULL;
+static ChangeInfoData *dataListEdit = nullptr;
+static HWND hwndListEdit = nullptr;
static LRESULT CALLBACK ListEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -80,7 +80,7 @@ void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey dataListEdit = this;
hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, L"LISTBOX", L"", WS_POPUP | WS_BORDER | WS_VSCROLL,
- rc->left, rc->bottom, rc->right - rc->left, 150, NULL, NULL, hInst, NULL);
+ rc->left, rc->bottom, rc->right - rc->left, 150, nullptr, nullptr, hInst, nullptr);
SendMessage(hwndListEdit, WM_SETFONT, (WPARAM)hListFont, 0);
int itemHeight = SendMessage(hwndListEdit, LB_GETITEMHEIGHT, 0, 0);
@@ -117,7 +117,7 @@ void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
if ((si.dbType == DBVT_ASCIIZ && (!mir_strcmp((char*)sid.value, list[j].text))
|| (si.dbType == DBVT_ASCIIZ && (!mir_strcmp((char*)sid.value, ICQTranslateUtfStatic(list[j].text, str, MAX_PATH))))
- || ((char*)sid.value == NULL && list[j].code == 0))
+ || ((char*)sid.value == nullptr && list[j].code == 0))
|| (si.dbType != DBVT_ASCIIZ && sid.value == list[j].code))
SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
}
@@ -126,7 +126,7 @@ void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey int listCount = SendMessage(hwndListEdit, LB_GETCOUNT, 0, 0);
if (itemHeight * listCount < 150)
- SetWindowPos(hwndListEdit, 0, 0, 0, rc->right - rc->left, itemHeight * listCount + GetSystemMetrics(SM_CYBORDER) * 2, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(hwndListEdit, nullptr, 0, 0, rc->right - rc->left, itemHeight * listCount + GetSystemMetrics(SM_CYBORDER) * 2, SWP_NOZORDER | SWP_NOMOVE);
mir_subclassWindow(hwndListEdit, ListEditSubclassProc);
AnimateWindow(hwndListEdit, 200, AW_SLIDE | AW_ACTIVATE | AW_VER_POSITIVE);
ShowWindow(hwndListEdit, SW_SHOW);
@@ -137,7 +137,7 @@ void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey void ChangeInfoData::EndListEdit(int save)
{
- if (hwndListEdit == NULL || iEditItem == -1 || this != dataListEdit)
+ if (hwndListEdit == nullptr || iEditItem == -1 || this != dataListEdit)
return;
if (save) {
@@ -163,7 +163,7 @@ void ChangeInfoData::EndListEdit(int save) sid.value = (LPARAM)null_strdup(szNewValue);
}
else {
- sid.changed = (char*)sid.value != NULL;
+ sid.changed = (char*)sid.value != nullptr;
SAFE_FREE((void**)&sid.value);
}
}
@@ -184,9 +184,9 @@ void ChangeInfoData::EndListEdit(int save) }
ListView_RedrawItems(hwndList, iEditItem, iEditItem);
iEditItem = -1;
- dataListEdit = NULL;
+ dataListEdit = nullptr;
DestroyWindow(hwndListEdit);
- hwndListEdit = NULL;
+ hwndListEdit = nullptr;
}
int IsListEditWindow(HWND hwnd)
diff --git a/protocols/IcqOscarJ/src/editstring.cpp b/protocols/IcqOscarJ/src/editstring.cpp index 64eb745fba..ee2029956f 100644 --- a/protocols/IcqOscarJ/src/editstring.cpp +++ b/protocols/IcqOscarJ/src/editstring.cpp @@ -27,8 +27,8 @@ #include "stdafx.h"
-static ChangeInfoData *dataStringEdit = NULL;
-static HWND hwndEdit = NULL, hwndExpandButton = NULL, hwndUpDown = NULL;
+static ChangeInfoData *dataStringEdit = nullptr;
+static HWND hwndEdit = nullptr, hwndExpandButton = nullptr, hwndUpDown = nullptr;
static const char escapes[]={'a','\a',
'b','\b',
@@ -188,7 +188,7 @@ static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wPa SendMessage(hwndEdit, EM_GETSEL, (WPARAM)&selStart, (LPARAM)&selEnd);
DestroyWindow(hwndEdit);
EscapesToMultiline(text, &selStart, &selEnd);
- hwndEdit = CreateWindowExA(WS_EX_TOOLWINDOW, "EDIT", "", WS_POPUP | WS_BORDER | WS_VISIBLE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL | ES_MULTILINE, rcStart.left, rcStart.top, rcStart.right - rcStart.left, rcStart.bottom - rcStart.top, NULL, NULL, hInst, NULL);
+ hwndEdit = CreateWindowExA(WS_EX_TOOLWINDOW, "EDIT", "", WS_POPUP | WS_BORDER | WS_VISIBLE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL | ES_MULTILINE, rcStart.left, rcStart.top, rcStart.right - rcStart.left, rcStart.bottom - rcStart.top, nullptr, nullptr, hInst, nullptr);
SetWindowTextUcs(hwndEdit, text);
mir_subclassWindow(hwndEdit, StringEditSubclassProc);
SendMessage(hwndEdit, WM_SETFONT, (WPARAM)dataStringEdit->hListFont, 0);
@@ -207,13 +207,13 @@ static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wPa UpdateWindow(hwndEdit);
timeNow = GetTickCount();
if (timeNow > startTime + 200) break;
- SetWindowPos(hwndEdit, 0, rcEnd.left, rcEnd.top, (rcEnd.right - rcStart.right)*(timeNow - startTime) / 200 + rcStart.right - rcEnd.left, (rcEnd.bottom - rcStart.bottom)*(timeNow - startTime) / 200 + rcStart.bottom - rcEnd.top, SWP_NOZORDER);
+ SetWindowPos(hwndEdit, nullptr, rcEnd.left, rcEnd.top, (rcEnd.right - rcStart.right)*(timeNow - startTime) / 200 + rcStart.right - rcEnd.left, (rcEnd.bottom - rcStart.bottom)*(timeNow - startTime) / 200 + rcStart.bottom - rcEnd.top, SWP_NOZORDER);
}
}
- SetWindowPos(hwndEdit, 0, rcEnd.left, rcEnd.top, rcEnd.right - rcEnd.left, rcEnd.bottom - rcEnd.top, SWP_NOZORDER);
+ SetWindowPos(hwndEdit, nullptr, rcEnd.left, rcEnd.top, rcEnd.right - rcEnd.left, rcEnd.bottom - rcEnd.top, SWP_NOZORDER);
DestroyWindow(hwnd);
- hwndExpandButton = NULL;
+ hwndExpandButton = nullptr;
SAFE_FREE((void**)&text);
}
@@ -251,13 +251,13 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) if ((si.displayType & LIM_TYPE) == LI_LONGSTRING) {
rc->right -= rc->bottom - rc->top;
- hwndExpandButton = CreateWindowA("BUTTON", "", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_ICON, rc->right, rc->top, rc->bottom - rc->top, rc->bottom - rc->top, hwndList, NULL, hInst, NULL);
+ hwndExpandButton = CreateWindowA("BUTTON", "", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_ICON, rc->right, rc->top, rc->bottom - rc->top, rc->bottom - rc->top, hwndList, nullptr, hInst, nullptr);
SendMessage(hwndExpandButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(iconList[0].hIcolib));
mir_subclassWindow(hwndExpandButton, ExpandButtonSubclassProc);
}
dataStringEdit = this;
- hwndEdit = CreateWindow(L"EDIT", L"", WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ((si.displayType&LIM_TYPE) == LI_NUMBER ? ES_NUMBER : 0) | (si.displayType&LIF_PASSWORD ? ES_PASSWORD : 0), rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, hwndList, NULL, hInst, NULL);
+ hwndEdit = CreateWindow(L"EDIT", L"", WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ((si.displayType&LIM_TYPE) == LI_NUMBER ? ES_NUMBER : 0) | (si.displayType&LIF_PASSWORD ? ES_PASSWORD : 0), rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, hwndList, nullptr, hInst, nullptr);
SetWindowTextUtf(hwndEdit, szValue);
if (alloced) SAFE_FREE(&szValue);
mir_subclassWindow(hwndEdit, StringEditSubclassProc);
@@ -265,14 +265,14 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) if ((si.displayType & LIM_TYPE) == LI_NUMBER) {
int *range = (int*)si.pList;
RECT rcUpDown;
- hwndUpDown = CreateWindow(UPDOWN_CLASS, L"", WS_VISIBLE | WS_CHILD | UDS_AUTOBUDDY | UDS_ALIGNRIGHT | UDS_HOTTRACK | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 0, 0, 0, 0, hwndList, NULL, hInst, NULL);
+ hwndUpDown = CreateWindow(UPDOWN_CLASS, L"", WS_VISIBLE | WS_CHILD | UDS_AUTOBUDDY | UDS_ALIGNRIGHT | UDS_HOTTRACK | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 0, 0, 0, 0, hwndList, nullptr, hInst, nullptr);
SendMessage(hwndUpDown, UDM_SETRANGE32, range[0], range[1]);
SendMessage(hwndUpDown, UDM_SETPOS32, 0, sid.value);
if (!(si.displayType & LIF_ZEROISVALID) && sid.value == 0)
SetWindowTextA(hwndEdit, "");
GetClientRect(hwndUpDown, &rcUpDown);
rc->right -= rcUpDown.right;
- SetWindowPos(hwndEdit, 0, 0, 0, rc->right - rc->left, rc->bottom - rc->top, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(hwndEdit, nullptr, 0, 0, rc->right - rc->left, rc->bottom - rc->top, SWP_NOZORDER | SWP_NOMOVE);
}
SendMessage(hwndEdit, EM_SETSEL, 0, (LPARAM)-1);
SetFocus(hwndEdit);
@@ -281,7 +281,7 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) void ChangeInfoData::EndStringEdit(int save)
{
- if (hwndEdit == NULL || iEditItem == -1 || this != dataStringEdit)
+ if (hwndEdit == nullptr || iEditItem == -1 || this != dataStringEdit)
return;
if (save) {
@@ -334,13 +334,13 @@ void ChangeInfoData::EndStringEdit(int save) ListView_RedrawItems(hwndList, iEditItem, iEditItem);
iEditItem = -1;
- dataStringEdit = NULL;
+ dataStringEdit = nullptr;
DestroyWindow(hwndEdit);
- hwndEdit = NULL;
+ hwndEdit = nullptr;
if (hwndExpandButton) DestroyWindow(hwndExpandButton);
- hwndExpandButton = NULL;
+ hwndExpandButton = nullptr;
if (hwndUpDown) DestroyWindow(hwndUpDown);
- hwndUpDown = NULL;
+ hwndUpDown = nullptr;
}
int IsStringEditWindow(HWND hwnd)
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index 0ebfd7f522..c654288d64 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(NULL));
+ setDword("LogonTS", dwValue ? dwValue : time(nullptr));
disposeChain(&chain);
@@ -318,7 +318,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade case ICQ_SERVER_REDIRECT_SERVICE: // reply to family request, got new connection point
{
- oscar_tlv_chain *pChain = NULL;
+ oscar_tlv_chain *pChain = nullptr;
cookie_family_request *pCookieData;
if (!(pChain = readIntoTLVChain(&pBuffer, wBufferLength, 0))) {
@@ -328,7 +328,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade // pick request data
WORD wFamily = pChain->getWord(0x0D, 1);
- if ((!FindCookie(pSnacHeader->dwRef, NULL, (void**)&pCookieData)) || (pCookieData->wFamily != wFamily)) {
+ if ((!FindCookie(pSnacHeader->dwRef, nullptr, (void**)&pCookieData)) || (pCookieData->wFamily != wFamily)) {
disposeChain(&pChain);
debugLogA("Received unexpected SNAC(1,5), skipping.");
break;
@@ -363,15 +363,15 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade nloc.szHost = pServer;
nloc.wPort = wPort;
- HNETLIBCONN hConnection = NetLib_OpenConnection(m_hNetlibUser, wFamily == ICQ_AVATAR_FAMILY ? "Avatar " : NULL, &nloc);
+ HNETLIBCONN hConnection = NetLib_OpenConnection(m_hNetlibUser, wFamily == ICQ_AVATAR_FAMILY ? "Avatar " : nullptr, &nloc);
- if (hConnection == NULL)
+ if (hConnection == nullptr)
debugLogA("Unable to connect to ICQ new family server.");
// we want the handler to be called even if the connecting failed
else if (bServerSSL) { /* Start SSL session if requested */
debugLogA("(%p) Starting SSL negotiation", Netlib_GetSocket(hConnection));
- if (!Netlib_StartSsl(hConnection, NULL)) {
+ if (!Netlib_StartSsl(hConnection, nullptr)) {
debugLogA("Unable to connect to ICQ new family server, SSL could not be negotiated");
NetLib_CloseConnection(&hConnection, FALSE);
}
diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp index f47d89a49e..088614904d 100644 --- a/protocols/IcqOscarJ/src/fam_02location.cpp +++ b/protocols/IcqOscarJ/src/fam_02location.cpp @@ -77,7 +77,7 @@ static char* AimApplyEncoding(char* pszStr, const char* pszEncoding) if (szEnc) { // decode custom encoding to Utf-8
char *szStr = ApplyEncoding(pszStr, szEnc + 9);
// decode utf-8 to ansi
- char *szRes = NULL;
+ char *szRes = nullptr;
SAFE_FREE((void**)&pszStr);
if (!utf8_decode(szStr, &szRes))
@@ -115,7 +115,7 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, size_t wLen, DWORD dwCook wLen -= 2;
// Determine contact
- MCONTACT hContact = HContactFromUID(dwUIN, szUID, NULL);
+ MCONTACT hContact = HContactFromUID(dwUIN, szUID, nullptr);
// Ignore away status if the user is not already on our list
if (hContact == INVALID_CONTACT_ID) {
@@ -144,7 +144,7 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, size_t wLen, DWORD dwCook if (wLen < 4)
return;
- char *szMsg = NULL;
+ char *szMsg = nullptr;
BYTE *tmp = buf;
// Get general chain
@@ -158,7 +158,7 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, size_t wLen, DWORD dwCook // Get extra chain
if (pChain = readIntoTLVChain(&buf, wLen, 2)) {
- char *szEncoding = NULL;
+ char *szEncoding = nullptr;
// Get Profile encoding TLV
oscar_tlv *pTLV = pChain->getTLV(0x05, 1);
@@ -221,9 +221,9 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, size_t wLen, DWORD dwCook wLen -= (buf - tmp);
// Get extra chain
- char *szMsg = NULL;
+ char *szMsg = nullptr;
if (pChain = readIntoTLVChain(&buf, wLen, 2)) {
- char *szEncoding = NULL;
+ char *szEncoding = nullptr;
// Get Away encoding TLV
oscar_tlv *pTLV = pChain->getTLV(0x03, 1);
@@ -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(NULL);
+ pre.timestamp = time(nullptr);
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 475855c3af..4b79391c19 100644 --- a/protocols/IcqOscarJ/src/fam_03buddy.cpp +++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp @@ -159,7 +159,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info*) DWORD dwDirectConnCookie = 0;
DWORD dwWebPort = 0;
DWORD dwFT1 = 0, dwFT2 = 0, dwFT3 = 0;
- const char *szClient = NULL;
+ const char *szClient = nullptr;
BYTE bClientId = 0;
WORD wVersion = 0;
WORD wTLVCount;
@@ -186,7 +186,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info*) wLen -= 2;
// Ignore status notification if the user is not already on our list
- MCONTACT hContact = HContactFromUID(dwUIN, szUID, NULL);
+ MCONTACT hContact = HContactFromUID(dwUIN, szUID, nullptr);
if (hContact == INVALID_CONTACT_ID) {
debugLogA("Ignoring user online (%s)", strUID(dwUIN, szUID));
return;
@@ -303,7 +303,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info*) wOldStatus = getContactStatus(hContact);
// Collect all Capability info from TLV chain
- BYTE *capBuf = NULL;
+ BYTE *capBuf = nullptr;
WORD capLen = 0;
// Get Location Capability Info TLVs
@@ -378,7 +378,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info*) // Update the contact's capabilies if present in packet
SetCapabilitiesFromBuffer(hContact, capBuf, capLen, wOldStatus == ID_STATUS_OFFLINE);
- char *szCurrentClient = wOldStatus == ID_STATUS_OFFLINE ? NULL : getSettingStringUtf(hContact, "MirVer", NULL);
+ char *szCurrentClient = wOldStatus == ID_STATUS_OFFLINE ? nullptr : getSettingStringUtf(hContact, "MirVer", nullptr);
szClient = detectUserClient(hContact, nIsICQ, wClass, dwOnlineSince, szCurrentClient, wVersion, dwFT1, dwFT2, dwFT3, dwDirectConnCookie, dwWebPort, capBuf, capLen, &bClientId, szStrBuf);
// Check if the client changed, if not do not change
@@ -393,20 +393,20 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info*) // no capability
debugLogA("No capability info TLVs");
- szClient = detectUserClient(hContact, nIsICQ, wClass, dwOnlineSince, NULL, wVersion, dwFT1, dwFT2, dwFT3, dwDirectConnCookie, dwWebPort, NULL, capLen, &bClientId, szStrBuf);
+ szClient = detectUserClient(hContact, nIsICQ, wClass, dwOnlineSince, nullptr, wVersion, dwFT1, dwFT2, dwFT3, dwDirectConnCookie, dwWebPort, nullptr, capLen, &bClientId, szStrBuf);
}
else // Capabilities not present in update packet, do not touch
szClient = (const char*)-1; // we don't want to client be overwritten
// handle Xtraz status
- char *moodData = NULL;
+ char *moodData = nullptr;
WORD moodSize = 0;
- unpackSessionDataItem(pChain, 0x0E, (BYTE**)&moodData, &moodSize, NULL);
+ unpackSessionDataItem(pChain, 0x0E, (BYTE**)&moodData, &moodSize, nullptr);
if (capLen || wOldStatus == ID_STATUS_OFFLINE)
handleXStatusCaps(dwUIN, szUID, hContact, capBuf, capLen, moodData, moodSize);
else
- handleXStatusCaps(dwUIN, szUID, hContact, NULL, 0, moodData, moodSize);
+ handleXStatusCaps(dwUIN, szUID, hContact, nullptr, 0, moodData, moodSize);
// Determine support for extended status messages
if (pChain->getWord(0x08, 1) == 0x0A06)
@@ -442,7 +442,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info*) if (pTLV)
handleAvatarContactHash(dwUIN, szUID, hContact, pTLV->pData, pTLV->wLen);
else
- handleAvatarContactHash(dwUIN, szUID, hContact, NULL, 0);
+ handleAvatarContactHash(dwUIN, szUID, hContact, nullptr, 0);
// Process Status Note
parseStatusNote(dwUIN, szUID, hContact, pChain);
@@ -516,7 +516,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info*) if (getByte("KillSpambots", DEFAULT_KILLSPAM_ENABLED) && db_get_b(hContact, "CList", "NotOnList", 0)) {
// kill spammer
icq_DequeueUser(dwUIN);
- icq_sendRemoveContact(dwUIN, NULL);
+ icq_sendRemoveContact(dwUIN, nullptr);
AddToSpammerList(dwUIN);
if (getByte("PopupsSpamEnabled", DEFAULT_SPAM_POPUPS_ENABLED))
ShowPopupMsg(hContact, LPGEN("Spambot Detected"), LPGEN("Contact deleted & further events blocked."), POPTYPE_SPAM);
@@ -533,7 +533,7 @@ void CIcqProto::handleUserOffline(BYTE *buf, size_t wLen) uid_str szUID;
do {
- oscar_tlv_chain *pChain = NULL;
+ oscar_tlv_chain *pChain = nullptr;
// Unpack the sender's user ID
if (!unpackUID(&buf, &wLen, &dwUIN, &szUID)) return;
@@ -579,18 +579,18 @@ void CIcqProto::handleUserOffline(BYTE *buf, size_t wLen) }
// Determine contact
- MCONTACT hContact = HContactFromUID(dwUIN, szUID, NULL);
+ MCONTACT hContact = HContactFromUID(dwUIN, szUID, nullptr);
// Skip contacts that are not already on our list or are already offline
if (hContact != INVALID_CONTACT_ID) {
WORD wOldStatus = getContactStatus(hContact);
// Process Avatar Hash
- oscar_tlv *pAvatarTLV = pChain ? pChain->getTLV(0x1D, 1) : NULL;
+ oscar_tlv *pAvatarTLV = pChain ? pChain->getTLV(0x1D, 1) : nullptr;
if (pAvatarTLV)
handleAvatarContactHash(dwUIN, szUID, hContact, pAvatarTLV->pData, pAvatarTLV->wLen);
else
- handleAvatarContactHash(dwUIN, szUID, hContact, NULL, 0);
+ handleAvatarContactHash(dwUIN, szUID, hContact, nullptr, 0);
// Process Status Note (offline status note)
parseStatusNote(dwUIN, szUID, hContact, pChain);
@@ -624,17 +624,17 @@ void CIcqProto::handleUserOffline(BYTE *buf, size_t wLen) void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, oscar_tlv_chain *pChain)
{
- DWORD dwStatusNoteTS = time(NULL);
+ DWORD dwStatusNoteTS = time(nullptr);
BYTE *pStatusNoteTS, *pStatusNote;
WORD wStatusNoteTSLen, wStatusNoteLen;
BYTE bStatusNoteFlags;
- if (unpackSessionDataItem(pChain, 0x0D, &pStatusNoteTS, &wStatusNoteTSLen, NULL) && wStatusNoteTSLen == sizeof(DWORD))
+ if (unpackSessionDataItem(pChain, 0x0D, &pStatusNoteTS, &wStatusNoteTSLen, nullptr) && wStatusNoteTSLen == sizeof(DWORD))
unpackDWord(&pStatusNoteTS, &dwStatusNoteTS);
// Get Status Note session item
if (unpackSessionDataItem(pChain, 0x02, &pStatusNote, &wStatusNoteLen, &bStatusNoteFlags)) {
- char *szStatusNote = NULL;
+ char *szStatusNote = nullptr;
if ((bStatusNoteFlags & 4) == 4 && wStatusNoteLen >= 4) {
BYTE *buf = pStatusNote;
@@ -652,7 +652,7 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, osc buflen -= wTextLen;
WORD wEncodingType = 0;
- char *szEncoding = NULL;
+ char *szEncoding = nullptr;
if (buflen >= 2)
unpackWord(&buf, &wEncodingType);
@@ -693,14 +693,14 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, osc setStatusMsgVar(hContact, szStatusNote, false);
wchar_t *tszNote = mir_utf8decodeW(szStatusNote);
- ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszNote);
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, nullptr, (LPARAM)tszNote);
mir_free(tszNote);
}
}
SAFE_FREE(&szStatusNote);
}
else if (getContactStatus(hContact) == ID_STATUS_OFFLINE) {
- setStatusMsgVar(hContact, NULL, false);
+ setStatusMsgVar(hContact, nullptr, false);
delSetting(hContact, DBSETTING_STATUS_NOTE);
setDword(hContact, DBSETTING_STATUS_NOTE_TIME, dwStatusNoteTS);
}
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index ece665183a..bad7a528c4 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -184,7 +184,7 @@ void CIcqProto::handleRecvServMsg(BYTE *buf, size_t wLen, DWORD dwRef) char* CIcqProto::convertMsgToUserSpecificUtf(MCONTACT hContact, const char *szMsg)
{
WORD wCP = getWord(hContact, "CodePage", m_wAnsiCodepage);
- char *usMsg = NULL;
+ char *usMsg = nullptr;
if (wCP != CP_ACP)
usMsg = ansi_to_utf8_codepage(szMsg, wCP);
@@ -231,7 +231,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char // but in some cases there can be more 0x0101 TLVs containing message parts in
// different encodings (just like the new format of Offline Messages).
DWORD dwRecvTime;
- char* szMsg = NULL;
+ char* szMsg = nullptr;
bool bUtf8 = false;
PROTORECVEVENT pre = { 0 };
@@ -241,7 +241,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char WORD wMsgPart = 1;
while (oscar_tlv *pMessageTLV = pChain->getTLV(0x0101, wMsgPart)) { // Loop thru all message parts
if (pMessageTLV->wLen > 4) {
- char *szMsgPart = NULL;
+ char *szMsgPart = nullptr;
bool bMsgPartUnicode = false;
// The message begins with a encoding specification
@@ -318,11 +318,11 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char }
}
- dwRecvTime = (DWORD)time(NULL);
+ dwRecvTime = (DWORD)time(nullptr);
{ // Check if the message was received as offline
cookie_offline_messages *cookie;
- if (!(dwRef & 0x80000000) && FindCookie(dwRef, NULL, (void**)&cookie)) {
+ if (!(dwRef & 0x80000000) && FindCookie(dwRef, nullptr, (void**)&cookie)) {
cookie->nMessages++;
WORD wTimeTLVType;
@@ -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(NULL) - (dwMsgID1 / 1000));
+ setDword(hContact, "TickTS", time(nullptr) - (dwMsgID1 / 1000));
}
else debugLogA("Message (format %u) - Ignoring empty message", 1);
@@ -367,7 +367,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, size_t wLen, DWORD dwUin, char {
WORD wTLVType;
size_t wTLVLen;
- BYTE *pDataBuf = NULL;
+ BYTE *pDataBuf = nullptr;
if (wLen < 4) {
debugLogA("Message (format %u) - Ignoring empty message", 2);
@@ -410,7 +410,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, size_t wLen, DWORD dwUin, char wTLVLen -= 16;
if (CompareGUIDs(q1, q2, q3, q4, MCAP_SRV_RELAY_FMT)) { // we surely have at least 4 bytes for TLV chain
- MCONTACT hContact = HContactFromUID(dwUin, szUID, NULL);
+ MCONTACT hContact = HContactFromUID(dwUin, szUID, nullptr);
if (wCommand == 1) {
debugLogA("Cannot handle abort messages yet... :(");
@@ -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(NULL) - (dwMsgID1 / 1000));
+ setDword(hContact, "TickTS", time(nullptr) - (dwMsgID1 / 1000));
else
setDword(hContact, "TickTS", 0);
}
@@ -500,7 +500,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, size_t wLen, DWORD dwUin, char BYTE *buf2 = tlv->pData;
unpackLEDWord(&buf2, &dwUin);
- MCONTACT hContact = HContactFromUIN(dwUin, NULL);
+ MCONTACT hContact = HContactFromUIN(dwUin, nullptr);
if (hContact == INVALID_CONTACT_ID)
debugLogA("Error: %s from unknown contact %u", "Reverse Connect Request", dwUin);
else {
@@ -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(NULL), dwMsgID1, dwMsgID2, wCookie, wVersion, bMsgType, bFlags, wAckType, wLen, wMsgLen, (char*)pDataBuf, 0, &pMsgAck);
+ handleMessageTypes(dwUin, szUID, time(nullptr), 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(NULL), dwMsgID1, dwMsgID2, wCookie, wVersion, nMsgType, bFlags, wAckType, dwLengthToEnd, 0, (char*)pDataBuf, MTF_PLUGIN | MTF_STATUS_EXTENDED, NULL);
+ handleMessageTypes(dwUin, szUID, time(nullptr), 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(NULL), dwMsgID1, dwMsgID2, wCookie, wVersion, nTypeId, bFlags, wAckType, dwLengthToEnd, dwDataLen, (char*)pDataBuf, MTF_PLUGIN, &pMsgAck);
+ handleMessageTypes(dwUin, szUID, time(nullptr), dwMsgID1, dwMsgID2, wCookie, wVersion, nTypeId, bFlags, wAckType, dwLengthToEnd, dwDataLen, (char*)pDataBuf, MTF_PLUGIN, &pMsgAck);
}
else debugLogA("Unsupported plugin message type %d", nTypeId);
}
@@ -877,7 +877,7 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, DWORD dwUi void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwID1, DWORD dwID2, WORD wCommand)
{
- MCONTACT hContact = HContactFromUID(dwUin, szUID, NULL);
+ MCONTACT hContact = HContactFromUID(dwUin, szUID, nullptr);
if (wCommand == 0) { // received contacts
if (wLen < 4) { // just check if at least one tlv is there
@@ -1002,7 +1002,7 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c if (nLen >= wNickLen) {
WORD wNickTLV;
size_t wNickTLVLen;
- char *pNick = NULL;
+ char *pNick = nullptr;
unpackTypedTLV(pBuffer, wNickLen, 0x01, &wNickTLV, &wNickTLVLen, (LPBYTE*)&pNick);
if (wNickTLV == 0x01) {
@@ -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(NULL);
+ pre.timestamp = (DWORD)time(nullptr);
pre.szMessage = (char *)contacts;
pre.lParam = nContacts;
ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
@@ -1059,7 +1059,7 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c else if (wCommand == 2) { // acknowledgement
DWORD dwCookie;
MCONTACT hCookieContact;
- if (FindMessageCookie(dwID1, dwID2, &dwCookie, &hCookieContact, NULL)) {
+ if (FindMessageCookie(dwID1, dwID2, &dwCookie, &hCookieContact, nullptr)) {
if (hCookieContact != hContact)
debugLogA("Warning: Ack Contact does not match Cookie Contact(0x%x != 0x%x)", hContact, hCookieContact);
@@ -1105,12 +1105,12 @@ 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(NULL);
+ DWORD dwRecvTime = (DWORD)time(nullptr);
- if (!(dwRef & 0x80000000) && FindCookie(dwRef, NULL, (void**)&cookie)) {
+ if (!(dwRef & 0x80000000) && FindCookie(dwRef, nullptr, (void**)&cookie)) {
WORD wTimeTLVType;
size_t wTimeTLVLen;
- BYTE *pTimeTLV = NULL;
+ BYTE *pTimeTLV = nullptr;
cookie->nMessages++;
@@ -1132,7 +1132,7 @@ void CIcqProto::handleRecvServMsgType4(BYTE *buf, size_t wLen, DWORD dwUin, char wLen -= wMsgLen;
int typeId;
- if (unpackPluginTypeId(&pmsg, &wLen, &typeId, NULL, FALSE) && wLen > 8) {
+ if (unpackPluginTypeId(&pmsg, &wLen, &typeId, nullptr, FALSE) && wLen > 8) {
size_t dwLengthToEnd, dwDataLen;
// Length of remaining data
@@ -1147,14 +1147,14 @@ void CIcqProto::handleRecvServMsgType4(BYTE *buf, size_t wLen, DWORD dwUin, char if (typeId) {
uid_str szUid;
- handleMessageTypes(dwUin, szUid, dwRecvTime, dwMsgID1, dwMsgID2, 0, 0, typeId, bFlags, 0, dwLengthToEnd, dwDataLen, (char*)pmsg, MTF_PLUGIN, NULL);
+ handleMessageTypes(dwUin, szUid, dwRecvTime, dwMsgID1, dwMsgID2, 0, 0, typeId, bFlags, 0, dwLengthToEnd, dwDataLen, (char*)pmsg, MTF_PLUGIN, nullptr);
}
else debugLogA("Unsupported plugin message type %d", typeId);
}
}
else {
uid_str szUid;
- handleMessageTypes(dwUin, szUid, dwRecvTime, dwMsgID1, dwMsgID2, 0, 0, bMsgType, bFlags, 0, wTLVLen - 8, wMsgLen, (char*)pmsg, 0, NULL);
+ handleMessageTypes(dwUin, szUid, dwRecvTime, dwMsgID1, dwMsgID2, 0, 0, bMsgType, bFlags, 0, wTLVLen - 8, wMsgLen, (char*)pmsg, 0, nullptr);
}
}
}
@@ -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(NULL);
+ pre.timestamp = time(nullptr);
pre.lParam = wCookie;
ProtoChainRecv(hContact, PSR_AWAYMSG, status, (LPARAM)&pre);
}
@@ -1424,9 +1424,9 @@ HANDLE CIcqProto::handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, int t {
if (bFlags == 3) {
MCONTACT hCookieContact;
- cookie_message_data *pCookieData = NULL;
+ cookie_message_data *pCookieData = nullptr;
- MCONTACT hContact = HContactFromUID(dwUin, szUID, NULL);
+ MCONTACT hContact = HContactFromUID(dwUin, szUID, nullptr);
if (!FindCookie(wCookie, &hCookieContact, (void**)&pCookieData)) {
debugLogA("%sIgnoring unrequested status message from %u", "handleMessageAck: ", dwUin);
@@ -1463,7 +1463,7 @@ void CIcqProto::sendMessageTypesAck(MCONTACT hContact, int bUnicode, message_ack icq_sendAdvancedMsgAck(pArgs->dwUin, pArgs->dwMsgID1, pArgs->dwMsgID2, pArgs->wCookie, (BYTE)pArgs->msgType, pArgs->bFlags);
}
else if (pArgs->bType == MAT_DIRECT) { // Send acknowledgement
- icq_sendDirectMsgAck(pArgs->pDC, pArgs->wCookie, (BYTE)pArgs->msgType, pArgs->bFlags, bUnicode ? (char *)CAP_UTF8MSGS : NULL);
+ icq_sendDirectMsgAck(pArgs->pDC, pArgs->wCookie, (BYTE)pArgs->msgType, pArgs->bFlags, bUnicode ? (char *)CAP_UTF8MSGS : nullptr);
}
}
}
@@ -1719,7 +1719,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, }
debugLogA("Received SMS Mobile message");
- ProtoBroadcastAck(NULL, ICQACKTYPE_SMS, ACKRESULT_SUCCESS, NULL, (LPARAM)szMsg);
+ ProtoBroadcastAck(NULL, ICQACKTYPE_SMS, ACKRESULT_SUCCESS, nullptr, (LPARAM)szMsg);
break;
case MTYPE_STATUSMSGEXT:
@@ -1800,7 +1800,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, struct rates_status_message_response : public rates_queue_item
{
protected:
- virtual rates_queue_item* copyItem(rates_queue_item *aDest = NULL)
+ virtual rates_queue_item* copyItem(rates_queue_item *aDest = nullptr)
{
rates_status_message_response *pDest = (rates_status_message_response*)aDest;
if (!pDest)
@@ -1879,7 +1879,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen) BYTE bFlags;
WORD wLength;
WORD wVersion = 0;
- cookie_message_data *pCookieData = NULL;
+ cookie_message_data *pCookieData = nullptr;
DWORD dwMsgID1, dwMsgID2;
unpackLEDWord(&buf, &dwMsgID1); // Message ID
@@ -1898,7 +1898,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen) if (!unpackUID(&buf, &wLen, &dwUin, &szUid))
return;
- MCONTACT hContact = HContactFromUID(dwUin, szUid, NULL);
+ MCONTACT hContact = HContactFromUID(dwUin, szUid, nullptr);
buf += 2; // 3. unknown
wLen -= 2;
@@ -2208,7 +2208,7 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, size_t wLen, DWORD dwSequence) WORD wError;
char *pszErrorMessage;
MCONTACT hContact;
- cookie_message_data *pCookieData = NULL;
+ cookie_message_data *pCookieData = nullptr;
int nMessageType;
@@ -2372,9 +2372,9 @@ void CIcqProto::handleServerAck(BYTE *buf, size_t wLen, DWORD dwSequence) // Sender
if (!unpackUID(&buf, &wLen, &dwUin, &szUID)) return;
- MCONTACT hContact = HContactFromUID(dwUin, szUID, NULL);
+ MCONTACT hContact = HContactFromUID(dwUin, szUID, nullptr);
- if (FindCookie((WORD)dwSequence, NULL, (void**)&pCookieData)) {
+ if (FindCookie((WORD)dwSequence, nullptr, (void**)&pCookieData)) {
// If the user requested a full ack, the
// server ack should be ignored here.
if (pCookieData && (pCookieData->nAckType == ACKTYPE_SERVER)) {
@@ -2475,7 +2475,7 @@ void CIcqProto::handleMissedMsg(BYTE *buf, size_t wLen) { // offline retrieval process in progress, note that we received missed message notification
cookie_offline_messages *cookie;
- if (FindCookieByType(CKT_OFFLINEMESSAGE, NULL, NULL, (void**)&cookie))
+ if (FindCookieByType(CKT_OFFLINEMESSAGE, nullptr, nullptr, (void**)&cookie))
cookie->nMissed++;
}
@@ -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(NULL), 0, sizeof(wError), (PBYTE)&wError);
+ AddEvent(HContactFromUID(dwUin, szUid, &bAdded), ICQEVENTTYPE_MISSEDMESSAGE, time(nullptr), 0, sizeof(wError), (PBYTE)&wError);
}
@@ -2504,7 +2504,7 @@ void CIcqProto::handleOffineMessagesReply(DWORD dwRef) {
cookie_offline_messages *cookie;
- if (FindCookie(dwRef, NULL, (void**)&cookie)) {
+ if (FindCookie(dwRef, nullptr, (void**)&cookie)) {
debugLogA("End of offline msgs, %u received", cookie->nMessages);
if (cookie->nMissed) { // NASTY WORKAROUND!!
// The ICQ server has a bug that causes offline messages to be received again and again when some
@@ -2556,7 +2556,7 @@ void CIcqProto::handleTypingNotification(BYTE *buf, size_t wLen) if (!unpackUID(&buf, &wLen, &dwUin, &szUid))
return;
- MCONTACT hContact = HContactFromUID(dwUin, szUid, NULL);
+ MCONTACT hContact = HContactFromUID(dwUin, szUid, nullptr);
if (hContact == INVALID_CONTACT_ID) return;
diff --git a/protocols/IcqOscarJ/src/fam_0alookup.cpp b/protocols/IcqOscarJ/src/fam_0alookup.cpp index f2bd71eb3c..50a66c2ec1 100644 --- a/protocols/IcqOscarJ/src/fam_0alookup.cpp +++ b/protocols/IcqOscarJ/src/fam_0alookup.cpp @@ -42,7 +42,7 @@ void CIcqProto::handleLookupFam(BYTE *pBuffer, size_t wBufferLength, snac_header wError = 0;
cookie_search *pCookie;
- if (FindCookie(pSnacHeader->dwRef, NULL, (void**)&pCookie)) {
+ if (FindCookie(pSnacHeader->dwRef, nullptr, (void**)&pCookie)) {
if (wError == 0x14)
debugLogA("Lookup: No results");
@@ -84,7 +84,7 @@ void CIcqProto::handleLookupEmailReply(BYTE* buf, size_t wLen, DWORD dwCookie) oscar_tlv_chain *pChain;
cookie_search *pCookie;
- if (!FindCookie(dwCookie, NULL, (void**)&pCookie)) {
+ if (!FindCookie(dwCookie, nullptr, (void**)&pCookie)) {
debugLogA("Error: Received unexpected lookup reply");
return;
}
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index 83e6ca85e4..17137e8783 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -36,7 +36,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea unpackWord(&pBuffer, &wError); cookie_servlist_action *sc; - if (FindCookie(pSnacHeader->dwRef, NULL, (void**)&sc)) { // look for action cookie + if (FindCookie(pSnacHeader->dwRef, nullptr, (void**)&sc)) { // look for action cookie debugLogA("Received expected server list ack, action: %d, result: %d", sc->dwAction, wError); FreeCookie(pSnacHeader->dwRef); // release cookie @@ -85,7 +85,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea BOOL blWork = bIsSyncingCL; bIsSyncingCL = TRUE; // this is not used if cookie takes place - if (FindCookie(pSnacHeader->dwRef, NULL, (void**)&sc)) { // we do it by reliable cookie + if (FindCookie(pSnacHeader->dwRef, nullptr, (void**)&sc)) { // we do it by reliable cookie if (!sc->lParam) { // is this first packet ? ResetSettingsOnListReload(); sc->lParam = 1; @@ -107,7 +107,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea bIsSyncingCL = FALSE; { cookie_servlist_action* sc; - if (FindCookie(pSnacHeader->dwRef, NULL, (void**)&sc)) { // we requested servlist check + if (FindCookie(pSnacHeader->dwRef, nullptr, (void**)&sc)) { // we requested servlist check debugLogA("Server stated roster is ok."); ReleaseCookie(pSnacHeader->dwRef); LoadServerIDs(); @@ -141,7 +141,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea if (unpackServerListItem(&pBuffer, &wBufferLength, szRecordName, &wGroupId, &wItemId, &wItemType, &wTlvLen)) { BYTE *buf = pBuffer; - oscar_tlv_chain *pChain = NULL; + oscar_tlv_chain *pChain = nullptr; nItems++; @@ -208,7 +208,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea unpackWord(&pBuffer, &wError); - if (FindCookie(pSnacHeader->dwRef, NULL, (void**)&sc)) { // look for action cookie + if (FindCookie(pSnacHeader->dwRef, nullptr, (void**)&sc)) { // look for action cookie debugLogA("Received server list error, action: %d, result: %d", sc->dwAction, wError); FreeCookie(pSnacHeader->dwRef); // release cookie @@ -351,9 +351,9 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) setByte(sc->hContact, "Auth", 1); // we need auth DWORD dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_ADDTOLIST, sc->hContact, sc); - icq_sendServerContact(sc->hContact, dwCookie, ICQ_LISTS_ADDTOLIST, sc->wGroupId, sc->wContactId, SSOP_ITEM_ACTION | SSOF_CONTACT, 500, NULL); + icq_sendServerContact(sc->hContact, dwCookie, ICQ_LISTS_ADDTOLIST, sc->wGroupId, sc->wContactId, SSOP_ITEM_ACTION | SSOF_CONTACT, 500, nullptr); - sc = NULL; // we do not want it to be freed now + sc = nullptr; // we do not want it to be freed now break; } FreeServerID(sc->wContactId, SSIT_ITEM); @@ -363,7 +363,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) servlistPendingRemoveContact(sc->hContact, 0, sc->wGroupId, PENDING_RESULT_FAILED); - servlistPostPacket(NULL, 0, SSO_END_OPERATION, 100); // end server modifications here + servlistPostPacket(nullptr, 0, SSO_END_OPERATION, 100); // end server modifications here } else { void* groupData; @@ -380,7 +380,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) } else { // this should never happen debugLogA("Group update failed."); - servlistPostPacket(NULL, 0, SSO_END_OPERATION, 100); // end server modifications here + servlistPostPacket(nullptr, 0, SSO_END_OPERATION, 100); // end server modifications here } } break; @@ -421,7 +421,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) icq_sendServerGroup(dwCookie, ICQ_LISTS_UPDATEGROUP, 0, ack->szGroupName, groupData, groupSize, SSOF_END_OPERATION); } else // end server modifications here - servlistPostPacket(NULL, 0, SSO_END_OPERATION, 100); + servlistPostPacket(nullptr, 0, SSO_END_OPERATION, 100); SAFE_FREE((void**)&groupData); } @@ -461,7 +461,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) servlistPendingRemoveContact(sc->hContact, sc->wContactId, sc->wGroupId, PENDING_RESULT_FAILED); - servlistPostPacket(NULL, 0, SSO_END_OPERATION, 100); // end server modifications here + servlistPostPacket(nullptr, 0, SSO_END_OPERATION, 100); // end server modifications here } break; @@ -481,14 +481,14 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) servlistPendingRemoveGroup(sc->szGroup, 0, PENDING_RESULT_FAILED); - servlistPostPacket(NULL, 0, SSO_END_OPERATION, 100); // end server modifications here + servlistPostPacket(nullptr, 0, SSO_END_OPERATION, 100); // end server modifications here SAFE_FREE((void**)&sc->szGroup); } else { // group removed, we need to update master group void* groupData; int groupSize; - setServListGroupName(sc->wGroupId, NULL); // clear group from namelist + setServListGroupName(sc->wGroupId, nullptr); // clear group from namelist FreeServerID(sc->wGroupId, SSIT_GROUP); removeGroupPathLinks(sc->wGroupId); @@ -498,13 +498,13 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) groupData = collectGroups(&groupSize); sc->wGroupId = 0; sc->dwAction = SSA_GROUP_UPDATE; - sc->szGroupName = NULL; + sc->szGroupName = nullptr; DWORD dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_UPDATEGROUP, 0, sc); icq_sendServerGroup(dwCookie, ICQ_LISTS_UPDATEGROUP, 0, sc->szGroupName, groupData, groupSize, SSOF_END_OPERATION); // end server modifications here - sc = NULL; // we do not want to be freed here + sc = nullptr; // we do not want to be freed here SAFE_FREE((void**)&groupData); } @@ -526,10 +526,10 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) setByte(sc->hContact, "Auth", 0); } DWORD dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_ADDTOLIST, sc->hContact, sc); - icq_sendServerContact(sc->hContact, dwCookie, ICQ_LISTS_ADDTOLIST, sc->wNewGroupId, sc->wNewContactId, SSOP_ITEM_ACTION | SSOF_CONTACT, 400, NULL); + icq_sendServerContact(sc->hContact, dwCookie, ICQ_LISTS_ADDTOLIST, sc->wNewGroupId, sc->wNewContactId, SSOP_ITEM_ACTION | SSOF_CONTACT, 400, nullptr); sc->lParam = 2; // do not cycle - sc = NULL; // we do not want to be freed here + sc = nullptr; // we do not want to be freed here break; } FreeServerID(sc->wNewContactId, SSIT_ITEM); @@ -538,11 +538,11 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) servlistPendingRemoveContact(sc->hContact, 0, (WORD)(sc->lParam ? sc->wGroupId : sc->wNewGroupId), PENDING_RESULT_FAILED); - servlistPostPacket(NULL, 0, SSO_END_OPERATION, 100); // end server modifications here + servlistPostPacket(nullptr, 0, SSO_END_OPERATION, 100); // end server modifications here if (!sc->lParam) { // is this first ack ? sc->lParam = -1; - sc = NULL; // this can't be freed here + sc = nullptr; // this can't be freed here } break; } @@ -582,7 +582,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) delSetting(sc->hContact, DBSETTING_SERVLIST_GROUP); FreeServerID(sc->wContactId, SSIT_ITEM); // release old contact id sc->lParam = 1; - sc = NULL; // wait for second ack + sc = nullptr; // wait for second ack } break; @@ -705,9 +705,9 @@ void CIcqProto::handleServerCListReply(BYTE *buf, size_t wLen, WORD wFlags, serv size_t wTlvLength; BOOL bIsLastPacket; uid_str szRecordName; - oscar_tlv_chain* pChain = NULL; - oscar_tlv* pTLV = NULL; - char *szActiveSrvGroup = NULL; + oscar_tlv_chain* pChain = nullptr; + oscar_tlv* pTLV = nullptr; + char *szActiveSrvGroup = nullptr; WORD wActiveSrvGroupId = -1; // If flag bit 1 is set, this is not the last @@ -761,7 +761,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, size_t wLen, WORD wFlags, serv pChain = readIntoTLVChain(&buf, wTlvLength, 0); wLen -= wTlvLength; } - else pChain = NULL; + else pChain = nullptr; switch (wTlvType) { case SSI_ITEM_BUDDY: @@ -853,7 +853,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, size_t wLen, WORD wFlags, serv if (getByte("LoadServerDetails", DEFAULT_SS_LOAD) || bAdded) { // if just added contact, save details always - does no harm char *szOldNick; - if (szOldNick = getSettingStringUtf(hContact, "CList", "MyHandle", NULL)) { + if (szOldNick = getSettingStringUtf(hContact, "CList", "MyHandle", nullptr)) { if ((mir_strcmp(szOldNick, pszNick)) && (mir_strlen(pszNick) > 0)) { // check if the truncated nick changed, i.e. do not overwrite locally stored longer nick if (mir_strlen(szOldNick) <= mir_strlen(pszNick) || strncmp(szOldNick, pszNick, null_strcut(szOldNick, MAX_SSI_TLV_NAME_SIZE))) { // Yes, we really do need to delete it first. Otherwise the CLUI nick @@ -896,7 +896,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, size_t wLen, WORD wFlags, serv if (getByte("LoadServerDetails", DEFAULT_SS_LOAD) || bAdded) { // if just added contact, save details always - does no harm char *szOldComment; - if (szOldComment = getSettingStringUtf(hContact, "UserInfo", "MyNotes", NULL)) { + if (szOldComment = getSettingStringUtf(hContact, "UserInfo", "MyNotes", nullptr)) { if ((mir_strcmp(szOldComment, pszComment)) && (mir_strlen(pszComment) > 0)) // check if the truncated comment changed, i.e. do not overwrite locally stored longer comment if (mir_strlen(szOldComment) <= mir_strlen(pszComment) || strncmp((char*)szOldComment, (char*)pszComment, null_strcut(szOldComment, MAX_SSI_TLV_COMMENT_SIZE))) db_set_utf(hContact, "UserInfo", "MyNotes", pszComment); @@ -1207,7 +1207,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, size_t wLen, WORD wFlags, serv ack->dwAction = SSA_GROUP_UPDATE; ack->szGroupName = null_strdup(""); dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_ADDTOLIST, 0, ack); - icq_sendServerGroup(dwCookie, ICQ_LISTS_ADDTOLIST, 0, ack->szGroupName, NULL, 0, 0); + icq_sendServerGroup(dwCookie, ICQ_LISTS_ADDTOLIST, 0, ack->szGroupName, nullptr, 0, 0); } } // serv-list sync finished, clear just added contacts @@ -1234,7 +1234,7 @@ void CIcqProto::handleServerCListItemAdd(WORD wItemId, WORD wItemType, oscar_tlv void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wItemType, oscar_tlv_chain *pItemData) { - MCONTACT hContact = (wItemType == SSI_ITEM_BUDDY || wItemType == SSI_ITEM_DENY || wItemType == SSI_ITEM_PERMIT || wItemType == SSI_ITEM_IGNORE) ? HContactFromRecordName(szRecordName, NULL) : NULL; + MCONTACT hContact = (wItemType == SSI_ITEM_BUDDY || wItemType == SSI_ITEM_DENY || wItemType == SSI_ITEM_PERMIT || wItemType == SSI_ITEM_IGNORE) ? HContactFromRecordName(szRecordName, nullptr) : NULL; if (hContact != INVALID_CONTACT_ID && wItemType == SSI_ITEM_BUDDY) { // a contact was updated on server if (pItemData) { @@ -1335,7 +1335,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wItem void CIcqProto::handleServerCListItemDelete(const char *szRecordName, WORD wItemId, WORD wItemType) { - MCONTACT hContact = (wItemType == SSI_ITEM_BUDDY || wItemType == SSI_ITEM_DENY || wItemType == SSI_ITEM_PERMIT || wItemType == SSI_ITEM_IGNORE) ? HContactFromRecordName(szRecordName, NULL) : NULL; + MCONTACT hContact = (wItemType == SSI_ITEM_BUDDY || wItemType == SSI_ITEM_DENY || wItemType == SSI_ITEM_PERMIT || wItemType == SSI_ITEM_IGNORE) ? HContactFromRecordName(szRecordName, nullptr) : NULL; if (hContact != INVALID_CONTACT_ID && wItemType == SSI_ITEM_BUDDY) { // a contact was removed from our list if (getWord(hContact, DBSETTING_SERVLIST_ID, 0) == wItemId) { @@ -1387,18 +1387,18 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, size_t wLen) // Read nick name from DB char *szNick; if (dwUin) - szNick = getSettingStringUtf(hContact, "Nick", NULL); + szNick = getSettingStringUtf(hContact, "Nick", nullptr); else szNick = null_strdup(szUid); - DB_AUTH_BLOB blob(hContact, szNick, 0, 0, 0, szReason); + DB_AUTH_BLOB blob(hContact, szNick, nullptr, nullptr, nullptr, szReason); blob.set_uin(dwUin); setByte(hContact, "Grant", 1); // TODO: Change for new auth system, include all known informations PROTORECVEVENT pre = { 0 }; - pre.timestamp = time(NULL); + pre.timestamp = time(nullptr); pre.lParam = blob.size(); pre.szMessage = blob; ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre); @@ -1427,7 +1427,7 @@ void CIcqProto::handleRecvAdded(unsigned char *buf, size_t wLen) size_t nNickLen, cbBlob = sizeof(DWORD) * 2 + 4; - char *szNick = NULL; + char *szNick = nullptr; if (dwUin) { if (getString(hContact, "Nick", &dbv)) nNickLen = 0; @@ -1458,14 +1458,14 @@ void CIcqProto::handleRecvAdded(unsigned char *buf, size_t wLen) *(char*)pCurBlob = 0; // TODO: Change for new auth system - AddEvent(NULL, EVENTTYPE_ADDED, time(NULL), 0, cbBlob, pBlob); + AddEvent(NULL, EVENTTYPE_ADDED, time(nullptr), 0, cbBlob, pBlob); } void CIcqProto::handleRecvAuthResponse(unsigned char *buf, size_t wLen) { DWORD dwUin; uid_str szUid; - char* szNick = NULL; + char* szNick = nullptr; WORD nReasonLen; char* szReason; int bAdded; @@ -1584,8 +1584,8 @@ void CIcqProto::updateServVisibilityCode(BYTE bCode) // not stored in the local DB, a new ID will be added to the server list. void CIcqProto::updateServAvatarHash(BYTE *pHash, int size) { - void** pDoubleObject = NULL; - void* doubleObject = NULL; + void** pDoubleObject = nullptr; + void* doubleObject = nullptr; DWORD dwOperationFlags = 0; WORD wAvatarID; WORD wCommand; @@ -1622,7 +1622,7 @@ void CIcqProto::updateServAvatarHash(BYTE *pHash, int size) ack->dwAction = SSA_REMOVEAVATAR; // update avatar hash ack->wContactId = wAvatarID; DWORD dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_REMOVEFROMLIST, 0, ack); // take cookie - icq_sendServerItem(dwCookie, ICQ_LISTS_REMOVEFROMLIST, 0, wAvatarID, szItemName, NULL, 0, SSI_ITEM_BUDDYICON, SSOP_ITEM_ACTION | dwOperationFlags, 400, pDoubleObject); + icq_sendServerItem(dwCookie, ICQ_LISTS_REMOVEFROMLIST, 0, wAvatarID, szItemName, nullptr, 0, SSI_ITEM_BUDDYICON, SSOP_ITEM_ACTION | dwOperationFlags, 400, pDoubleObject); } } @@ -1660,7 +1660,7 @@ void CIcqProto::updateServAvatarHash(BYTE *pHash, int size) pBuffer.pData = (BYTE *)_alloca(wTLVlen); pBuffer.wLen = wTLVlen; - packTLV(&pBuffer, SSI_TLV_NAME, 0, NULL); // TLV (Name) + packTLV(&pBuffer, SSI_TLV_NAME, 0, nullptr); // TLV (Name) packTLV(&pBuffer, SSI_TLV_AVATARHASH, hashsize, pHash + 2); // TLV (Hash) icq_sendServerItem(dwCookie, wCommand, 0, wAvatarID, szItemName, pBuffer.pData, wTLVlen, SSI_ITEM_BUDDYICON, SSOP_ITEM_ACTION | dwOperationFlags, 400, pDoubleObject); diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index 9e67247561..93629b691f 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -78,7 +78,7 @@ void CIcqProto::handleExtensionError(BYTE *buf, size_t wPackLen) // more sofisticated detection, send ack
if (wSubType == META_REQUEST_FULL_INFO) {
MCONTACT hContact;
- cookie_fam15_data *pCookieData = NULL;
+ cookie_fam15_data *pCookieData = nullptr;
int foundCookie = FindCookie(wCookie, &hContact, (void**)&pCookieData);
if (foundCookie && pCookieData) {
@@ -116,13 +116,13 @@ void CIcqProto::handleExtensionServerInfo(BYTE *buf, size_t wPackLen, WORD wFlag {
// The entire packet is encapsulated in a TLV type 1
oscar_tlv_chain *chain = readIntoTLVChain(&buf, wPackLen, 0);
- if (chain == NULL) {
+ if (chain == nullptr) {
debugLogA("Error: Broken snac 15/3 %d", 1);
return;
}
oscar_tlv *dataTlv = chain->getTLV(0x0001, 1);
- if (dataTlv == NULL) {
+ if (dataTlv == nullptr) {
disposeChain(&chain);
debugLogA("Error: Broken snac 15/3 %d", 2);
return;
@@ -300,9 +300,9 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO BOOL bLastUser = FALSE;
cookie_search *pCookie;
- if (!FindCookie(wCookie, NULL, (void**)&pCookie)) {
+ if (!FindCookie(wCookie, nullptr, (void**)&pCookie)) {
debugLogA("Warning: Received unexpected search reply");
- pCookie = NULL;
+ pCookie = nullptr;
}
switch (wReplySubtype) {
@@ -354,7 +354,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO databuf += wLen;
}
else {
- sr.hdr.nick.w = NULL;
+ sr.hdr.nick.w = nullptr;
}
// First name
@@ -368,7 +368,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO sr.hdr.firstName.w = (wchar_t*)databuf;
databuf += wLen;
}
- else sr.hdr.firstName.w = NULL;
+ else sr.hdr.firstName.w = nullptr;
// Last name
if (wPacketLen < 2)
@@ -381,7 +381,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO sr.hdr.lastName.w = (wchar_t*)databuf;
databuf += wLen;
}
- else sr.hdr.lastName.w = NULL;
+ else sr.hdr.lastName.w = nullptr;
// E-mail name
if (wPacketLen < 2)
@@ -394,7 +394,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO sr.hdr.email.w = (wchar_t*)databuf;
databuf += wLen;
}
- else sr.hdr.email.w = NULL;
+ else sr.hdr.email.w = nullptr;
// Authentication needed flag
if (wPacketLen < 1)
@@ -704,7 +704,7 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, size_t wPacketLen, W if (IsStringUIN(szUid))
dwUin = atoi(szUid);
- if (hContact != HContactFromUID(dwUin, szUid, NULL)) {
+ if (hContact != HContactFromUID(dwUin, szUid, nullptr)) {
debugLogA("Error: Received data does not match cookie contact, ignoring.");
SAFE_FREE(&szUid);
break;
@@ -763,7 +763,7 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain if (IsStringUIN(szUid))
dwUin = atoi(szUid);
- hContact = HContactFromUID(dwUin, szUid, NULL);
+ hContact = HContactFromUID(dwUin, szUid, nullptr);
if (hContact == INVALID_CONTACT_ID) {
debugLogA("Error: Received details for unknown contact \"%s\"", szUid);
SAFE_FREE(&szUid);
@@ -863,7 +863,7 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain if (!hContact) { // Owner contact needs special processing, in the database is current status note for the client
// We just received the last status note set on directory, if it differs call SetStatusNote() to
// ensure the directory will be updated (it should be in process anyway)
- char *szClientStatusNote = getSettingStringUtf(hContact, DBSETTING_STATUS_NOTE, NULL);
+ char *szClientStatusNote = getSettingStringUtf(hContact, DBSETTING_STATUS_NOTE, nullptr);
char *szDirectoryStatusNote = cDetails->getString(0x226, 1);
if (mir_strcmp(szClientStatusNote, szDirectoryStatusNote))
@@ -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(NULL));
+ setDword(hContact, DBSETTING_METAINFO_SAVED, time(nullptr));
}
if (wReplySubType == META_DIRECTORY_RESPONSE)
@@ -941,25 +941,25 @@ void CIcqProto::parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCook isr.uin = 0;
oscar_tlv *pTLV = cDetails->getTLV(0x50, 1);
- char *szData = NULL;
+ char *szData = nullptr;
if (pTLV && pTLV->wLen > 0)
szData = cDetails->getString(0x50, 1); // Verified e-mail
else
szData = cDetails->getString(0x55, 1); // Pending e-mail
- if (szData != NULL)
+ if (szData != nullptr)
isr.hdr.email.a = szData;
szData = cDetails->getString(0x64, 1); // First Name
- if (szData != NULL)
+ if (szData != nullptr)
isr.hdr.firstName.a = szData;
szData = cDetails->getString(0x6E, 1); // Last Name
- if (szData != NULL)
+ if (szData != nullptr)
isr.hdr.lastName.a = szData;
szData = cDetails->getString(0x78, 1); // Nick
- if (szData != NULL)
+ if (szData != nullptr)
isr.hdr.nick.a = szData;
switch (cDetails->getNumber(0x82, 1)) { // Gender
diff --git a/protocols/IcqOscarJ/src/i18n.cpp b/protocols/IcqOscarJ/src/i18n.cpp index 8f6c7eebca..9efa10fd39 100644 --- a/protocols/IcqOscarJ/src/i18n.cpp +++ b/protocols/IcqOscarJ/src/i18n.cpp @@ -111,7 +111,7 @@ int __stdcall get_utf8_size(const WCHAR *unicode) // returns ansi string in all cases
char* __stdcall detect_decode_utf8(const char *from)
{
- char *temp = NULL;
+ char *temp = nullptr;
if (IsUSASCII(from, mir_strlen(from)) || !UTF8_IsValid(from) || !utf8_decode(from, &temp)) return (char*)from;
SAFE_FREE((void**)&from);
@@ -184,14 +184,14 @@ char* __stdcall make_utf8_string_static(const WCHAR *unicode, char *utf8, size_t char* __stdcall make_utf8_string(const WCHAR *unicode)
{
- if (!unicode) return NULL;
+ if (!unicode) return nullptr;
/* first calculate the size of the target string */
size_t size = get_utf8_size(unicode);
char *out = (char*)SAFE_MALLOC(size + 1);
if (!out)
- return NULL;
+ return nullptr;
return make_utf8_string_static(unicode, out, size + 1);
}
@@ -235,7 +235,7 @@ WCHAR* __stdcall make_unicode_string(const char *utf8) {
int size = 0, index = 0;
- if (!utf8) return NULL;
+ if (!utf8) return nullptr;
/* first calculate the size of the target string */
unsigned char c = utf8[index++];
@@ -255,7 +255,7 @@ WCHAR* __stdcall make_unicode_string(const char *utf8) WCHAR *out = (WCHAR*)SAFE_MALLOC((size + 1) * sizeof(WCHAR));
if (!out)
- return NULL;
+ return nullptr;
else
return make_unicode_string_static(utf8, out, size + 1);
}
@@ -263,7 +263,7 @@ WCHAR* __stdcall make_unicode_string(const char *utf8) int __stdcall utf8_encode(const char *from, char **to)
{
- int wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, (int)mir_strlen(from), NULL, 0);
+ int wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, (int)mir_strlen(from), nullptr, 0);
if (wchars == 0) {
#ifdef _DEBUG
@@ -293,7 +293,7 @@ int __stdcall utf8_encode(const char *from, char **to) char* __stdcall ansi_to_utf8(const char *ansi)
{
- char *szUtf = NULL;
+ char *szUtf = nullptr;
if (mir_strlen(ansi)) {
utf8_encode(ansi, &szUtf);
@@ -337,7 +337,7 @@ int __stdcall utf8_decode_codepage(const char *from, char **to, WORD wCp) if (MultiByteToWideChar(CP_UTF8, 0, from, -1, wszTemp, (int)inlen)) {
// Convert the UCS string to local ANSI codepage
*to = (char*)SAFE_MALLOC(inlen);
- if (WideCharToMultiByte(wCp, 0, wszTemp, -1, *to, (int)inlen, NULL, NULL)) {
+ if (WideCharToMultiByte(wCp, 0, wszTemp, -1, *to, (int)inlen, nullptr, nullptr)) {
nResult = 1;
}
else {
@@ -350,7 +350,7 @@ int __stdcall utf8_decode_codepage(const char *from, char **to, WORD wCp) WCHAR *unicode = (WCHAR*)_alloca(chars * sizeof(WCHAR));
make_unicode_string_static(from, unicode, chars);
- chars = WideCharToMultiByte(wCp, WC_COMPOSITECHECK, unicode, -1, NULL, 0, NULL, NULL);
+ chars = WideCharToMultiByte(wCp, WC_COMPOSITECHECK, unicode, -1, nullptr, 0, nullptr, nullptr);
if (chars == 0) {
#ifdef _DEBUG
@@ -360,14 +360,14 @@ int __stdcall utf8_decode_codepage(const char *from, char **to, WORD wCp) }
*to = (char*)SAFE_MALLOC((chars + 1)*sizeof(char));
- if (*to == NULL) {
+ if (*to == nullptr) {
#ifdef _DEBUG
fprintf(stderr, "Out of memory processing string to local charset\n");
#endif
return 0;
}
- int err = WideCharToMultiByte(wCp, WC_COMPOSITECHECK, unicode, -1, *to, (int)chars, NULL, NULL);
+ int err = WideCharToMultiByte(wCp, WC_COMPOSITECHECK, unicode, -1, *to, (int)chars, nullptr, nullptr);
if (err != (int)chars) {
#ifdef _DEBUG
fprintf(stderr, "Unicode translation error %d\n", GetLastError());
@@ -413,7 +413,7 @@ int __stdcall utf8_decode_static(const char *from, char *to, size_t to_size) // Convert the UTF-8 string to UCS
if (MultiByteToWideChar(CP_UTF8, 0, from, -1, wszTemp, (int)inlen)) {
// Convert the UCS string to local ANSI codepage
- if (WideCharToMultiByte(CP_ACP, 0, wszTemp, -1, to, (int)to_size, NULL, NULL)) {
+ if (WideCharToMultiByte(CP_ACP, 0, wszTemp, -1, to, (int)to_size, nullptr, nullptr)) {
nResult = 1;
}
}
@@ -424,7 +424,7 @@ int __stdcall utf8_decode_static(const char *from, char *to, size_t to_size) make_unicode_string_static(from, unicode, chars);
- WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, -1, to, (int)to_size, NULL, NULL);
+ WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, -1, to, (int)to_size, nullptr, nullptr);
nResult = 1;
}
@@ -435,13 +435,13 @@ int __stdcall utf8_decode_static(const char *from, char *to, size_t to_size) WCHAR* __stdcall ansi_to_unicode(const char *ansi)
{
- int wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, ansi, (int)mir_strlen(ansi), NULL, 0);
+ int wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, ansi, (int)mir_strlen(ansi), nullptr, 0);
if (wchars == 0) {
#ifdef _DEBUG
fprintf(stderr, "Unicode translation error %d\n", GetLastError());
#endif
- return NULL;
+ return nullptr;
}
WCHAR *unicode = (WCHAR*)SAFE_MALLOC((wchars + 1) * sizeof(WCHAR));
@@ -452,7 +452,7 @@ WCHAR* __stdcall ansi_to_unicode(const char *ansi) fprintf(stderr, "Unicode translation error %d\n", GetLastError());
#endif
SAFE_FREE(&unicode);
- return NULL;
+ return nullptr;
}
return unicode;
}
@@ -462,37 +462,37 @@ char* __stdcall unicode_to_ansi_static(const WCHAR *unicode, char *ansi, size_t {
memset(ansi, 0, ansi_size);
- if (WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, (int)mir_wstrlen(unicode), ansi, (int)ansi_size, NULL, NULL) > 1)
+ if (WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, (int)mir_wstrlen(unicode), ansi, (int)ansi_size, nullptr, nullptr) > 1)
return ansi;
- return NULL;
+ return nullptr;
}
char* __stdcall unicode_to_ansi(const WCHAR *unicode)
{
- int chars = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, (int)mir_wstrlen(unicode), NULL, 0, NULL, NULL);
+ int chars = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, (int)mir_wstrlen(unicode), nullptr, 0, nullptr, nullptr);
if (chars == 0) {
#ifdef _DEBUG
fprintf(stderr, "Unicode translation error %d\n", GetLastError());
#endif
- return NULL;
+ return nullptr;
}
char* ansi = (char*)SAFE_MALLOC((chars + 1)*sizeof(char));
- if (ansi == NULL) {
+ if (ansi == nullptr) {
#ifdef _DEBUG
fprintf(stderr, "Out of memory processing string to local charset\n");
#endif
- return NULL;
+ return nullptr;
}
- int err = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, (int)mir_wstrlen(unicode), ansi, chars, NULL, NULL);
+ int err = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, (int)mir_wstrlen(unicode), ansi, chars, nullptr, nullptr);
if (err != chars) {
#ifdef _DEBUG
fprintf(stderr, "Unicode translation error %d\n", GetLastError());
#endif
- return NULL;
+ return nullptr;
}
return ansi;
diff --git a/protocols/IcqOscarJ/src/icq_advsearch.cpp b/protocols/IcqOscarJ/src/icq_advsearch.cpp index f8b13ae7dd..d9539b960a 100644 --- a/protocols/IcqOscarJ/src/icq_advsearch.cpp +++ b/protocols/IcqOscarJ/src/icq_advsearch.cpp @@ -27,7 +27,7 @@ static void InitComboBox(HWND hwndCombo, const FieldNamesItem *names)
{
- SendMessage(hwndCombo, CB_SETCURSEL, ComboBoxAddStringUtf(hwndCombo, NULL, 0), 0);
+ SendMessage(hwndCombo, CB_SETCURSEL, ComboBoxAddStringUtf(hwndCombo, nullptr, 0), 0);
if (names) {
for (int i = 0; names[i].text; i++)
@@ -88,7 +88,7 @@ static void searchPackTLVWordLNTS(PBYTE *buf, size_t *buflen, HWND hwndDlg, UINT static PBYTE createAdvancedSearchStructureTLV(HWND hwndDlg, size_t *length)
{
- PBYTE buf = NULL;
+ PBYTE buf = nullptr;
size_t buflen = 0;
ppackLEWord(&buf, &buflen, META_SEARCH_GENERIC); /* subtype: full search */
@@ -143,7 +143,7 @@ static PBYTE createAdvancedSearchStructureTLV(HWND hwndDlg, size_t *length) PBYTE createAdvancedSearchStructure(HWND hwndDlg, size_t *length)
{
if (!hwndDlg)
- return NULL;
+ return nullptr;
return createAdvancedSearchStructureTLV(hwndDlg, length);
}
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index 58de56c525..f554e06e60 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -58,7 +58,7 @@ wchar_t* CIcqProto::GetOwnAvatarFileName() {
DBVARIANT dbvFile = {DBVT_DELETED};
if (getWString(NULL, "AvatarFile", &dbvFile))
- return NULL;
+ return nullptr;
wchar_t tmp[MAX_PATH * 2];
PathToAbsoluteW(dbvFile.ptszVal, tmp);
@@ -122,12 +122,12 @@ void AddAvatarExt(int dwFormat, wchar_t *pszDest) BYTE* calcMD5HashOfFile(const wchar_t *tszFile)
{
- BYTE *res = NULL;
+ BYTE *res = nullptr;
- HANDLE hFile = NULL, hMap = NULL;
- if ((hFile = CreateFile(tszFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE) {
- if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL) {
- long cbFileSize = GetFileSize(hFile, NULL);
+ HANDLE hFile = nullptr, hMap = nullptr;
+ if ((hFile = CreateFile(tszFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr)) != INVALID_HANDLE_VALUE) {
+ if ((hMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0, 0, nullptr)) != nullptr) {
+ long cbFileSize = GetFileSize(hFile, nullptr);
res = (BYTE*)SAFE_MALLOC(16 * sizeof(BYTE));
if (cbFileSize != 0 && res) {
@@ -137,7 +137,7 @@ BYTE* calcMD5HashOfFile(const wchar_t *tszFile) mir_md5_init(&state);
while (dwOffset < cbFileSize) {
- BYTE *ppMap = NULL;
+ BYTE *ppMap = nullptr;
int dwBlockSize = min(MD5_BLOCK_SIZE, cbFileSize - dwOffset);
if (!(ppMap = (BYTE*)MapViewOfFile(hMap, FILE_MAP_READ, 0, dwOffset, dwBlockSize)))
break;
@@ -151,8 +151,8 @@ BYTE* calcMD5HashOfFile(const wchar_t *tszFile) }
}
- if (hMap != NULL) CloseHandle(hMap);
- if (hFile != NULL) CloseHandle(hFile);
+ if (hMap != nullptr) CloseHandle(hMap);
+ if (hFile != nullptr) CloseHandle(hFile);
}
return res;
@@ -249,8 +249,8 @@ void CIcqProto::handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen) debugLogA("We have no avatar, requesting from server.");
wchar_t szFile[MAX_PATH * 2 + 4];
- GetAvatarFileName(0, NULL, szFile, MAX_PATH * 2);
- GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, szFile);
+ GetAvatarFileName(0, nullptr, szFile, MAX_PATH * 2);
+ GetAvatarData(NULL, m_dwLocalUIN, nullptr, pData, 0x14, szFile);
}
else { // we know avatar filename
BYTE *hash = calcMD5HashOfFile(file);
@@ -259,8 +259,8 @@ void CIcqProto::handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen) debugLogA("We have no avatar, requesting from server.");
wchar_t szFile[MAX_PATH * 2 + 4];
- GetAvatarFileName(0, NULL, szFile, MAX_PATH * 2);
- GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, szFile);
+ GetAvatarFileName(0, nullptr, szFile, MAX_PATH * 2);
+ GetAvatarData(NULL, m_dwLocalUIN, nullptr, pData, 0x14, szFile);
}
// check if we had set any avatar if yes set our, if not download from server
else if (memcmp(hash, pData + 4, 0x10)) { // we have different avatar, sync that
@@ -281,8 +281,8 @@ void CIcqProto::handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen) debugLogA("We have different avatar, requesting new from server.");
wchar_t tszFile[MAX_PATH * 2 + 4];
- GetAvatarFileName(0, NULL, tszFile, MAX_PATH * 2);
- GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, tszFile);
+ GetAvatarFileName(0, nullptr, tszFile, MAX_PATH * 2);
+ GetAvatarData(NULL, m_dwLocalUIN, nullptr, pData, 0x14, tszFile);
}
}
SAFE_FREE((void**)&hash);
@@ -309,23 +309,23 @@ void CIcqProto::handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen) SetMyAvatar(0, 0);
}
else if (!memcmp(hash, pData + 4, 0x10)) { // we have the right file
- HANDLE hFile = NULL, hMap = NULL;
- BYTE *ppMap = NULL;
+ HANDLE hFile = nullptr, hMap = nullptr;
+ BYTE *ppMap = nullptr;
long cbFileSize = 0;
debugLogA("Uploading our avatar data.");
- if ((hFile = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
- if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL)
- if ((ppMap = (BYTE*)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL)
- cbFileSize = GetFileSize(hFile, NULL);
+ if ((hFile = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr)) != INVALID_HANDLE_VALUE)
+ if ((hMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0, 0, nullptr)) != nullptr)
+ if ((ppMap = (BYTE*)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != nullptr)
+ cbFileSize = GetFileSize(hFile, nullptr);
if (cbFileSize != 0)
SetAvatarData(NULL, (WORD)(dwPaFormat == PA_FORMAT_XML ? AVATAR_HASH_FLASH : AVATAR_HASH_STATIC), ppMap, cbFileSize);
- if (ppMap != NULL) UnmapViewOfFile(ppMap);
- if (hMap != NULL) CloseHandle(hMap);
- if (hFile != NULL) CloseHandle(hFile);
+ if (ppMap != nullptr) UnmapViewOfFile(ppMap);
+ if (hMap != nullptr) CloseHandle(hMap);
+ if (hFile != nullptr) CloseHandle(hFile);
SAFE_FREE((void**)&hash);
}
else {
@@ -358,7 +358,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont int bJob = FALSE;
BOOL avatarInfoPresent = FALSE;
int avatarType = -1;
- BYTE *pAvatarHash = NULL;
+ BYTE *pAvatarHash = nullptr;
size_t cbAvatarHash = 0;
BYTE emptyItem[0x10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -423,7 +423,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont debugLogA("%s has removed Avatar.", strUID(dwUIN, szUID));
delSetting(hContact, "AvatarHash");
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
else debugLogA("%s has empty Avatar.", strUID(dwUIN, szUID));
return;
@@ -441,7 +441,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont debugLogA("%s has published Avatar. Image was found in the cache.", strUID(dwUIN, szUID));
setSettingBlob(hContact, "AvatarHash", pAvatarHash, cbAvatarHash);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
else { // the file was lost, request avatar again
debugLogA("%s has published Avatar.", strUID(dwUIN, szUID));
@@ -501,7 +501,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont setSettingBlob(hContact, "AvatarHash", pAvatarHash, cbAvatarHash);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
if (bAutoLoad) { // auto-load is on, so request the avatar now, otherwise we are done
GetAvatarFileName(dwUIN, szUID, tszAvatar, MAX_PATH * 2);
@@ -516,7 +516,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont debugLogA("%s has removed Avatar.", strUID(dwUIN, szUID));
delSetting(hContact, "AvatarHash");
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
else debugLogA("%s has no Avatar.", strUID(dwUIN, szUID));
}
@@ -526,7 +526,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont int CIcqProto::GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid, const BYTE *hash, size_t hashlen, const wchar_t *file)
{
uid_str szUidData;
- char *pszUid = NULL;
+ char *pszUid = nullptr;
if (!dwUin && szUid) { // create a copy in local writable buffer
mir_strcpy(szUidData, szUid);
pszUid = szUidData;
@@ -679,7 +679,7 @@ void __cdecl CIcqProto::AvatarThread(avatars_server_connection *pInfo) // Remove connection reference
mir_cslock l(m_avatarsMutex);
if (m_avatarsConnection == pInfo)
- m_avatarsConnection = NULL;
+ m_avatarsConnection = nullptr;
// Release connection handler
delete pInfo;
@@ -714,7 +714,7 @@ void avatars_server_connection::closeConnection() mir_cslock l(localSeqMutex);
if (hConnection) {
Netlib_CloseHandle(hConnection);
- hConnection = NULL;
+ hConnection = nullptr;
}
}
@@ -881,7 +881,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(0) + KEEPALIVE_INTERVAL;
+ DWORD dwLastKeepAlive = time(nullptr) + KEEPALIVE_INTERVAL;
hPacketRecver = Netlib_CreatePacketReceiver(hConnection, 65536);
@@ -899,14 +899,14 @@ void avatars_server_connection::connectionThread() if (Miranda_IsTerminated())
break;
- if (time(0) >= dwLastKeepAlive) { // limit frequency (HACK: on some systems select() does not work well)
+ if (time(nullptr) >= 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(0) + KEEPALIVE_INTERVAL;
+ dwLastKeepAlive = time(nullptr) + KEEPALIVE_INTERVAL;
}
// check if we got something to request
@@ -935,7 +935,7 @@ void avatars_server_connection::connectionThread() {
// release rates
mir_cslock l(m_ratesMutex);
- delete m_rates; m_rates = NULL;
+ delete m_rates; m_rates = nullptr;
}
SAFE_FREE((void**)&pCookie);
@@ -1143,7 +1143,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen switch (pSnacHeader->wSubtype) {
case ICQ_AVATAR_GET_REPLY: // received avatar data, store to file
// handle new avatar, notify
- if (ppro->FindCookie(pSnacHeader->dwRef, NULL, (void**)&pCookieData)) {
+ if (ppro->FindCookie(pSnacHeader->dwRef, nullptr, (void**)&pCookieData)) {
BYTE bResult;
{
// remove from active request list
@@ -1282,7 +1282,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen BYTE res;
unpackByte(&pBuffer, &res);
if (!res && (wBufferLength == 0x15)) {
- if (ppro->FindCookie(pSnacHeader->dwRef, NULL, (void**)&pCookieData)) // here we store the local hash
+ if (ppro->FindCookie(pSnacHeader->dwRef, nullptr, (void**)&pCookieData)) // here we store the local hash
ppro->ReleaseCookie(pSnacHeader->dwRef);
else
ppro->debugLogA("Warning: Received unexpected Upload Avatar Reply SNAC(x10,x03).");
@@ -1295,7 +1295,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen break;
case ICQ_ERROR:
- if (ppro->FindCookie(pSnacHeader->dwRef, NULL, (void**)&pCookieData)) {
+ if (ppro->FindCookie(pSnacHeader->dwRef, nullptr, (void**)&pCookieData)) {
if (pCookieData->dwUin) {
ppro->debugLogA("Error: Avatar request failed");
SAFE_FREE(&pCookieData->szFile);
diff --git a/protocols/IcqOscarJ/src/icq_clients.cpp b/protocols/IcqOscarJ/src/icq_clients.cpp index 9c1c44dc56..83ba2f4d1d 100644 --- a/protocols/IcqOscarJ/src/icq_clients.cpp +++ b/protocols/IcqOscarJ/src/icq_clients.cpp @@ -55,7 +55,7 @@ static void verToStr(char *szStr, int v) static char* MirandaVersionToStringEx(char* szStr, int bUnicode, const char* szPlug, int v, int m)
{
if (!v) // this is not Miranda
- return NULL;
+ return nullptr;
mir_strcpy(szStr, "Miranda IM ");
@@ -195,7 +195,7 @@ const char* CIcqProto::detectUserClient( BYTE *bClientId, /* Output: detected client-type */
char *szClientBuf)
{
- LPCSTR szClient = NULL;
+ LPCSTR szClient = nullptr;
int bMirandaIM = FALSE;
*bClientId = CLID_ALTERNATIVE; // Most clients does not tick as MsgIDs
@@ -666,7 +666,7 @@ const char* CIcqProto::detectUserClient( // others - like jabber transport uses unmodified library, thus cannot be detected
}
// THE SIGNATURE DETECTION ENDS HERE, after this only feature default will be detected
- else if (szClient == NULL) {
+ else if (szClient == nullptr) {
// ZA mangled the version, OMG!
if (wVersion == 8 && CheckContactCapabilities(hContact, CAPF_XTRAZ) && (MatchCapability(caps, wLen, &capIMSecKey1, 6) || MatchCapability(caps, wLen, &capIMSecKey2, 6)))
wVersion = ICQ_VERSION;
@@ -931,7 +931,7 @@ const char* CIcqProto::detectUserClient( szClient = "MRA client";
}
- if (szClient == NULL)
+ if (szClient == nullptr)
szClient = "AIM";
}
}
@@ -953,7 +953,7 @@ const char* CIcqProto::detectUserClient( }
}
- BOOL bClientDetected = (szClient != NULL);
+ BOOL bClientDetected = (szClient != nullptr);
// client detection failed, provide default clients
if (!szClient) {
@@ -977,7 +977,7 @@ const char* CIcqProto::detectUserClient( }
if (szClient) {
- char *szExtra = NULL;
+ char *szExtra = nullptr;
if (MatchCapability(caps, wLen, &capSimpLite))
szExtra = " + SimpLite";
diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index fd1f71e31a..2c856d56ee 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -82,7 +82,7 @@ int CIcqProto::getContactUid(MCONTACT hContact, DWORD *pdwUin, uid_str *ppszUid) case DBVT_UTF8:
if (ppszUid) {
mir_strcpy(*ppszUid, dbv.pszVal);
- mir_utf8decode(*ppszUid, NULL);
+ mir_utf8decode(*ppszUid, nullptr);
iRes = 0;
}
else debugLogA("AOL screennames not accepted");
@@ -151,7 +151,7 @@ void CIcqProto::setStatusMsgVar(MCONTACT hContact, char* szStatusMsg, bool isAns wchar_t *szStatusNoteW = make_unicode_string(szStatusNote);
int len = (int)mir_wstrlen(szStatusNoteW) * 3 + 1;
char *szStatusNoteAnsi = (char*)alloca(len);
- WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, szStatusNoteW, -1, szStatusNoteAnsi, len, NULL, NULL);
+ WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, szStatusNoteW, -1, szStatusNoteAnsi, len, nullptr, nullptr);
bool notmatch = false;
for (int i = 0;; ++i) {
if (szStatusNoteAnsi[i] != szStatusMsg[i] && szStatusNoteAnsi[i] != '?' && szStatusMsg[i] != '?') {
@@ -167,7 +167,7 @@ void CIcqProto::setStatusMsgVar(MCONTACT hContact, char* szStatusMsg, bool isAns SAFE_FREE(&szStatusNote);
}
- char *oldStatusMsg = NULL;
+ char *oldStatusMsg = nullptr;
DBVARIANT dbv;
if (!db_get_ws(hContact, "CList", "StatusMsg", &dbv)) {
oldStatusMsg = make_utf8_string(dbv.ptszVal);
@@ -203,5 +203,5 @@ MEVENT CIcqProto::AddEvent(MCONTACT hContact, WORD wType, DWORD dwTime, DWORD fl char* CIcqProto::getContactCListGroup(MCONTACT hContact)
{
- return getSettingStringUtf(hContact, "CList", "Group", NULL);
+ return getSettingStringUtf(hContact, "CList", "Group", nullptr);
}
diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp index d634eb520a..40a6ed5e0e 100644 --- a/protocols/IcqOscarJ/src/icq_direct.cpp +++ b/protocols/IcqOscarJ/src/icq_direct.cpp @@ -52,7 +52,7 @@ void CIcqProto::CloseContactDirectConns(MCONTACT hContact) if (!hContact || directConns[i]->hContact == hContact) {
HNETLIBCONN hConnection = directConns[i]->hConnection;
- directConns[i]->hConnection = NULL; // do not allow reuse
+ directConns[i]->hConnection = nullptr; // do not allow reuse
NetLib_CloseConnection(&hConnection, FALSE);
}
}
@@ -61,7 +61,7 @@ void CIcqProto::CloseContactDirectConns(MCONTACT hContact) directconnect* CIcqProto::FindFileTransferDC(filetransfer* ft)
{
- directconnect* dc = NULL;
+ directconnect* dc = nullptr;
mir_cslock l(directConnListMutex);
for (int i = 0; i < directConns.getCount(); i++) {
@@ -77,7 +77,7 @@ directconnect* CIcqProto::FindFileTransferDC(filetransfer* ft) filetransfer* CIcqProto::FindExpectedFileRecv(DWORD dwUin, DWORD dwTotalSize)
{
- filetransfer* pFt = NULL;
+ filetransfer* pFt = nullptr;
mir_cslock l(expectedFileRecvMutex);
for (int i = 0; i < expectedFileRecvs.getCount(); i++) {
@@ -151,7 +151,7 @@ BOOL CIcqProto::IsDirectConnectionOpen(MCONTACT hContact, int type, int bPassive // Set DC status as tried
setByte(hContact, "DCStatus", 1);
// Create a new connection
- OpenDirectConnection(hContact, DIRECTCONN_STANDARD, NULL);
+ OpenDirectConnection(hContact, DIRECTCONN_STANDARD, nullptr);
}
return bIsOpen;
@@ -170,7 +170,7 @@ void icq_newConnectionReceived(HNETLIBCONN hNewConnection, DWORD, void *pExtra) void CIcqProto::OpenDirectConnection(MCONTACT hContact, int type, void* pvExtra)
{
// Create a new connection
- directthreadstartinfo* dtsi = CreateDTSI(hContact, NULL, type);
+ directthreadstartinfo* dtsi = CreateDTSI(hContact, nullptr, type);
dtsi->pvExtra = pvExtra;
ForkThread((MyThreadFunc)&CIcqProto::icq_directThread, dtsi);
}
@@ -200,7 +200,7 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi) size_t nSkipPacketBytes = 0;
DWORD dwReqMsgID1 = 0, dwReqMsgID2 = 0;
- srand(time(NULL));
+ srand(time(nullptr));
{
// add to DC connection list
mir_cslock l(directConnListMutex);
@@ -212,7 +212,7 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi) dc.dwThreadId = GetCurrentThreadId();
dc.incoming = dtsi->incoming;
dc.hConnection = dtsi->hConnection;
- dc.ft = NULL;
+ dc.ft = nullptr;
if (!dc.incoming) {
dc.type = dtsi->type;
@@ -277,10 +277,10 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi) nloc.szHost = inet_ntoa(addr);
nloc.wPort = (WORD)dc.dwRemotePort;
nloc.timeout = 8; // 8 secs to connect
- dc.hConnection = NetLib_OpenConnection(m_hDirectNetlibUser, dc.type == DIRECTCONN_REVERSE ? "Reverse " : NULL, &nloc);
+ dc.hConnection = NetLib_OpenConnection(m_hDirectNetlibUser, dc.type == DIRECTCONN_REVERSE ? "Reverse " : nullptr, &nloc);
if (!dc.hConnection && addr2.S_un.S_addr) { // first address failed, try second one if available
nloc.szHost = inet_ntoa(addr2);
- dc.hConnection = NetLib_OpenConnection(m_hDirectNetlibUser, dc.type == DIRECTCONN_REVERSE ? "Reverse " : NULL, &nloc);
+ dc.hConnection = NetLib_OpenConnection(m_hDirectNetlibUser, dc.type == DIRECTCONN_REVERSE ? "Reverse " : nullptr, &nloc);
}
if (!dc.hConnection) {
if (CheckContactCapabilities(dc.hContact, CAPF_ICQDIRECT)) { // only if the contact support ICQ DC connections
@@ -468,7 +468,7 @@ void CIcqProto::handleDirectPacket(directconnect* dc, PBYTE buf, size_t wLen) dc->incoming = 0;
cookie_reverse_connect *pCookie;
- if (FindCookie(dc->dwReqId, NULL, (void**)&pCookie) && pCookie) { // valid reverse DC, check and init session
+ if (FindCookie(dc->dwReqId, nullptr, (void**)&pCookie) && pCookie) { // valid reverse DC, check and init session
FreeCookie(dc->dwReqId);
if (pCookie->dwUin == dc->dwRemoteUin) { // valid connection
dc->type = pCookie->type;
@@ -551,7 +551,7 @@ void CIcqProto::handleDirectPacket(directconnect* dc, PBYTE buf, size_t wLen) unpackLEDWord(&buf, &dc->dwReqId);
if (dc->dwRemoteUin || !dc->dwReqId) { // OMG! Licq sends on reverse connection empty uin
- hContact = HContactFromUIN(dc->dwRemoteUin, NULL);
+ hContact = HContactFromUIN(dc->dwRemoteUin, nullptr);
if (hContact == INVALID_CONTACT_ID) {
NetLog_Direct("Error: Received PEER_INIT from %u not on my list", dwUin);
CloseDirectConnection(dc);
@@ -579,7 +579,7 @@ void CIcqProto::handleDirectPacket(directconnect* dc, PBYTE buf, size_t wLen) if (!dc->dwRemoteUin) { // we need to load cookie (licq)
cookie_reverse_connect *pCookie;
- if (FindCookie(dc->dwReqId, NULL, (void**)&pCookie) && pCookie) { // valid reverse DC, check and init session
+ if (FindCookie(dc->dwReqId, nullptr, (void**)&pCookie) && pCookie) { // valid reverse DC, check and init session
dc->dwRemoteUin = pCookie->dwUin;
dc->hContact = pCookie->hContact;
}
@@ -824,7 +824,7 @@ int CIcqProto::SendDirectMessage(MCONTACT hContact, icq_packet *pkt) mir_cslock l(directConnListMutex);
for (int i = 0; i < directConns.getCount(); i++) {
- if (directConns[i] == NULL)
+ if (directConns[i] == nullptr)
continue;
if (directConns[i]->hContact == hContact) {
diff --git a/protocols/IcqOscarJ/src/icq_directmsg.cpp b/protocols/IcqOscarJ/src/icq_directmsg.cpp index 65eb850e15..9d4afa4238 100644 --- a/protocols/IcqOscarJ/src/icq_directmsg.cpp +++ b/protocols/IcqOscarJ/src/icq_directmsg.cpp @@ -33,7 +33,7 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen) WORD wStatus;
WORD wFlags;
WORD wTextLen;
- char* pszText = NULL;
+ char* pszText = nullptr;
// The first part of the packet should always be at least 31 bytes
if (wLen < 31) {
@@ -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(NULL), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 0, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, &pMsgAck);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 0, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, &pMsgAck);
break;
}
}
@@ -148,11 +148,11 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen) buf -= wTextLen;
wLen += wTextLen;
- handleMessageTypes(dc->dwRemoteUin, szUID, time(NULL), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 2, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, NULL);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 0, 0, wCookie, dc->wVersion, (int)bMsgType, (int)bMsgFlags, 2, (DWORD)wLen, wTextLen, (char*)buf, MTF_DIRECT, nullptr);
}
else {
MCONTACT hCookieContact;
- cookie_message_data *pCookieData = NULL;
+ cookie_message_data *pCookieData = nullptr;
if (!FindCookie(wCookie, &hCookieContact, (void**)&pCookieData))
NetLog_Direct("Received an unexpected direct ack");
else if (hCookieContact != dc->hContact) {
@@ -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(NULL), 0, 0, wCookie, dc->wVersion, typeId, 0, 0, dwLengthToEnd, dwDataLength, (char*)buf, MTF_PLUGIN | MTF_DIRECT, &pMsgAck);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 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,11 +261,11 @@ void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t szMsg[dwDataLength] = '\0';
uid_str szUID;
- handleMessageTypes(dc->dwRemoteUin, szUID, time(NULL), 0, 0, wCookie, dc->wVersion, (int)(qt + 0xE7), 3, 2, wLen, dwDataLength, szMsg, MTF_PLUGIN | MTF_DIRECT, NULL);
+ handleMessageTypes(dc->dwRemoteUin, szUID, time(nullptr), 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;
- cookie_message_data *pCookieData = NULL;
+ cookie_message_data *pCookieData = nullptr;
if (!FindCookie(wCookie, &hCookieContact, (void**)&pCookieData)) {
NetLog_Direct("Received an unexpected direct ack");
diff --git a/protocols/IcqOscarJ/src/icq_fieldnames.cpp b/protocols/IcqOscarJ/src/icq_fieldnames.cpp index 21b7d887ae..eb6d973992 100644 --- a/protocols/IcqOscarJ/src/icq_fieldnames.cpp +++ b/protocols/IcqOscarJ/src/icq_fieldnames.cpp @@ -27,7 +27,7 @@ FieldNamesItem timezonesField[] =
{
- { -100, NULL }
+ { -100, nullptr }
};
const FieldNamesItem countryField[] = {
@@ -281,7 +281,7 @@ const FieldNamesItem countryField[] = { { 382, LPGEN("Montenegro") }, /* rename need (from Yugoslavia - Montenegro) */
{ 260, LPGEN("Zambia") },
{ 263, LPGEN("Zimbabwe") },
- { 0, NULL }
+ { 0, nullptr }
};
const FieldNamesItem interestsField[] =
@@ -336,7 +336,7 @@ const FieldNamesItem interestsField[] = { 127, LPGEN("Travel") },
{ 121, LPGEN("Web Design") },
{ 132, LPGEN("Women") },
- { -1, NULL }
+ { -1, nullptr }
};
const FieldNamesItem languageField[] =
@@ -413,7 +413,7 @@ const FieldNamesItem languageField[] = { 67, LPGEN("Welsh") },
{ 53, LPGEN("Yiddish") },
{ 54, LPGEN("Yoruba") },
- { 0, NULL }
+ { 0, nullptr }
};
const FieldNamesItem pastField[] =
@@ -426,14 +426,14 @@ const FieldNamesItem pastField[] = { 305, LPGEN("Past Work Place") },
{ 306, LPGEN("Past Organization") },
{ 399, LPGEN("Other") },
- { 0, NULL }
+ { 0, nullptr }
};
const FieldNamesItem genderField[] =
{
{ 'F', LPGEN("Female") },
{ 'M', LPGEN("Male") },
- { 0, NULL }
+ { 0, nullptr }
};
const FieldNamesItem studyLevelField[] =
@@ -446,7 +446,7 @@ const FieldNamesItem studyLevelField[] = { 7, LPGEN("PhD") },
{ 8, LPGEN("Postdoctoral") },
{ 3, LPGEN("University / College") },
- { 0, NULL }
+ { 0, nullptr }
};
const FieldNamesItem industryField[] =
@@ -469,7 +469,7 @@ const FieldNamesItem industryField[] = { 16, LPGEN("Recreation, Travel & Entertainment") },
{ 17, LPGEN("Service Industry") },
{ 18, LPGEN("Transportation") },
- { 0, NULL }
+ { 0, nullptr }
};
const FieldNamesItem occupationField[] =
@@ -502,7 +502,7 @@ const FieldNamesItem occupationField[] = { 26, LPGEN("University Student") },
{ 27, LPGEN("Web Building") },
{ 99, LPGEN("Other Services") },
- { 0, NULL }
+ { 0, nullptr }
};
const FieldNamesItem affiliationField[] =
@@ -527,7 +527,7 @@ const FieldNamesItem affiliationField[] = { 217, LPGEN("Union") },
{ 218, LPGEN("Volunteer Org.") },
{ 299, LPGEN("Other") },
- { 0, NULL }
+ { 0, nullptr }
};
const FieldNamesItem agesField[] =
@@ -539,7 +539,7 @@ const FieldNamesItem agesField[] = { 0x00310028, LPGEN("40-49") },
{ 0x003B0032, LPGEN("50-59") },
{ 0x2710003C, LPGEN("60-above") },
- { -1, NULL }
+ { -1, nullptr }
};
const FieldNamesItem maritalField[] =
@@ -553,7 +553,7 @@ const FieldNamesItem maritalField[] = { 40, LPGEN("Widowed") },
{ 50, LPGEN("Open relationship") },
{ 255, LPGEN("Other") },
- { 0, NULL }
+ { 0, nullptr }
};
char* LookupFieldName(const FieldNamesItem *table, int code)
@@ -563,7 +563,7 @@ char* LookupFieldName(const FieldNamesItem *table, int code) if (table[i].code == code)
return table[i].text;
- return NULL;
+ return nullptr;
}
char* LookupFieldNameUtf(const FieldNamesItem *table, int code, char *str, size_t strsize)
@@ -572,5 +572,5 @@ char* LookupFieldNameUtf(const FieldNamesItem *table, int code, char *str, size_ if (szText)
return ICQTranslateUtfStatic(szText, str, strsize);
- return NULL;
+ return nullptr;
}
diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp index 06548f207e..e907124806 100644 --- a/protocols/IcqOscarJ/src/icq_filerequests.cpp +++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp @@ -27,7 +27,7 @@ void CIcqProto::handleFileAck(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCookie, WORD wStatus)
{
- char* pszFileName = NULL;
+ char* pszFileName = nullptr;
DWORD dwFileSize;
MCONTACT hCookieContact;
WORD wPort;
@@ -41,7 +41,7 @@ void CIcqProto::handleFileAck(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCooki FreeCookie(dwCookie);
- if (hCookieContact != HContactFromUIN(dwUin, NULL)) {
+ if (hCookieContact != HContactFromUIN(dwUin, nullptr)) {
NetLog_Direct("Error: UINs do not match in file transfer request response");
return;
}
@@ -143,7 +143,7 @@ void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD filetransfer *ft = CreateFileTransfer(hContact, dwUin, nVersion);
ft->dwCookie = dwCookie;
ft->szFilename = mir_strdup(pszFileName);
- ft->szDescription = 0;
+ ft->szDescription = nullptr;
ft->fileId = -1;
ft->dwTotalSize = dwFileSize;
ft->pMessage.dwMsgID1 = dwID1;
@@ -157,7 +157,7 @@ void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = mir_utf8decodeW(pszDescription);
pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
@@ -177,7 +177,7 @@ void CIcqProto::handleDirectCancel() void CIcqProto::icq_CancelFileTransfer(filetransfer* ft)
{
DWORD dwCookie;
- if (FindCookieByData(ft, &dwCookie, NULL))
+ if (FindCookieByData(ft, &dwCookie, nullptr))
FreeCookie(dwCookie); /* this bit stops a send that's waiting for acceptance */
if (IsValidFileTransfer(ft)) { // Transfer still out there, end it
diff --git a/protocols/IcqOscarJ/src/icq_filetransfer.cpp b/protocols/IcqOscarJ/src/icq_filetransfer.cpp index 4cfd6e6d47..d5f98899eb 100644 --- a/protocols/IcqOscarJ/src/icq_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/icq_filetransfer.cpp @@ -34,7 +34,7 @@ static void file_buildProtoFileTransferStatus(filetransfer* ft, PROTOFILETRANSFE if (ft->sending)
pfts->pszFiles = ft->pszFiles;
else
- pfts->pszFiles = NULL; /* FIXME */
+ pfts->pszFiles = nullptr; /* FIXME */
pfts->totalFiles = ft->dwFileCount;
pfts->currentFileNumber = ft->iCurrentFile;
pfts->totalBytes = ft->dwTotalSize;
@@ -81,7 +81,7 @@ static void file_sendNextFile(CIcqProto* ppro, directconnect* dc) if (dc->ft->iCurrentFile >= (int)dc->ft->dwFileCount) {
ppro->ProtoBroadcastAck(dc->ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, dc->ft, 0);
ppro->CloseDirectConnection(dc);
- dc->ft->hConnection = NULL;
+ dc->ft->hConnection = nullptr;
return;
}
@@ -89,7 +89,7 @@ static void file_sendNextFile(CIcqProto* ppro, directconnect* dc) if (FileStatUtf(dc->ft->szThisFile, &statbuf)) {
ppro->icq_LogMessage(LOG_ERROR, LPGEN("Your file transfer has been aborted because one of the files that you selected to send is no longer readable from the disk. You may have deleted or moved it."));
ppro->CloseDirectConnection(dc);
- dc->ft->hConnection = NULL;
+ dc->ft->hConnection = nullptr;
return;
}
@@ -103,7 +103,7 @@ static void file_sendNextFile(CIcqProto* ppro, directconnect* dc) if (dc->ft->fileId == -1) {
ppro->icq_LogMessage(LOG_ERROR, LPGEN("Your file transfer has been aborted because one of the files that you selected to send is no longer readable from the disk. You may have deleted or moved it."));
ppro->CloseDirectConnection(dc);
- dc->ft->hConnection = NULL;
+ dc->ft->hConnection = nullptr;
return;
}
}
@@ -112,7 +112,7 @@ static void file_sendNextFile(CIcqProto* ppro, directconnect* dc) dc->ft->dwThisFileDate = statbuf.st_mtime;
dc->ft->dwFileBytesDone = 0;
- char *szThisFileNameAnsi = NULL, *szThisSubDirAnsi = NULL;
+ char *szThisFileNameAnsi = nullptr, *szThisSubDirAnsi = nullptr;
if (!utf8_decode(pszThisFileName, &szThisFileNameAnsi))
szThisFileNameAnsi = _strdup(pszThisFileName); // Legacy fix
if (!utf8_decode(szThisSubDir, &szThisSubDirAnsi))
@@ -203,7 +203,7 @@ void CIcqProto::handleFileTransferIdle(directconnect* dc) void CIcqProto::icq_sendFileResume(filetransfer *ft, int action, const char *szFilename)
{
- if (ft->hConnection == NULL)
+ if (ft->hConnection == nullptr)
return;
directconnect *dc = FindFileTransferDC(ft);
@@ -304,7 +304,7 @@ void CIcqProto::handleFileTransferPacket(directconnect* dc, PBYTE buf, size_t wL unpackLEWord(&buf, &wNickLength);
dc->ft = FindExpectedFileRecv(dc->dwRemoteUin, dwTotalSize);
- if (dc->ft == NULL) {
+ if (dc->ft == nullptr) {
NetLog_Direct("Unexpected file receive");
CloseDirectConnection(dc);
return;
@@ -404,7 +404,7 @@ void CIcqProto::handleFileTransferPacket(directconnect* dc, PBYTE buf, size_t wL if (dc->ft->fileId == -1) {
icq_LogMessage(LOG_ERROR, LPGEN("Your file receive has been aborted because Miranda could not open the destination file in order to write to it. You may be trying to save to a read-only folder."));
CloseDirectConnection(dc);
- dc->ft->hConnection = NULL;
+ dc->ft->hConnection = nullptr;
break;
}
}
diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp index f98bc263dd..389670904a 100644 --- a/protocols/IcqOscarJ/src/icq_http.cpp +++ b/protocols/IcqOscarJ/src/icq_http.cpp @@ -175,13 +175,13 @@ PBYTE icq_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST*, PBYTE buf, int len, int* out unpackByte(&tbuf, &bRes);
wLen -= 1;
if (!bRes)
- Netlib_Logf( NULL, "Gateway Connection #%d Established.", dwPackSeq);
+ Netlib_Logf( nullptr, "Gateway Connection #%d Established.", dwPackSeq);
else
- Netlib_Logf( NULL, "Gateway Connection #%d Failed, error: %d", dwPackSeq, bRes);
+ Netlib_Logf( nullptr, "Gateway Connection #%d Failed, error: %d", dwPackSeq, bRes);
}
else if (wType == HTTP_PACKETTYPE_CLOSEREPLY)
{ // "virtual connection" closed - only received if any other "virual connection" still active
- Netlib_Logf( NULL, "Gateway Connection #%d Closed.", dwPackSeq);
+ Netlib_Logf( nullptr, "Gateway Connection #%d Closed.", dwPackSeq);
}
tbuf += wLen - 12;
}
diff --git a/protocols/IcqOscarJ/src/icq_infoupdate.cpp b/protocols/IcqOscarJ/src/icq_infoupdate.cpp index bcca728f1c..28a90bf2e8 100644 --- a/protocols/IcqOscarJ/src/icq_infoupdate.cpp +++ b/protocols/IcqOscarJ/src/icq_infoupdate.cpp @@ -33,7 +33,7 @@ void CIcqProto::icq_InitInfoUpdate(void)
{
// Create wait objects
- hInfoQueueEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hInfoQueueEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
if (hInfoQueueEvent) {
// Init list
for (int i = 0; i < LISTSIZE; i++) {
@@ -42,7 +42,7 @@ void CIcqProto::icq_InitInfoUpdate(void) m_infoUpdateList[i].queued = 0;
}
- ForkThread(&CIcqProto::InfoUpdateThread, 0);
+ ForkThread(&CIcqProto::InfoUpdateThread, nullptr);
}
bInfoPendingUsers = 0;
@@ -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(NULL);
+ m_infoUpdateList[nFirstFree].queued = time(nullptr);
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(NULL);
+ time_t now = time(nullptr);
BOOL bNotReady = FALSE, bTimeOuted = FALSE;
// Check the list, take only users that were there for at least 5sec
@@ -208,7 +208,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) }
// only send another request, when the previous is completed
- if (FindCookie(dwInfoActiveRequest, NULL, NULL)) {
+ if (FindCookie(dwInfoActiveRequest, nullptr, nullptr)) {
debugLogA("Info-Update: Request 0x%x still in progress.", dwInfoActiveRequest);
SleepEx(1000, TRUE);
@@ -250,7 +250,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) userinfo *hContactList[LISTSIZE];
int nListIndex = 0;
- BYTE *pRequestData = NULL;
+ BYTE *pRequestData = nullptr;
size_t nRequestSize = 0;
mir_cslock l(infoUpdateMutex);
@@ -259,7 +259,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) // check TS again, maybe it has been updated while we slept
if (IsMetaInfoChanged(m_infoUpdateList[i].hContact)) {
if (m_infoUpdateList[i].queued + 5 < now) {
- BYTE *pItem = NULL;
+ BYTE *pItem = nullptr;
size_t nItemSize = 0;
DBVARIANT dbv = { DBVT_DELETED };
@@ -270,7 +270,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) // last updated time
ppackTLVDouble(&pItem, &nItemSize, 0x64, getSettingDouble(m_infoUpdateList[i].hContact, DBSETTING_METAINFO_TIME, 0));
- ppackTLVUID(&pItem, &nItemSize, 0x32, m_infoUpdateList[i].dwUin, NULL);
+ ppackTLVUID(&pItem, &nItemSize, 0x32, m_infoUpdateList[i].dwUin, nullptr);
ppackWord(&pRequestData, &nRequestSize, (WORD)nItemSize);
ppackBuffer(&pRequestData, &nRequestSize, nItemSize, pItem);
// take a reference
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index 65829a11c8..93cc50b027 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -40,14 +40,14 @@ LIST<CIcqProto> g_Instances(1, sttCompareProtocols); static CIcqProto* IcqGetInstanceByHContact(MCONTACT hContact)
{
char* szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
for (int i = 0; i < g_Instances.getCount(); i++)
if (!mir_strcmp(szProto, g_Instances[i]->m_szModuleName))
return g_Instances[i];
- return NULL;
+ return nullptr;
}
static INT_PTR IcqMenuHandleRequestAuth(WPARAM wParam, LPARAM lParam)
@@ -151,7 +151,7 @@ void g_MenuInit(void) SET_UID(mi, 0x4767918b, 0x898b, 0x4cb6, 0x9c, 0x54, 0x8c, 0x56, 0x6a, 0xc4, 0xed, 0x42);
mi.name.a = LPGEN("Show custom status details");
mi.position = -2000004999;
- mi.hIcolibItem = 0;
+ mi.hIcolibItem = nullptr;
g_hContactMenuItems[ICMI_XSTATUS_DETAILS] = Menu_AddContactMenuItem(&mi);
// "Open ICQ profile"
@@ -205,9 +205,9 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0);
if (bXStatus && !m_bHideXStatusUI) {
if (bXStatus > 0 && bXStatus <= XSTATUS_COUNT)
- Menu_ModifyItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], NULL, getXStatusIcon(bXStatus, LR_SHARED));
+ Menu_ModifyItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], nullptr, getXStatusIcon(bXStatus, LR_SHARED));
else
- Menu_ModifyItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], NULL, Skin_LoadIcon(SKINICON_OTHER_SMALLDOT));
+ Menu_ModifyItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], nullptr, Skin_LoadIcon(SKINICON_OTHER_SMALLDOT));
}
return 0;
diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index a05b3c236d..1629b3f7ce 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -145,7 +145,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case PSN_APPLY:
char str[128];
- ppro->setDword(UNIQUEIDSETTING, GetDlgItemInt(hwndDlg, IDC_ICQNUM, NULL, FALSE));
+ ppro->setDword(UNIQUEIDSETTING, GetDlgItemInt(hwndDlg, IDC_ICQNUM, nullptr, FALSE));
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(ppro->m_szPassword));
if (mir_strlen(str)) {
mir_strcpy(ppro->m_szPassword, str);
@@ -157,7 +157,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemTextA(hwndDlg, IDC_ICQSERVER, str, _countof(str));
ppro->setString("OscarServer", str);
- ppro->setWord("OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, NULL, FALSE));
+ ppro->setWord("OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, nullptr, FALSE));
StoreDBCheckState(ppro, hwndDlg, IDC_KEEPALIVE, "KeepAlive");
StoreDBCheckState(ppro, hwndDlg, IDC_SSL, "SecureConnection");
@@ -258,7 +258,7 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa StoreDBCheckState(ppro, hwndDlg, IDC_ADD_AUTH, "Auth");
if (ppro->icqOnline()) {
- PBYTE buf = NULL;
+ PBYTE buf = nullptr;
size_t buflen = 0;
ppackTLVWord(&buf, &buflen, 0x19A, !ppro->getByte("Auth", 1));
@@ -275,10 +275,10 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa if (ppro->m_iStatus == ID_STATUS_INVISIBLE) {
if (ppro->m_bSsiEnabled)
ppro->updateServVisibilityCode(3);
- ppro->icq_setstatus(wStatus, NULL);
+ ppro->icq_setstatus(wStatus, nullptr);
}
else {
- ppro->icq_setstatus(wStatus, NULL);
+ ppro->icq_setstatus(wStatus, nullptr);
if (ppro->m_bSsiEnabled)
ppro->updateServVisibilityCode(4);
}
@@ -316,13 +316,13 @@ struct CPTABLE cpTable[] = { { 1257, LPGEN("Baltic") },
{ 1258, LPGEN("Vietnamese") },
{ 1361, LPGEN("Korean (Johab)") },
- { -1, NULL }
+ { -1, nullptr }
};
static BOOL CALLBACK FillCpCombo(LPSTR str)
{
UINT i, cp = atoi(str);
- for (i = 0; cpTable[i].cpName != NULL && cpTable[i].cpId != cp; i++);
+ for (i = 0; cpTable[i].cpName != nullptr && cpTable[i].cpId != cp; i++);
if (cpTable[i].cpName)
ComboBoxAddStringUtf(hCpCombo, cpTable[i].cpName, cpTable[i].cpId);
@@ -537,7 +537,7 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUPS);
odp.pfnDlgProc = DlgProcIcqPopupOpts;
odp.szGroup.w = LPGENW("Popups");
- odp.szTab.w = NULL;
+ odp.szTab.w = nullptr;
Options_AddPage(wParam, &odp);
}
return 0;
diff --git a/protocols/IcqOscarJ/src/icq_packet.cpp b/protocols/IcqOscarJ/src/icq_packet.cpp index 7b8c25946f..cc954bf2fe 100644 --- a/protocols/IcqOscarJ/src/icq_packet.cpp +++ b/protocols/IcqOscarJ/src/icq_packet.cpp @@ -539,7 +539,7 @@ void CIcqProto::ppackTLVStringFromDB(PBYTE *buf, size_t *buflen, const char *szS void CIcqProto::ppackTLVStringUtfFromDB(PBYTE *buf, size_t *buflen, const char *szSetting, WORD wType)
{
- char *str = getSettingStringUtf(NULL, szSetting, NULL);
+ char *str = getSettingStringUtf(NULL, szSetting, nullptr);
ppackTLV(buf, buflen, wType, mir_strlen(str), (PBYTE)str);
@@ -567,7 +567,7 @@ void CIcqProto::ppackTLVDateFromDB(PBYTE *buf, size_t *buflen, const char *szSet int CIcqProto::ppackTLVWordStringItemFromDB(PBYTE *buf, size_t *buflen, const char *szSetting, WORD wTypeID, WORD wTypeData, WORD wID)
{
char szTmp[1024];
- char *str = NULL;
+ char *str = nullptr;
if (!getSettingStringStatic(NULL, szSetting, szTmp, sizeof(szTmp)))
str = szTmp;
@@ -588,7 +588,7 @@ int CIcqProto::ppackTLVWordStringItemFromDB(PBYTE *buf, size_t *buflen, const ch int CIcqProto::ppackTLVWordStringUtfItemFromDB(PBYTE *buf, size_t *buflen, const char *szSetting, WORD wTypeID, WORD wTypeData, WORD wID)
{
- char *str = getSettingStringUtf(NULL, szSetting, NULL);
+ char *str = getSettingStringUtf(NULL, szSetting, nullptr);
if (str) {
size_t wLen = mir_strlen(str);
@@ -836,7 +836,7 @@ NextTLV: *(*ttlv + wLen) = '\0';
}
else
- *ttlv = NULL;
+ *ttlv = nullptr;
}
// Save type and length
diff --git a/protocols/IcqOscarJ/src/icq_popups.cpp b/protocols/IcqOscarJ/src/icq_popups.cpp index b2d21dff38..1cc7bd6a30 100644 --- a/protocols/IcqOscarJ/src/icq_popups.cpp +++ b/protocols/IcqOscarJ/src/icq_popups.cpp @@ -177,19 +177,19 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ppro->setByte("PopupsSpamEnabled",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_POPUPS_SPAM_ENABLED));
ppro->setDword("Popups0TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG0_TEXTCOLOR,CPM_GETCOLOUR,0,0));
ppro->setDword("Popups0BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG0_BACKCOLOR,CPM_GETCOLOUR,0,0));
- ppro->setDword("Popups0Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG0_TIMEOUT, NULL, FALSE));
+ ppro->setDword("Popups0Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG0_TIMEOUT, nullptr, FALSE));
ppro->setDword("Popups1TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG1_TEXTCOLOR,CPM_GETCOLOUR,0,0));
ppro->setDword("Popups1BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG1_BACKCOLOR,CPM_GETCOLOUR,0,0));
- ppro->setDword("Popups1Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG1_TIMEOUT, NULL, FALSE));
+ ppro->setDword("Popups1Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG1_TIMEOUT, nullptr, FALSE));
ppro->setDword("Popups2TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG2_TEXTCOLOR,CPM_GETCOLOUR,0,0));
ppro->setDword("Popups2BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG2_BACKCOLOR,CPM_GETCOLOUR,0,0));
- ppro->setDword("Popups2Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG2_TIMEOUT, NULL, FALSE));
+ ppro->setDword("Popups2Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG2_TIMEOUT, nullptr, FALSE));
ppro->setDword("Popups3TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG3_TEXTCOLOR,CPM_GETCOLOUR,0,0));
ppro->setDword("Popups3BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG3_BACKCOLOR,CPM_GETCOLOUR,0,0));
- ppro->setDword("Popups3Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG3_TIMEOUT, NULL, FALSE));
+ ppro->setDword("Popups3Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG3_TIMEOUT, nullptr, FALSE));
ppro->setDword("PopupsSpamTextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_SPAM_TEXTCOLOR,CPM_GETCOLOUR,0,0));
ppro->setDword("PopupsSpamBackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_SPAM_BACKCOLOR,CPM_GETCOLOUR,0,0));
- ppro->setDword("PopupsSpamTimeout",GetDlgItemInt(hwndDlg, IDC_POPUP_SPAM_TIMEOUT, NULL, FALSE));
+ ppro->setDword("PopupsSpamTimeout",GetDlgItemInt(hwndDlg, IDC_POPUP_SPAM_TIMEOUT, nullptr, FALSE));
ppro->setByte("PopupsWinColors",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS));
ppro->setByte("PopupsDefColors",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS));
ppro->setByte("PopupsSysIcons",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USESYSICONS));
@@ -250,7 +250,7 @@ int CIcqProto::ShowPopupMsg(MCONTACT hContact, const char *szTitle, const char * if (!getByte("PopupsSysIcons", DEFAULT_POPUPS_SYS_ICONS))
ppd.lchIcon = IcoLib_GetIconByHandle(m_hProtoIcon);
else
- ppd.lchIcon = (HICON)LoadImage( NULL, rsIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
+ ppd.lchIcon = (HICON)LoadImage( nullptr, rsIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
if (getByte("PopupsWinColors", DEFAULT_POPUPS_WIN_COLORS)) {
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
@@ -281,8 +281,8 @@ int CIcqProto::ShowPopupMsg(MCONTACT hContact, const char *szTitle, const char * ppd.lchIcon = ppd.lchIcon;
ppd.colorBack = ppd.colorBack;
ppd.colorText = ppd.colorText;
- ppd.PluginWindowProc = NULL;
- ppd.PluginData = NULL;
+ ppd.PluginWindowProc = nullptr;
+ ppd.PluginData = nullptr;
ppd.iSeconds = ppd.iSeconds;
return PUAddPopupT(&ppd);
}
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index d0bd98fab2..0a26743995 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -240,7 +240,7 @@ int CIcqProto::OnModulesLoaded(WPARAM, LPARAM) char pszP2PName[MAX_PATH];
char pszGroupsName[MAX_PATH];
char pszSrvGroupsName[MAX_PATH];
- char* modules[5] = { 0, 0, 0, 0, 0 };
+ char* modules[5] = { nullptr, nullptr, nullptr, nullptr, nullptr };
mir_snprintf(pszP2PName, "%sP2P", m_szModuleName);
mir_snprintf(pszGroupsName, "%sGroups", m_szModuleName);
@@ -283,7 +283,7 @@ int CIcqProto::OnPreShutdown(WPARAM, LPARAM) MCONTACT CIcqProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
{
- if (psr == NULL) return 0;
+ if (psr == nullptr) return 0;
char szUid[MAX_PATH];
if (psr->cbSize == sizeof(ICQSEARCHRESULT)) {
@@ -469,13 +469,13 @@ HANDLE __cdecl CIcqProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const w DWORD dwUin;
uid_str szUid;
if (getContactUid(hContact, &dwUin, &szUid))
- return 0; // Invalid contact
+ return nullptr; // Invalid contact
if (icqOnline() && hContact && szPath && hTransfer) { // approve old fashioned file transfer
basic_filetransfer *bft = (basic_filetransfer *)hTransfer;
if (!IsValidFileTransfer(bft))
- return 0; // Invalid transfer
+ return nullptr; // Invalid transfer
if (dwUin && bft->ft_magic == FT_MAGIC_ICQ) {
filetransfer *ft = (filetransfer *)hTransfer;
@@ -498,7 +498,7 @@ HANDLE __cdecl CIcqProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const w }
}
- return 0; // Failure
+ return nullptr; // Failure
}
@@ -719,7 +719,7 @@ void CIcqProto::CheekySearchThread(void*) HANDLE __cdecl CIcqProto::SearchBasic(const wchar_t *pszSearch)
{
if (mir_wstrlen(pszSearch) == 0)
- return 0;
+ return nullptr;
char pszUIN[255];
int nHandle = 0;
@@ -746,7 +746,7 @@ HANDLE __cdecl CIcqProto::SearchBasic(const wchar_t *pszSearch) cheekySearchId = GenerateCookie(0);
cheekySearchUin = dwUin;
cheekySearchUid = null_strdup(pszUIN);
- ForkThread(&CIcqProto::CheekySearchThread, 0); // The caller needs to get this return value before the results
+ ForkThread(&CIcqProto::CheekySearchThread, nullptr); // The caller needs to get this return value before the results
nHandle = cheekySearchId;
}
else if (icqOnline()) {
@@ -758,7 +758,7 @@ HANDLE __cdecl CIcqProto::SearchBasic(const wchar_t *pszSearch) }
// Failure
- return 0;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -781,7 +781,7 @@ HANDLE __cdecl CIcqProto::SearchByEmail(const wchar_t *email) return (HANDLE)dwSecId;
}
- return 0; // Failure
+ return nullptr; // Failure
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -806,7 +806,7 @@ HANDLE __cdecl CIcqProto::SearchByName(const wchar_t *nick, const wchar_t *first }
}
- return 0; // Failure
+ return nullptr; // Failure
}
@@ -815,7 +815,7 @@ HWND __cdecl CIcqProto::CreateExtendedSearchUI(HWND parent) if (parent && hInst)
return CreateDialog(hInst, MAKEINTRESOURCE(IDD_ICQADVANCEDSEARCH), parent, AdvancedSearchDlgProc);
- return NULL; // Failure
+ return nullptr; // Failure
}
HWND __cdecl CIcqProto::SearchAdvanced(HWND hwndDlg)
@@ -831,7 +831,7 @@ HWND __cdecl CIcqProto::SearchAdvanced(HWND hwndDlg) }
}
- return NULL; // Failure
+ return nullptr; // Failure
}
@@ -909,7 +909,7 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT dwCookie = ReportGenericSendError(hContact, ACKTYPE_CONTACTS, "Bad data (internal error #1)");
else { // OK
if (CheckContactCapabilities(hContact, CAPF_CONTACTS) && wRecipientStatus != ID_STATUS_OFFLINE) { // Use the new format if possible
- struct icq_contactsend_s* contacts = NULL;
+ struct icq_contactsend_s* contacts = nullptr;
// Format the data part and the names part
// This is kinda messy, but there is no simple way to do it. First
@@ -926,7 +926,7 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT break; // Abort if a non icq contact is found
if (getContactUid(hContactsList[i], &contacts[i].uin, &szContactUid))
break; // Abort if invalid contact
- contacts[i].uid = contacts[i].uin ? NULL : null_strdup(szContactUid);
+ contacts[i].uid = contacts[i].uin ? nullptr : null_strdup(szContactUid);
contacts[i].szNick = NickFromHandleUtf(hContactsList[i]);
nDataLen += getUIDLen(contacts[i].uin, contacts[i].uid) + 4;
nNamesLen += mir_strlen(contacts[i].szNick) + 8;
@@ -1002,7 +1002,7 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT // This will stop the message dialog from waiting for the real message delivery ack
if (pCookieData->nAckType == ACKTYPE_NONE) {
- SendProtoAck(hContact, dwCookie, ACKRESULT_SUCCESS, ACKTYPE_CONTACTS, NULL);
+ SendProtoAck(hContact, dwCookie, ACKRESULT_SUCCESS, ACKTYPE_CONTACTS, nullptr);
// We need to free this here since we will never see the real ack
// The actual cookie value will still have to be returned to the message dialog though
ReleaseCookie(dwCookie);
@@ -1023,7 +1023,7 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT else if (dwUin) { // old format is only understood by ICQ clients
char szContactUin[UINMAXLEN];
char szCount[17];
- struct icq_contactsend_s* contacts = NULL;
+ struct icq_contactsend_s* contacts = nullptr;
uid_str szContactUid;
int i;
@@ -1039,7 +1039,7 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT break; // Abort if a non icq contact is found
if (getContactUid(hContactsList[i], &contacts[i].uin, &szContactUid))
break; // Abort if invalid contact
- contacts[i].uid = contacts[i].uin ? NULL : null_strdup(szContactUid);
+ contacts[i].uid = contacts[i].uin ? nullptr : null_strdup(szContactUid);
contacts[i].szNick = NickFromHandle(hContactsList[i]);
// Compute this contact's length
nBodyLength += getUIDLen(contacts[i].uin, contacts[i].uid) + 1;
@@ -1081,7 +1081,7 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT cookie_message_data *pCookieData = CreateMessageCookieData(MTYPE_CONTACTS, hContact, dwUin, TRUE);
if (m_bDCMsgEnabled && IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 0)) {
- int iRes = icq_SendDirectMessage(hContact, pBody, nBodyLength, pCookieData, NULL);
+ int iRes = icq_SendDirectMessage(hContact, pBody, nBodyLength, pCookieData, nullptr);
if (iRes) {
SAFE_FREE((void**)&pBody);
return iRes; // we succeded, return
@@ -1103,11 +1103,11 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT else
wPriority = 0x0021;
- dwCookie = icq_SendChannel2Message(dwUin, hContact, pBody, nBodyLength, wPriority, pCookieData, NULL);
+ dwCookie = icq_SendChannel2Message(dwUin, hContact, pBody, nBodyLength, wPriority, pCookieData, nullptr);
// This will stop the message dialog from waiting for the real message delivery ack
if (pCookieData->nAckType == ACKTYPE_NONE) {
- SendProtoAck(hContact, dwCookie, ACKRESULT_SUCCESS, ACKTYPE_CONTACTS, NULL);
+ SendProtoAck(hContact, dwCookie, ACKRESULT_SUCCESS, ACKTYPE_CONTACTS, nullptr);
// We need to free this here since we will never see the real ack
// The actual cookie value will still have to be returned to the message dialog though
ReleaseCookie(dwCookie);
@@ -1133,13 +1133,13 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles)
{
if (!icqOnline())
- return 0;
+ return nullptr;
if (hContact && szDescription && ppszFiles) {
DWORD dwUin;
uid_str szUid;
if (getContactUid(hContact, &dwUin, &szUid))
- return 0; // Invalid contact
+ return nullptr; // Invalid contact
if (getContactStatus(hContact) != ID_STATUS_OFFLINE) {
if (CheckContactCapabilities(hContact, CAPF_OSCAR_FILE))
@@ -1162,7 +1162,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti ft->pszFiles = (char **)SAFE_MALLOC(sizeof(char *)* ft->dwFileCount);
ft->dwTotalSize = 0;
for (i = 0; i < (int)ft->dwFileCount; i++) {
- ft->pszFiles[i] = (ppszFiles[i]) ? make_utf8_string(ppszFiles[i]) : NULL;
+ ft->pszFiles[i] = (ppszFiles[i]) ? make_utf8_string(ppszFiles[i]) : nullptr;
if (_wstat(ppszFiles[i], &statbuf))
debugLogA("IcqSendFile() was passed invalid filename(s)");
@@ -1175,7 +1175,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti ft->fileId = -1;
ft->iCurrentFile = 0;
ft->dwCookie = AllocateCookie(CKT_FILE, 0, hContact, ft);
- ft->hConnection = NULL;
+ ft->hConnection = nullptr;
// Send file transfer request
debugLogA("Init file send");
@@ -1219,7 +1219,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti }
}
- return 0; // Failure
+ return nullptr; // Failure
}
@@ -1228,7 +1228,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti int __cdecl CIcqProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
{
- if (hContact == NULL || pszSrc == NULL)
+ if (hContact == NULL || pszSrc == nullptr)
return NULL;
DWORD dwCookie;
@@ -1262,7 +1262,7 @@ int __cdecl CIcqProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) if (dwUin && m_bDCMsgEnabled && IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 0)) { // send thru direct
char *dc_msg = puszText;
char *dc_cap = plain_ascii ? NULL : CAP_UTF8MSGS;
- char *szUserAnsi = NULL;
+ char *szUserAnsi = nullptr;
if (!plain_ascii && oldAnsi) {
szUserAnsi = ConvertMsgToUserSpecificAnsi(hContact, puszText);
@@ -1296,7 +1296,7 @@ int __cdecl CIcqProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) bNeedFreeU = 1;
}
- WCHAR *pwszText = plain_ascii ? NULL : make_unicode_string(puszText);
+ WCHAR *pwszText = plain_ascii ? nullptr : make_unicode_string(puszText);
if ((plain_ascii ? mir_strlen(puszText) : mir_wstrlen(pwszText) * sizeof(WCHAR)) > MAX_MESSAGESNACSIZE) { // max length check // TLV(2) is currently limited to 0xA00 bytes in online mode
// only limit to not get disconnected, all other will be handled by error 0x0A
dwCookie = ReportGenericSendError(hContact, ACKTYPE_MESSAGE, "The message could not be delivered, it is too long.");
@@ -1329,7 +1329,7 @@ int __cdecl CIcqProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) // This will stop the message dialog from waiting for the real message delivery ack
if (pCookieData && pCookieData->nAckType == ACKTYPE_NONE) {
- SendProtoAck(hContact, dwCookie, ACKRESULT_SUCCESS, ACKTYPE_MESSAGE, NULL);
+ SendProtoAck(hContact, dwCookie, ACKRESULT_SUCCESS, ACKTYPE_MESSAGE, nullptr);
// We need to free this here since we will never see the real ack
// The actual cookie value will still have to be returned to the message dialog though
ReleaseCookie(dwCookie);
@@ -1347,11 +1347,11 @@ int __cdecl CIcqProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) int __cdecl CIcqProto::SendUrl(MCONTACT hContact, int, const char* url)
{
- if (hContact == NULL || url == NULL)
+ if (hContact == NULL || url == nullptr)
return 0;
DWORD dwUin;
- if (getContactUid(hContact, &dwUin, NULL)) // Invalid contact
+ if (getContactUid(hContact, &dwUin, nullptr)) // Invalid contact
return ReportGenericSendError(hContact, ACKTYPE_URL, "The receiver has an invalid user ID.");
WORD wRecipientStatus = getContactStatus(hContact);
@@ -1376,7 +1376,7 @@ int __cdecl CIcqProto::SendUrl(MCONTACT hContact, int, const char* url) mir_strcpy(szBody + nDescLen + 1, url);
if (m_bDCMsgEnabled && IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 0)) {
- int iRes = icq_SendDirectMessage(hContact, szBody, nBodyLen, pCookieData, NULL);
+ int iRes = icq_SendDirectMessage(hContact, szBody, nBodyLen, pCookieData, nullptr);
if (iRes)
return iRes; // we succeded, return
}
@@ -1394,11 +1394,11 @@ int __cdecl CIcqProto::SendUrl(MCONTACT hContact, int, const char* url) else
wPriority = 0x0021;
- DWORD dwCookie = icq_SendChannel2Message(dwUin, hContact, szBody, nBodyLen, wPriority, pCookieData, NULL);
+ DWORD dwCookie = icq_SendChannel2Message(dwUin, hContact, szBody, nBodyLen, wPriority, pCookieData, nullptr);
// This will stop the message dialog from waiting for the real message delivery ack
if (pCookieData->nAckType == ACKTYPE_NONE) {
- SendProtoAck(hContact, dwCookie, ACKRESULT_SUCCESS, ACKTYPE_URL, NULL);
+ SendProtoAck(hContact, dwCookie, ACKRESULT_SUCCESS, ACKTYPE_URL, nullptr);
// We need to free this here since we will never see the real ack
// The actual cookie value will still have to be returned to the message dialog though
ReleaseCookie(dwCookie);
@@ -1459,15 +1459,15 @@ int __cdecl CIcqProto::SetApparentMode(MCONTACT hContact, int mode) char* CIcqProto::PrepareStatusNote(int nStatus)
{
- char *szStatusNote = NULL;
+ char *szStatusNote = nullptr;
BYTE bXStatus = getContactXStatus(NULL);
// use custom status message as status note
if (bXStatus)
- szStatusNote = getSettingStringUtf(NULL, DBSETTING_XSTATUS_MSG, NULL);
+ szStatusNote = getSettingStringUtf(NULL, DBSETTING_XSTATUS_MSG, nullptr);
// get standard status message (no custom status defined)
- if (szStatusNote == NULL) {
+ if (szStatusNote == nullptr) {
mir_cslock l(m_modeMsgsMutex);
char **pszStatusNote = MirandaStatusToAwayMsg(nStatus);
@@ -1475,7 +1475,7 @@ char* CIcqProto::PrepareStatusNote(int nStatus) szStatusNote = null_strdup(*pszStatusNote);
}
- if (szStatusNote == NULL) // nothing available. set empty status note
+ if (szStatusNote == nullptr) // nothing available. set empty status note
szStatusNote = null_strdup("");
return szStatusNote;
@@ -1533,7 +1533,7 @@ int __cdecl CIcqProto::SetStatus(int iNewStatus) m_dwLocalUIN = getContactUin(NULL);
if (m_dwLocalUIN == 0) {
SetCurrentStatus(ID_STATUS_OFFLINE);
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_BADUSERID);
icq_LogMessage(LOG_FATAL, LPGEN("You have not entered an ICQ number.\nConfigure this in Options -> Network -> ICQ and try again."));
return 0;
}
@@ -1585,7 +1585,7 @@ int __cdecl CIcqProto::SetStatus(int iNewStatus) if (pszStatusNote)
icq_sendSetAimAwayMsgServ(*pszStatusNote);
else // clear the away message
- icq_sendSetAimAwayMsgServ(NULL);
+ icq_sendSetAimAwayMsgServ(nullptr);
}
}
@@ -1630,10 +1630,10 @@ HANDLE __cdecl CIcqProto::GetAwayMsg(MCONTACT hContact) DWORD dwUin;
uid_str szUID;
if (getContactUid(hContact, &dwUin, &szUID))
- return 0; // Invalid contact
+ return nullptr; // Invalid contact
if (!dwUin || !CheckContactCapabilities(hContact, CAPF_STATUS_MESSAGES)) { // No individual status messages, check if the contact has Status Note, if yes give it
- char *szStatusNote = getSettingStringUtf(hContact, DBSETTING_STATUS_NOTE, NULL);
+ char *szStatusNote = getSettingStringUtf(hContact, DBSETTING_STATUS_NOTE, nullptr);
if (mir_strlen(szStatusNote) > 0) { // Give Status Note
status_message_thread_data *pThreadData = (status_message_thread_data*)SAFE_MALLOC(sizeof(status_message_thread_data));
@@ -1649,7 +1649,7 @@ HANDLE __cdecl CIcqProto::GetAwayMsg(MCONTACT hContact) }
if (!icqOnline())
- return 0;
+ return nullptr;
WORD wStatus = getContactStatus(hContact);
@@ -1701,7 +1701,7 @@ HANDLE __cdecl CIcqProto::GetAwayMsg(MCONTACT hContact) return (HANDLE)icq_sendGetAimAwayMsgServ(hContact, szUID, MTYPE_AUTOAWAY);
}
- return 0; // Failure
+ return nullptr; // Failure
}
@@ -1739,7 +1739,7 @@ int __cdecl CIcqProto::SetAwayMsg(int status, const wchar_t* msg) // Set new message
*ppszMsg = szNewUtf;
- szNewUtf = NULL;
+ szNewUtf = nullptr;
if ((m_iStatus == status) && icqOnline()) { // update current status note
char *szNote = *ppszMsg ? *ppszMsg : "";
diff --git a/protocols/IcqOscarJ/src/icq_rates.cpp b/protocols/IcqOscarJ/src/icq_rates.cpp index eb0f85d46d..f319afd1b5 100644 --- a/protocols/IcqOscarJ/src/icq_rates.cpp +++ b/protocols/IcqOscarJ/src/icq_rates.cpp @@ -146,7 +146,7 @@ rates_group* rates::getGroup(WORD wGroup) if (this && wGroup && wGroup <= nGroups)
return &groups[wGroup - 1];
- return NULL;
+ return nullptr;
}
int rates::getNextRateLevel(WORD wGroup)
@@ -236,7 +236,7 @@ void rates::initAckPacket(icq_packet *pPacket) // Rate Level 2 Management
/////////////////////////////
-rates_queue_item::rates_queue_item(CIcqProto *ppro, WORD wGroup) : bCreated(FALSE), dwUin(0), szUid(NULL)
+rates_queue_item::rates_queue_item(CIcqProto *ppro, WORD wGroup) : bCreated(FALSE), dwUin(0), szUid(nullptr)
{
this->ppro = ppro;
this->wGroup = wGroup;
@@ -263,7 +263,7 @@ rates_queue_item* rates_queue_item::copyItem(rates_queue_item *pDest) pDest->hContact = hContact;
pDest->dwUin = dwUin;
- pDest->szUid = dwUin ? null_strdup(szUid) : NULL;
+ pDest->szUid = dwUin ? null_strdup(szUid) : nullptr;
pDest->bCreated = TRUE;
return pDest;
@@ -419,7 +419,7 @@ void rates_queue::putItem(rates_queue_item *pItem, int nMinDelay) int CIcqProto::handleRateItem(rates_queue_item *item, int nQueueType, int nMinDelay, BOOL bAllowDelay)
{
- rates_queue *pQueue = NULL;
+ rates_queue *pQueue = nullptr;
{
mir_cslock rlck(m_ratesMutex);
switch (nQueueType) {
diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp index 10f03bfa2d..95303e5619 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(NULL));
+ srand(time(nullptr));
ResetSettingsOnConnect();
@@ -57,13 +57,13 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) if (m_bGatewayMode)
nloc.flags |= NLOCF_HTTPGATEWAY;
- hServerConn = NetLib_OpenConnection(m_hNetlibUser, NULL, &nloc);
+ hServerConn = NetLib_OpenConnection(m_hNetlibUser, nullptr, &nloc);
SAFE_FREE((void**)&nloc.szHost);
SAFE_FREE((void**)&infoParam);
if (hServerConn && m_bSecureConnection) {
- if (!Netlib_StartSsl(hServerConn, 0)) {
+ if (!Netlib_StartSsl(hServerConn, nullptr)) {
icq_LogMessage(LOG_ERROR, LPGEN("Unable to connect to ICQ login server, SSL could not be negotiated"));
SetCurrentStatus(ID_STATUS_OFFLINE);
NetLib_CloseConnection(&hServerConn, TRUE);
@@ -73,7 +73,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) }
// Login error
- if (hServerConn == NULL) {
+ if (hServerConn == nullptr) {
DWORD dwError = GetLastError();
SetCurrentStatus(ID_STATUS_OFFLINE);
@@ -142,7 +142,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) CheckKeepAlive(&info);
packetRecv.bytesUsed = handleServerPackets(packetRecv.buffer, packetRecv.bytesAvailable, &info);
}
- serverThreadHandle = NULL;
+ serverThreadHandle = nullptr;
// Time to shutdown
debugLogA("Closing server connections...");
@@ -153,7 +153,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) // Close DC port
Netlib_CloseHandle(info.hDirectBoundPort);
- info.hDirectBoundPort = NULL;
+ info.hDirectBoundPort = nullptr;
// disable auto info-update thread
icq_EnableUserLookup(FALSE);
@@ -199,9 +199,9 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) // release rates queues
{
mir_cslock l(m_ratesMutex);
- delete m_ratesQueue_Request; m_ratesQueue_Request = NULL;
- delete m_ratesQueue_Response; m_ratesQueue_Response = NULL;
- delete m_rates; m_rates = NULL;
+ delete m_ratesQueue_Request; m_ratesQueue_Request = nullptr;
+ delete m_ratesQueue_Response; m_ratesQueue_Response = nullptr;
+ delete m_rates; m_rates = nullptr;
}
FlushServerIDs(); // clear server IDs list
@@ -221,7 +221,7 @@ void CIcqProto::icq_serverDisconnect() if (serverThreadHandle) {
debugLogA("Closing server thread handle: %08p", serverThreadHandle);
CloseHandle(serverThreadHandle);
- serverThreadHandle = NULL;
+ serverThreadHandle = nullptr;
}
SetCurrentStatus(ID_STATUS_OFFLINE);
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 61be92b29b..11291eb889 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -74,7 +74,7 @@ void __cdecl CIcqProto::servlistQueueThread(void *param) mir_cslockfull l(servlistQueueMutex);
while (servlistQueueCount) {
- ssiqueueditems* pItem = NULL;
+ ssiqueueditems* pItem = nullptr;
int bItemDouble;
WORD wItemAction;
icq_packet groupPacket = { 0 };
@@ -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(NULL);
+ time_t tNow = time(nullptr);
int bFound = FALSE;
for (i = 0; i < servlistQueueCount; i++) { // check if we do not have some expired items to handle, otherwise keep sleeping
@@ -251,7 +251,7 @@ void __cdecl CIcqProto::servlistQueueThread(void *param) // clean-up thread
CloseHandle(servlistQueueThreadHandle);
- servlistQueueThreadHandle = NULL;
+ servlistQueueThreadHandle = nullptr;
debugLogA("Server-List: Update Board ending.");
}
@@ -262,7 +262,7 @@ void CIcqProto::servlistQueueAddGroupItem(servlistgroupitem* pGroupItem, int dwT // add the packet to queue
DWORD dwMark = pGroupItem->dwOperation & SSOF_GROUPINGMASK;
- ssiqueueditems* pItem = NULL;
+ ssiqueueditems* pItem = nullptr;
// try to find compatible item
for (int i = 0; i < servlistQueueCount; i++) {
@@ -271,7 +271,7 @@ void CIcqProto::servlistQueueAddGroupItem(servlistgroupitem* pGroupItem, int dwT for (int j = 0; j < pItem->nItems; j++)
if (pItem->pItems[j]->cookie->wContactId == pGroupItem->cookie->wContactId && pItem->pItems[j]->cookie->wGroupId == pGroupItem->cookie->wGroupId) {
- pItem = NULL;
+ pItem = nullptr;
break;
}
@@ -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(NULL);
+ pItem->tAdded = time(nullptr);
pItem->dwTimeout = dwTimeout;
if (servlistQueueCount == servlistQueueSize) { // resize the queue - it is too small
@@ -307,7 +307,7 @@ void CIcqProto::servlistQueueAddGroupItem(servlistgroupitem* pGroupItem, int dwT // wake up board thread (keep sleeping or start new one)
if (!servlistQueueThreadHandle)
// create new board thread
- servlistQueueThreadHandle = ForkThreadEx(&CIcqProto::servlistQueueThread, &servlistQueueState, 0);
+ servlistQueueThreadHandle = ForkThreadEx(&CIcqProto::servlistQueueThread, &servlistQueueState, nullptr);
else // signal thread, that queue was changed during sleep
servlistQueueState = TRUE;
}
@@ -333,7 +333,7 @@ void CIcqProto::servlistPostPacket(icq_packet* packet, DWORD dwCookie, DWORD dwO if (servlistHandlePrimitives(dwOperation))
return;
- if (!FindCookie(dwCookie, NULL, (void**)&pCookie))
+ if (!FindCookie(dwCookie, nullptr, (void**)&pCookie))
return; // invalid cookie
if (dwOperation & SSOF_SEND_DIRECTLY) { // send directly - this is for some special cases
@@ -367,7 +367,7 @@ void CIcqProto::servlistPostPacketDouble(icq_packet* packet1, DWORD dwCookie, DW if (servlistHandlePrimitives(dwOperation))
return;
- if (!FindCookie(dwCookie, NULL, (void**)&pCookie))
+ if (!FindCookie(dwCookie, nullptr, (void**)&pCookie))
return; // invalid cookie
if (dwOperation & SSOF_SEND_DIRECTLY) { // send directly - this is for some special cases
@@ -408,7 +408,7 @@ void CIcqProto::servlistProcessLogin() // if the server-list queue contains items and thread is not running, start it
if (servlistQueueCount && !servlistQueueThreadHandle)
- servlistQueueThreadHandle = ForkThreadEx(&CIcqProto::servlistQueueThread, &servlistQueueState, 0);
+ servlistQueueThreadHandle = ForkThreadEx(&CIcqProto::servlistQueueThread, &servlistQueueState, nullptr);
}
// HERE ENDS SERVER-LIST UPDATE BOARD IMPLEMENTATION //
@@ -453,7 +453,7 @@ servlistpendingitem* CIcqProto::servlistPendingRemoveItem(int nType, MCONTACT hC {
// unregister pending item, trigger pending operations
int iItem;
- servlistpendingitem *pItem = NULL;
+ servlistpendingitem *pItem = nullptr;
mir_cslock l(servlistMutex);
@@ -504,11 +504,11 @@ void CIcqProto::servlistPendingAddContactOperation(MCONTACT hContact, LPARAM par // add postponed operation (add contact, update contact, regroup resume, etc.)
// - after contact is added
int iItem;
- servlistpendingitem *pItem = NULL;
+ servlistpendingitem *pItem = nullptr;
mir_cslock l(servlistMutex);
- if ((iItem = servlistPendingFindItem(ITEM_PENDING_CONTACT, hContact, NULL)) != -1)
+ if ((iItem = servlistPendingFindItem(ITEM_PENDING_CONTACT, hContact, nullptr)) != -1)
pItem = servlistPendingList[iItem];
if (pItem) {
@@ -526,7 +526,7 @@ void CIcqProto::servlistPendingAddGroupOperation(const char *pszGroup, LPARAM pa {
// add postponed operation - after group is added
int iItem;
- servlistpendingitem *pItem = NULL;
+ servlistpendingitem *pItem = nullptr;
mir_cslock l(servlistMutex);
@@ -547,11 +547,11 @@ void CIcqProto::servlistPendingAddGroupOperation(const char *pszGroup, LPARAM pa int CIcqProto::servlistPendingAddContact(MCONTACT hContact, WORD wContactID, WORD wGroupID, LPARAM param, PENDING_CONTACT_CALLBACK callback, int bDoInline, LPARAM operationParam, PENDING_CONTACT_CALLBACK operationCallback)
{
int iItem;
- servlistpendingitem *pItem = NULL;
+ servlistpendingitem *pItem = nullptr;
mir_cslockfull l(servlistMutex);
- if ((iItem = servlistPendingFindItem(ITEM_PENDING_CONTACT, hContact, NULL)) != -1)
+ if ((iItem = servlistPendingFindItem(ITEM_PENDING_CONTACT, hContact, nullptr)) != -1)
pItem = servlistPendingList[iItem];
if (pItem) {
@@ -588,7 +588,7 @@ int CIcqProto::servlistPendingAddContact(MCONTACT hContact, WORD wContactID, WOR int CIcqProto::servlistPendingAddGroup(const char *pszGroup, WORD wGroupID, LPARAM param, PENDING_GROUP_CALLBACK callback, int bDoInline, LPARAM operationParam, PENDING_GROUP_CALLBACK operationCallback)
{
int iItem;
- servlistpendingitem *pItem = NULL;
+ servlistpendingitem *pItem = nullptr;
mir_cslockfull l(servlistMutex);
@@ -629,7 +629,7 @@ void CIcqProto::servlistPendingRemoveContact(MCONTACT hContact, WORD wContactID, {
debugLogA("Server-List: %s contact %x operation.", (nResult != PENDING_RESULT_PURGE) ? "Ending" : "Purging", hContact);
- servlistpendingitem *pItem = servlistPendingRemoveItem(ITEM_PENDING_CONTACT, hContact, NULL);
+ servlistpendingitem *pItem = servlistPendingRemoveItem(ITEM_PENDING_CONTACT, hContact, nullptr);
if (pItem) { // process pending operations
if (pItem->operations) {
@@ -822,8 +822,8 @@ static int GroupReserveIdsEnumProc(const char *szSetting, LPARAM lParam) if (db_get_static_utf(0, param->szModule, szSetting, val, MAX_PATH))
return 0; // we failed also, invalid setting
- param->ppro->ReserveServerID((WORD)strtoul(szSetting, NULL, 0x10), SSIT_GROUP, 0);
- param->ppro->debugLogA("Loaded group %u:'%s'", strtoul(szSetting, NULL, 0x10), val);
+ param->ppro->ReserveServerID((WORD)strtoul(szSetting, nullptr, 0x10), SSIT_GROUP, 0);
+ param->ppro->debugLogA("Loaded group %u:'%s'", strtoul(szSetting, nullptr, 0x10), val);
}
return 0;
}
@@ -908,7 +908,7 @@ void CIcqProto::LoadServerIDs() void CIcqProto::StoreServerIDs() /// TODO: allow delayed
{
- BYTE *pUnhandled = NULL;
+ BYTE *pUnhandled = nullptr;
size_t cbUnhandled = 0;
mir_cslockfull l(servlistMutex);
@@ -1010,7 +1010,7 @@ DWORD CIcqProto::icq_sendServerItem(DWORD dwCookie, WORD wAction, WORD wGroupId, DWORD CIcqProto::icq_sendServerContact(MCONTACT hContact, DWORD dwCookie, WORD wAction, WORD wGroupId, WORD wContactId, DWORD dwOperation, DWORD dwTimeout, void **doubleObject)
{
- BYTE *pData = NULL, *pMetaToken = NULL, *pMetaTime = NULL;
+ BYTE *pData = nullptr, *pMetaToken = nullptr, *pMetaTime = nullptr;
int nDataLen = 0, nMetaTokenLen = 0, nMetaTimeLen = 0;
// Prepare UID
@@ -1022,8 +1022,8 @@ DWORD CIcqProto::icq_sendServerContact(MCONTACT hContact, DWORD dwCookie, WORD w }
BYTE bAuth = getByte(hContact, "Auth", 0);
- char *szNick = getSettingStringUtf(hContact, "CList", "MyHandle", NULL);
- char *szNote = getSettingStringUtf(hContact, "UserInfo", "MyNotes", NULL);
+ char *szNick = getSettingStringUtf(hContact, "CList", "MyHandle", nullptr);
+ char *szNote = getSettingStringUtf(hContact, "UserInfo", "MyNotes", nullptr);
DBVARIANT dbv;
if (!getSetting(hContact, DBSETTING_METAINFO_TOKEN, &dbv)) {
@@ -1104,7 +1104,7 @@ DWORD CIcqProto::icq_sendServerContact(MCONTACT hContact, DWORD dwCookie, WORD w DWORD CIcqProto::icq_sendSimpleItem(DWORD dwCookie, WORD wAction, DWORD dwUin, char* szUID, WORD wGroupId, WORD wItemId, WORD wItemType, DWORD dwOperation, DWORD dwTimeout)
{ // for privacy items
- return icq_sendServerItem(dwCookie, wAction, wGroupId, wItemId, strUID(dwUin, szUID), NULL, 0, wItemType, dwOperation, dwTimeout, NULL);
+ return icq_sendServerItem(dwCookie, wAction, wGroupId, wItemId, strUID(dwUin, szUID), nullptr, 0, wItemType, dwOperation, dwTimeout, nullptr);
}
DWORD CIcqProto::icq_sendServerGroup(DWORD dwCookie, WORD wAction, WORD wGroupId, const char *szName, void *pContent, int cbContent, DWORD dwOperationFlags)
@@ -1129,7 +1129,7 @@ DWORD CIcqProto::icq_sendServerGroup(DWORD dwCookie, WORD wAction, WORD wGroupId if (wTLVlen)
packTLV(&pBuffer, SSI_TLV_SUBITEMS, cbContent, (LPBYTE)pContent); // Groups TLV
- return icq_sendServerItem(dwCookie, wAction, wGroupId, 0, szName, pBuffer.pData, wTLVlen, SSI_ITEM_GROUP, SSOP_GROUP_ACTION | dwOperationFlags, 400, NULL);
+ return icq_sendServerItem(dwCookie, wAction, wGroupId, 0, szName, pBuffer.pData, wTLVlen, SSI_ITEM_GROUP, SSOP_GROUP_ACTION | dwOperationFlags, 400, nullptr);
}
DWORD CIcqProto::icq_modifyServerPrivacyItem(MCONTACT hContact, DWORD dwUin, char *szUid, WORD wAction, DWORD dwOperation, WORD wItemId, WORD wType)
@@ -1196,7 +1196,7 @@ void CIcqProto::FlushSrvGroupsCache() // Look thru DB and collect all ContactIDs from a group
void* CIcqProto::collectBuddyGroup(WORD wGroupID, int *count)
{
- WORD* buf = NULL;
+ WORD* buf = nullptr;
int cnt = 0;
MCONTACT hContact;
WORD wItemID;
@@ -1226,7 +1226,7 @@ void* CIcqProto::collectBuddyGroup(WORD wGroupID, int *count) // Look thru DB and collect all GroupIDs
void* CIcqProto::collectGroups(int *count)
{
- WORD* buf = NULL;
+ WORD* buf = nullptr;
int cnt = 0;
int i;
WORD wGroupID;
@@ -1271,7 +1271,7 @@ void CIcqProto::removeGroupPathLinks(WORD wGroupID) mir_snprintf(szModule, "%sGroups", m_szModuleName);
- pars[0] = NULL;
+ pars[0] = nullptr;
pars[1] = (char*)wGroupID;
pars[2] = szModule;
@@ -1296,7 +1296,7 @@ char* CIcqProto::getServListGroupName(WORD wGroupID) if (!wGroupID) {
debugLogA("Warning: Cannot get group name (Group ID missing)!");
- return NULL;
+ return nullptr;
}
mir_snprintf(szModule, "%sSrvGroups", m_szModuleName);
@@ -1305,10 +1305,10 @@ char* CIcqProto::getServListGroupName(WORD wGroupID) if (!CheckServerID(wGroupID, 0)) { // check if valid id, if not give empty and remove
debugLogA("Removing group %u from cache...", wGroupID);
db_unset(NULL, szModule, szGroup);
- return NULL;
+ return nullptr;
}
- return getSettingStringUtf(NULL, szModule, szGroup, NULL);
+ return getSettingStringUtf(NULL, szModule, szGroup, nullptr);
}
void CIcqProto::setServListGroupName(WORD wGroupID, const char *szGroupName)
@@ -1371,7 +1371,7 @@ int CIcqProto::getCListGroupExists(const char *szGroup) if (make_unicode_string_static(szGroup, tszGroup, size))
for (int i = 1; TRUE; i++) {
- wchar_t *tszGroupName = (wchar_t*)Clist_GroupGetName(i, NULL);
+ wchar_t *tszGroupName = (wchar_t*)Clist_GroupGetName(i, nullptr);
if (!tszGroupName)
break;
@@ -1435,7 +1435,7 @@ int CIcqProto::getServListGroupLevel(WORD wGroupId) // demangle group path
char *CIcqProto::getServListGroupCListPath(WORD wGroupId)
{
- char *szGroup = NULL;
+ char *szGroup = nullptr;
if (szGroup = getServListGroupName(wGroupId)) { // this groupid is valid
if (!m_bSsiSimpleGroups)
@@ -1485,7 +1485,7 @@ char *CIcqProto::getServListGroupCListPath(WORD wGroupId) return szGroup;
}
}
- return NULL;
+ return nullptr;
}
@@ -1494,7 +1494,7 @@ static int SrvGroupNamesEnumProc(const char *szSetting, LPARAM lParam) // check server-group cache item
const char **params = (const char**)lParam;
CIcqProto *ppro = (CIcqProto*)params[0];
- char *szGroupName = ppro->getSettingStringUtf(NULL, params[3], szSetting, NULL);
+ char *szGroupName = ppro->getSettingStringUtf(NULL, params[3], szSetting, nullptr);
if (!mir_strcmp(szGroupName, params[2]))
params[1] = szSetting; // do not need the real value, just arbitrary non-NULL
@@ -1510,7 +1510,7 @@ char* CIcqProto::getServListUniqueGroupName(const char *szGroupName, int bAlloce char *pars[4];
int uniqueID = 1;
char *szGroupNameBase = (char*)szGroupName;
- char *szNewGroupName = NULL;
+ char *szNewGroupName = nullptr;
if (!bAlloced)
szGroupNameBase = null_strdup(szGroupName);
@@ -1520,7 +1520,7 @@ char* CIcqProto::getServListUniqueGroupName(const char *szGroupName, int bAlloce do {
pars[0] = (char*)this;
- pars[1] = NULL;
+ pars[1] = nullptr;
pars[2] = szNewGroupName ? szNewGroupName : szGroupNameBase;
pars[3] = szModule;
db_enum_settings(NULL, &SrvGroupNamesEnumProc, szModule, pars);
@@ -1618,7 +1618,7 @@ int CIcqProto::servlistCreateGroup_gotParentGroup(const char *szGroup, WORD wGro ack->dwAction = SSA_GROUP_ADD;
dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_ADDTOLIST, 0, ack);
- icq_sendServerGroup(dwCookie, ICQ_LISTS_ADDTOLIST, ack->wGroupId, szSubGroupItem, NULL, 0, SSOF_BEGIN_OPERATION);
+ icq_sendServerGroup(dwCookie, ICQ_LISTS_ADDTOLIST, ack->wGroupId, szSubGroupItem, nullptr, 0, SSOF_BEGIN_OPERATION);
return CALLBACK_RESULT_CONTINUE;
}
SAFE_FREE((void**)&szSubGroupItem);
@@ -1661,7 +1661,7 @@ int CIcqProto::servlistCreateGroup_Ready(const char *szGroup, WORD groupID, LPAR ack->dwAction = SSA_GROUP_ADD;
dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_ADDTOLIST, 0, ack);
- icq_sendServerGroup(dwCookie, ICQ_LISTS_ADDTOLIST, ack->wGroupId, ack->szGroup, NULL, 0, SSOF_BEGIN_OPERATION);
+ icq_sendServerGroup(dwCookie, ICQ_LISTS_ADDTOLIST, ack->wGroupId, ack->szGroup, nullptr, 0, SSOF_BEGIN_OPERATION);
return CALLBACK_RESULT_POSTPONE;
}
@@ -1741,7 +1741,7 @@ int CIcqProto::servlistAddContact_gotGroup(const char*, WORD wGroupID, LPARAM lP DWORD dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_ADDTOLIST, ack->hContact, ack);
- icq_sendServerContact(ack->hContact, dwCookie, ICQ_LISTS_ADDTOLIST, wGroupID, wItemID, SSOP_ITEM_ACTION | SSOF_CONTACT | SSOF_BEGIN_OPERATION, 400, NULL);
+ icq_sendServerContact(ack->hContact, dwCookie, ICQ_LISTS_ADDTOLIST, wGroupID, wItemID, SSOP_ITEM_ACTION | SSOF_CONTACT | SSOF_BEGIN_OPERATION, 400, nullptr);
return CALLBACK_RESULT_CONTINUE;
}
@@ -1833,7 +1833,7 @@ int CIcqProto::servlistRemoveContact_Ready(MCONTACT hContact, WORD contactID, WO dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_REMOVEFROMLIST, hContact, ack);
- icq_sendServerContact(hContact, dwCookie, ICQ_LISTS_REMOVEFROMLIST, wGroupID, wItemID, SSOP_ITEM_ACTION | SSOF_CONTACT | SSOF_BEGIN_OPERATION, 400, NULL);
+ icq_sendServerContact(hContact, dwCookie, ICQ_LISTS_REMOVEFROMLIST, wGroupID, wItemID, SSOP_ITEM_ACTION | SSOF_CONTACT | SSOF_BEGIN_OPERATION, 400, nullptr);
return CALLBACK_RESULT_POSTPONE;
}
@@ -1895,7 +1895,7 @@ int CIcqProto::servlistMoveContact_gotTargetGroup(const char *szGroup, WORD wNew return CALLBACK_RESULT_CONTINUE;
}
- ack->szGroupName = NULL;
+ ack->szGroupName = nullptr;
ack->dwAction = SSA_CONTACT_SET_GROUP;
ack->wGroupId = wGroupID;
ack->wContactId = wItemID;
@@ -1907,7 +1907,7 @@ int CIcqProto::servlistMoveContact_gotTargetGroup(const char *szGroup, WORD wNew DWORD dwCookie2 = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_ADDTOLIST, ack->hContact, ack);
{
// imitate icq5, previously here was different order, but AOL changed and it ceased to work
- void *doubleObject = NULL;
+ void *doubleObject = nullptr;
icq_sendServerContact(ack->hContact, dwCookie2, ICQ_LISTS_ADDTOLIST, wNewGroupID, ack->wNewContactId, SSO_CONTACT_SETGROUP | SSOF_BEGIN_OPERATION, 500, &doubleObject);
icq_sendServerContact(ack->hContact, dwCookie, ICQ_LISTS_REMOVEFROMLIST, wGroupID, wItemID, SSO_CONTACT_SETGROUP | SSOF_BEGIN_OPERATION, 500, &doubleObject);
@@ -1955,7 +1955,7 @@ void CIcqProto::servlistMoveContact(MCONTACT hContact, const char *pszNewGroup) return;
}
- if ((pszNewGroup != NULL) && (pszNewGroup[0] != '\0') && !getCListGroupExists(pszNewGroup)) { // the contact moved to non existing group, do not do anything: MetaContact hack
+ if ((pszNewGroup != nullptr) && (pszNewGroup[0] != '\0') && !getCListGroupExists(pszNewGroup)) { // the contact moved to non existing group, do not do anything: MetaContact hack
debugLogA("Contact not moved - probably hiding by MetaContacts.");
return;
}
@@ -2020,7 +2020,7 @@ int CIcqProto::servlistUpdateContact_Ready(MCONTACT hContact, WORD contactID, WO // There is no need to send ICQ_LISTS_CLI_MODIFYSTART or
// ICQ_LISTS_CLI_MODIFYEND when just changing nick name
- icq_sendServerContact(hContact, dwCookie, ICQ_LISTS_UPDATEGROUP, wGroupID, wItemID, SSOP_ITEM_ACTION | SSOF_CONTACT, 400, NULL);
+ icq_sendServerContact(hContact, dwCookie, ICQ_LISTS_UPDATEGROUP, wGroupID, wItemID, SSOP_ITEM_ACTION | SSOF_CONTACT, 400, nullptr);
return CALLBACK_RESULT_POSTPONE;
}
@@ -2160,7 +2160,7 @@ int CIcqProto::servlistRemoveGroup_Ready(const char *szGroup, WORD groupID, LPAR char *szGroupName;
if (wGroupID && (szGroupName = getServListGroupName(wGroupID))) { // the group is valid, check if it is empty
- void *groupData = collectBuddyGroup(wGroupID, NULL);
+ void *groupData = collectBuddyGroup(wGroupID, nullptr);
if (groupData) { // the group is not empty, cannot delete
SAFE_FREE(&groupData);
@@ -2181,7 +2181,7 @@ int CIcqProto::servlistRemoveGroup_Ready(const char *szGroup, WORD groupID, LPAR ack->szGroupName = szGroupName;
DWORD dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_REMOVEFROMLIST, 0, ack);
- icq_sendServerGroup(dwCookie, ICQ_LISTS_REMOVEFROMLIST, ack->wGroupId, ack->szGroupName, NULL, 0, 0);
+ icq_sendServerGroup(dwCookie, ICQ_LISTS_REMOVEFROMLIST, ack->wGroupId, ack->szGroupName, nullptr, 0, 0);
}
return CALLBACK_RESULT_POSTPONE;
}
@@ -2223,7 +2223,7 @@ void CIcqProto::resetServContactAuthState(MCONTACT hContact) DWORD dwCookie = AllocateCookie(CKT_SERVERLIST, 0, hContact, ack);
{
- void *doubleObject = NULL;
+ void *doubleObject = nullptr;
icq_sendServerContact(hContact, dwCookie, ICQ_LISTS_REMOVEFROMLIST, wGroupId, wContactId, SSO_CONTACT_FIXAUTH | SSOF_BEGIN_OPERATION | SSOF_END_OPERATION, 200, &doubleObject);
delSetting(hContact, DBSETTING_METAINFO_TOKEN);
@@ -2330,17 +2330,17 @@ int CIcqProto::ServListCListGroupChange(WPARAM hContact, LPARAM lParam) return 0;
if (hContact == NULL) { // change made to group
- if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL) { // group removed
+ if (grpchg->pszNewName == nullptr && grpchg->pszOldName != nullptr) { // group removed
char *szOldName = make_utf8_string(grpchg->pszOldName);
WORD wGroupId = getServListGroupLinkID(szOldName);
if (wGroupId) { // the group is known, remove from server
- servlistPostPacket(NULL, 0, SSO_BEGIN_OPERATION, 100); // start server modifications here
+ servlistPostPacket(nullptr, 0, SSO_BEGIN_OPERATION, 100); // start server modifications here
servlistRemoveGroup(szOldName, wGroupId);
}
SAFE_FREE(&szOldName);
}
- else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL) { // group renamed
+ else if (grpchg->pszNewName != nullptr && grpchg->pszOldName != nullptr) { // group renamed
char *szNewName = make_utf8_string(grpchg->pszNewName);
char *szOldName = make_utf8_string(grpchg->pszOldName);
WORD wGroupId = getServListGroupLinkID(szOldName);
@@ -2354,7 +2354,7 @@ int CIcqProto::ServListCListGroupChange(WPARAM hContact, LPARAM lParam) }
else { // change to contact
if (IsICQContact(hContact)) { // our contact, fine move on the server as well
- char *szNewName = grpchg->pszNewName ? make_utf8_string(grpchg->pszNewName) : NULL;
+ char *szNewName = grpchg->pszNewName ? make_utf8_string(grpchg->pszNewName) : nullptr;
servlistMoveContact(hContact, szNewName);
SAFE_FREE(&szNewName);
}
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index 0e2890c0dd..afa1843853 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -33,10 +33,10 @@ static int bListInit = 0; static HANDLE hItemAll;
static int dwUploadDelay = 1000; // initial setting, it is too low for icq server but good for short updates
-static HWND hwndUploadContacts = NULL;
+static HWND hwndUploadContacts = nullptr;
static const UINT settingsControls[] = { IDOK };
-static WORD *pwGroupIds = NULL;
+static WORD *pwGroupIds = nullptr;
static int cbGroupIds = 0;
// Init default clist options
@@ -140,7 +140,7 @@ static int GroupEnumIdsEnumProc(const char *szSetting, LPARAM lParam) return 0; // this converts all string types to DBVT_ASCIIZ
pwGroupIds = (WORD*)SAFE_REALLOC(pwGroupIds, (cbGroupIds + 1)*sizeof(WORD));
- pwGroupIds[cbGroupIds] = (WORD)strtoul(szSetting, NULL, 0x10);
+ pwGroupIds[cbGroupIds] = (WORD)strtoul(szSetting, nullptr, 0x10);
cbGroupIds++;
}
return 0;
@@ -164,7 +164,7 @@ static DWORD sendUploadGroup(CIcqProto* ppro, WORD wAction, WORD wGroupId, char* dwCookie = ppro->AllocateCookie(CKT_SERVERLIST, wAction, 0, ack);
ack->lParam = dwCookie;
- ppro->icq_sendServerGroup(dwCookie, wAction, ack->wGroupId, szItemName, NULL, 0, 0);
+ ppro->icq_sendServerGroup(dwCookie, wAction, ack->wGroupId, szItemName, nullptr, 0, 0);
return dwCookie;
}
return 0;
@@ -173,7 +173,7 @@ static DWORD sendUploadGroup(CIcqProto* ppro, WORD wAction, WORD wGroupId, char* static DWORD sendUploadBuddy(CIcqProto* ppro, MCONTACT hContact, WORD wAction, DWORD dwUin, char *szUID, WORD wContactId, WORD wGroupId, WORD wItemType)
{
cookie_servlist_action *ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action));
- if (ack == NULL)
+ if (ack == nullptr)
return 0;
// we have cookie good, go on
@@ -185,7 +185,7 @@ static DWORD sendUploadBuddy(CIcqProto* ppro, MCONTACT hContact, WORD wAction, D ack->lParam = dwCookie;
if (wItemType == SSI_ITEM_BUDDY)
- ppro->icq_sendServerContact(hContact, dwCookie, wAction, ack->wGroupId, ack->wContactId, SSOP_ITEM_ACTION | SSOF_CONTACT, 500, NULL);
+ ppro->icq_sendServerContact(hContact, dwCookie, wAction, ack->wGroupId, ack->wContactId, SSOP_ITEM_ACTION | SSOF_CONTACT, 500, nullptr);
else
ppro->icq_sendSimpleItem(dwCookie, wAction, dwUin, szUID, ack->wGroupId, ack->wContactId, wItemType, SSOP_ITEM_ACTION, 500);
@@ -253,7 +253,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa char str[MAX_PATH];
working = 0;
- hProtoAckHook = NULL;
+ hProtoAckHook = nullptr;
currentState = STATE_READY;
ResetCListOptions(GetDlgItem(hwndDlg, IDC_CLIST));
@@ -371,7 +371,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa case ACTION_REMOVEGROUP:
if (ack->result == ACKRESULT_SUCCESS) {
ppro->FreeServerID(wNewGroupId, SSIT_GROUP);
- ppro->setServListGroupName(wNewGroupId, NULL); // remove group from list
+ ppro->setServListGroupName(wNewGroupId, nullptr); // remove group from list
ppro->removeGroupPathLinks(wNewGroupId); // grouppath is known
int groupSize;
@@ -439,7 +439,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa ICQTranslateUtfStatic(getServerResultDesc(ack->lParam), str, MAX_PATH));
if (!bMulti)
- SetTimer(hwndDlg, M_UPLOADMORE, dwUploadDelay, 0); // delay
+ SetTimer(hwndDlg, M_UPLOADMORE, dwUploadDelay, nullptr); // delay
}
break;
@@ -496,7 +496,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa // Is this one out of sync?
if (bUidOk && (isChecked != isOnServer)) {
// Only upload custom nicks
- char *pszNick = ppro->getSettingStringUtf(hContact, "CList", "MyHandle", NULL);
+ char *pszNick = ppro->getSettingStringUtf(hContact, "CList", "MyHandle", nullptr);
if (isChecked) { // Queue for uploading
char *pszGroup = ppro->getContactCListGroup(hContact);
@@ -505,7 +505,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa // Get group ID from cache, if not ready use parent group, if still not ready create one
wNewGroupId = ppro->getServListGroupLinkID(pszGroup);
- if (!wNewGroupId && strstrnull(pszGroup, "\\") != NULL) { // if it is sub-group, take master parent
+ if (!wNewGroupId && strstrnull(pszGroup, "\\") != nullptr) { // if it is sub-group, take master parent
strstrnull(pszGroup, "\\")[0] = '\0';
wNewGroupId = ppro->getServListGroupLinkID(pszGroup);
}
@@ -569,7 +569,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa pszGroup = null_strdup(DEFAULT_SS_GROUP);
wNewGroupId = ppro->getServListGroupLinkID(pszGroup);
- if (!wNewGroupId && strstrnull(pszGroup, "\\") != NULL) { // if it is sub-group, take master parent
+ if (!wNewGroupId && strstrnull(pszGroup, "\\") != nullptr) { // if it is sub-group, take master parent
strstrnull(pszGroup, "\\")[0] = '\0';
wNewGroupId = ppro->getServListGroupLinkID(pszGroup);
}
@@ -589,7 +589,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa if (wNewGroupId && (wNewGroupId != wCurrentGroupId)) {
WORD wCurrentContactId = ppro->getWord(hContact, DBSETTING_SERVLIST_ID, 0);
- char *pszNick = ppro->getSettingStringUtf(hContact, "CList", "MyHandle", NULL);
+ char *pszNick = ppro->getSettingStringUtf(hContact, "CList", "MyHandle", nullptr);
if (pszNick)
AppendToUploadLog(hwndDlg, ICQTranslateUtfStatic(LPGEN("Moving %s to group \"%s\"..."), str, MAX_PATH), pszNick, pszGroup);
else
@@ -731,7 +731,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa currentAction = ACTION_UPDATESTATE;
AppendToUploadLog(hwndDlg, ICQTranslateUtfStatic(LPGEN("Updating group \"%s\"..."), str, MAX_PATH), pszGroup);
- ppro->icq_sendServerGroup(currentSequence, ICQ_LISTS_UPDATEGROUP, wNewGroupId, pszGroup, 0, 0, 0);
+ ppro->icq_sendServerGroup(currentSequence, ICQ_LISTS_UPDATEGROUP, wNewGroupId, pszGroup, nullptr, 0, 0);
SAFE_FREE((void**)&pszGroup);
}
@@ -752,7 +752,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa SetDlgItemText(hwndDlg, IDCANCEL, TranslateT("Close"));
// end server modifications here
- ppro->servlistPostPacket(NULL, 0, SSO_END_OPERATION, 100);
+ ppro->servlistPostPacket(nullptr, 0, SSO_END_OPERATION, 100);
working = 0;
UpdateCheckmarks(GetDlgItem(hwndDlg, IDC_CLIST), ppro, hItemAll);
if (hProtoAckHook)
@@ -779,7 +779,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa hProtoAckHook = HookEventMessage(ME_PROTO_ACK, hwndDlg, M_PROTOACK);
// start server modifications here
- ppro->servlistPostPacket(NULL, 0, SSO_BEGIN_OPERATION | SSOF_IMPORT_OPERATION, 100);
+ ppro->servlistPostPacket(nullptr, 0, SSO_BEGIN_OPERATION | SSOF_IMPORT_OPERATION, 100);
PostMessage(hwndDlg, M_UPLOADMORE, 0, 0);
break;
@@ -814,7 +814,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa if (ppro) {
DeleteOtherContactsFromControl(hClist, ppro);
if (!bListInit) // do not enter twice
- bCheck = UpdateCheckmarks(hClist, ppro, NULL);
+ bCheck = UpdateCheckmarks(hClist, ppro, nullptr);
}
if (!hItemAll) { // Add the "All contacts" item
@@ -858,9 +858,9 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa if (hProtoAckHook)
UnhookEvent(hProtoAckHook);
if (working) // end server modifications here
- ppro->servlistPostPacket(NULL, 0, SSO_END_OPERATION, 100);
+ ppro->servlistPostPacket(nullptr, 0, SSO_END_OPERATION, 100);
- hwndUploadContacts = NULL;
+ hwndUploadContacts = nullptr;
working = 0;
break;
}
@@ -870,9 +870,9 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa void CIcqProto::ShowUploadContactsDialog(void)
{
- if (hwndUploadContacts == NULL) {
- hItemAll = NULL;
- hwndUploadContacts = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ICQUPLOADLIST), NULL, DlgProcUploadList, LPARAM(this));
+ if (hwndUploadContacts == nullptr) {
+ hItemAll = nullptr;
+ hwndUploadContacts = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ICQUPLOADLIST), nullptr, DlgProcUploadList, LPARAM(this));
}
SetForegroundWindow(hwndUploadContacts);
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index cf41be3e94..65f7d1025f 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -81,7 +81,7 @@ DWORD CIcqProto::requestXStatusDetails(MCONTACT hContact, BOOL bAllowDelay) struct rates_xstatus_request : public rates_queue_item
{
protected:
- virtual rates_queue_item* copyItem(rates_queue_item *aDest = NULL)
+ virtual rates_queue_item* copyItem(rates_queue_item *aDest = nullptr)
{
rates_xstatus_request *pDest = (rates_xstatus_request*)aDest;
if (!pDest)
@@ -143,7 +143,7 @@ static wchar_t* InitXStatusIconLibrary(wchar_t *buf, size_t buf_size) HMODULE hXStatusIconsDLL;
// get miranda's exe path
- GetModuleFileName(NULL, path, MAX_PATH);
+ GetModuleFileName(nullptr, path, MAX_PATH);
hXStatusIconsDLL = (HMODULE)LoadXStatusIconLibrary(path, L"\\Icons");
if (!hXStatusIconsDLL) // TODO: add "Custom Folders" support
@@ -165,7 +165,7 @@ static wchar_t* InitXStatusIconLibrary(wchar_t *buf, size_t buf_size) HICON CIcqProto::getXStatusIcon(int bStatus, UINT flags)
{
- HICON icon = NULL;
+ HICON icon = nullptr;
if (bStatus > 0 && bStatus <= XSTATUS_COUNT)
icon = IcoLib_GetIconByHandle(hXStatusIcons[bStatus - 1], (flags & LR_BIGICON) != 0);
@@ -175,7 +175,7 @@ HICON CIcqProto::getXStatusIcon(int bStatus, UINT flags) void setContactExtraIcon(MCONTACT hContact, int xstatus)
{
- ExtraIcon_SetIcon(hExtraXStatus, hContact, (xstatus > 0) ? hXStatusIcons[xstatus - 1] : NULL);
+ ExtraIcon_SetIcon(hExtraXStatus, hContact, (xstatus > 0) ? hXStatusIcons[xstatus - 1] : nullptr);
}
#define NULLCAP {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
@@ -520,7 +520,7 @@ void CIcqProto::updateServerCustomStatus(int fullUpdate) SetStatusMood(szMoodData, 1500);
}
- char *szStatusNote = NULL;
+ char *szStatusNote = nullptr;
// use custom status message as status note
if (bXStatus && (m_bXStatusEnabled || m_bMoodsEnabled))
@@ -619,7 +619,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg, UINT message, WPARAM wPa ShowDlgItem(hwndDlg, IDC_XMSG, SW_SHOW);
ShowDlgItem(hwndDlg, IDC_XTITLE, SW_SHOW);
SetDlgItemText(hwndDlg, IDOK, TranslateT("Close"));
- UnhookEvent(dat->hEvent); dat->hEvent = NULL;
+ UnhookEvent(dat->hEvent); dat->hEvent = nullptr;
char *szText = dat->ppro->getSettingStringUtf(dat->hContact, DBSETTING_XSTATUS_NAME, "");
SetDlgItemTextUtf(hwndDlg, IDC_XTITLE, szText);
SAFE_FREE(&szText);
@@ -660,12 +660,12 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg, UINT message, WPARAM wPa dat->okButtonFormat = GetDlgItemTextUtf(hwndDlg, IDOK);
dat->countdown = 5;
SendMessage(hwndDlg, WM_TIMER, 0, 0);
- SetTimer(hwndDlg, 1, 1000, 0);
+ SetTimer(hwndDlg, 1, 1000, nullptr);
}
else { // retrieve contact's xStatus
dat->hContact = init->hContact;
dat->bXStatus = dat->ppro->getContactXStatus(dat->hContact);
- dat->okButtonFormat = NULL;
+ dat->okButtonFormat = nullptr;
SendDlgItemMessage(hwndDlg, IDC_XTITLE, EM_SETREADONLY, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_XMSG, EM_SETREADONLY, 1, 0);
@@ -679,7 +679,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg, UINT message, WPARAM wPa }
else {
SetDlgItemText(hwndDlg, IDOK, TranslateT("Close"));
- dat->hEvent = NULL;
+ dat->hEvent = nullptr;
char *szText = dat->ppro->getSettingStringUtf(dat->hContact, DBSETTING_XSTATUS_NAME, "");
SetDlgItemTextUtf(hwndDlg, IDC_XTITLE, szText);
SAFE_FREE(&szText);
@@ -782,15 +782,15 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) if (!m_bHideXStatusUI) {
if (bOldXStatus <= XSTATUS_COUNT)
- Menu_ModifyItem(hXStatusItems[bOldXStatus], NULL, INVALID_HANDLE_VALUE, 0);
+ Menu_ModifyItem(hXStatusItems[bOldXStatus], nullptr, INVALID_HANDLE_VALUE, 0);
- Menu_ModifyItem(hXStatusItems[bXStatus], NULL, INVALID_HANDLE_VALUE, CMIF_CHECKED);
+ Menu_ModifyItem(hXStatusItems[bXStatus], nullptr, INVALID_HANDLE_VALUE, CMIF_CHECKED);
}
if (bXStatus) {
char szSetting[64];
char str[MAX_PATH];
- char *szName = NULL, *szMsg = NULL;
+ char *szName = nullptr, *szMsg = nullptr;
if (m_bXStatusEnabled) {
mir_snprintf(szSetting, "XStatus%dName", bXStatus);
@@ -807,7 +807,7 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) init.bXStatus = bXStatus;
init.szXStatusName = szName;
init.szXStatusMsg = szMsg;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SETXSTATUS), NULL, SetXStatusDlgProc, (LPARAM)&init);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
}
else {
setByte(DBSETTING_XSTATUS_ID, bXStatus);
@@ -878,7 +878,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) CreateProtoServiceParam(srvFce, &CIcqProto::menuXStatus, i);
mi.flags = (bXStatus == i ? CMIF_CHECKED : 0);
- mi.hIcolibItem = i ? hXStatusIcons[i - 1] : NULL;
+ mi.hIcolibItem = i ? hXStatusIcons[i - 1] : nullptr;
mi.name.a = i ? (char*)nameXStatus[i - 1] : (char *)LPGEN("None");
mi.pszService = srvFce;
@@ -891,7 +891,7 @@ void InitXStatusIcons() {
wchar_t lib[2 * MAX_PATH] = { 0 };
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.section.a = "Protocols/" ICQ_PROTOCOL_NAME "/" LPGEN("Custom Status");
sid.flags = SIDF_PATH_UNICODE;
sid.defaultFile.w = InitXStatusIconLibrary(lib, _countof(lib));
@@ -916,7 +916,7 @@ INT_PTR CIcqProto::ShowXStatusDetails(WPARAM hContact, LPARAM) init.ppro = this;
init.bAction = 1; // retrieve
init.hContact = hContact;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SETXSTATUS), NULL, SetXStatusDlgProc, (LPARAM)&init);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
return 0;
}
@@ -987,7 +987,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM hContact, LPARAM lParam) // fill status name member
if (pData->flags & CSSF_MASK_NAME) {
if (pData->flags & CSSF_DEFAULT_NAME) {
- int status = (pData->wParam == NULL) ? getContactXStatus(hContact) : *pData->wParam;
+ int status = (pData->wParam == nullptr) ? getContactXStatus(hContact) : *pData->wParam;
if (status < 1 || status > XSTATUS_COUNT)
return 1; // Failure
diff --git a/protocols/IcqOscarJ/src/icq_xtraz.cpp b/protocols/IcqOscarJ/src/icq_xtraz.cpp index 9991238779..afaf939692 100644 --- a/protocols/IcqOscarJ/src/icq_xtraz.cpp +++ b/protocols/IcqOscarJ/src/icq_xtraz.cpp @@ -34,7 +34,7 @@ void CIcqProto::handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD w char *szNotify = strstrnull(szMsg, "<NOTIFY>");
char *szQuery = strstrnull(szMsg, "<QUERY>");
- MCONTACT hContact = HContactFromUIN(dwUin, NULL);
+ MCONTACT hContact = HContactFromUIN(dwUin, nullptr);
if (hContact) // user sent us xtraz, he supports it
SetContactCapabilities(hContact, CAPF_XTRAZ);
@@ -103,7 +103,7 @@ void CIcqProto::handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD w struct rates_xstatus_response : public rates_queue_item {
protected:
- virtual rates_queue_item* copyItem(rates_queue_item *aDest = NULL)
+ virtual rates_queue_item* copyItem(rates_queue_item *aDest = nullptr)
{
rates_xstatus_response *pDest = (rates_xstatus_response*)aDest;
if (!pDest)
@@ -118,7 +118,7 @@ void CIcqProto::handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD w return rates_queue_item::copyItem(pDest);
};
public:
- rates_xstatus_response(CIcqProto *ppro, WORD wGroup) : rates_queue_item(ppro, wGroup), szResponse(NULL) {};
+ rates_xstatus_response(CIcqProto *ppro, WORD wGroup) : rates_queue_item(ppro, wGroup), szResponse(nullptr) {};
virtual ~rates_xstatus_response() { if (bCreated) SAFE_FREE(&szResponse); };
virtual void execute()
@@ -193,7 +193,7 @@ void CIcqProto::handleXtrazNotifyResponse(MCONTACT hContact, WORD wCookie, char* NextVal:
szNode = strstrnull(szRes, "<val srv_id=");
- if (szNode) szEnd = strstrnull(szNode, ">"); else szEnd = NULL;
+ if (szNode) szEnd = strstrnull(szNode, ">"); else szEnd = nullptr;
if (szNode && szEnd) {
*(szEnd - 1) = '\0';
@@ -222,7 +222,7 @@ void CIcqProto::handleXtrazNotifyResponse(MCONTACT hContact, WORD wCookie, char* *szEnd = '\0';
szXName = DemangleXml(szNode, mir_strlen(szNode));
// check if the name changed
- szOldXName = getSettingStringUtf(hContact, DBSETTING_XSTATUS_NAME, NULL);
+ szOldXName = getSettingStringUtf(hContact, DBSETTING_XSTATUS_NAME, nullptr);
if (mir_strcmp(szOldXName, szXName))
bChanged = TRUE;
SAFE_FREE(&szOldXName);
@@ -238,7 +238,7 @@ void CIcqProto::handleXtrazNotifyResponse(MCONTACT hContact, WORD wCookie, char* *szEnd = '\0';
szXMsg = DemangleXml(szNode, mir_strlen(szNode));
// check if the decription changed
- szOldXMsg = getSettingStringUtf(hContact, DBSETTING_XSTATUS_NAME, NULL);
+ szOldXMsg = getSettingStringUtf(hContact, DBSETTING_XSTATUS_NAME, nullptr);
if (mir_strcmp(szOldXMsg, szXMsg))
bChanged = TRUE;
SAFE_FREE(&szOldXMsg);
@@ -274,13 +274,13 @@ static char* getXmlPidItem(const char* szData) szPid += 5;
return DemangleXml(szPid, szEnd - szPid);
}
- return NULL;
+ return nullptr;
}
void CIcqProto::handleXtrazInvitation(DWORD dwUin, char* szMsg, BOOL bThruDC)
{
- MCONTACT hContact = HContactFromUIN(dwUin, NULL);
+ MCONTACT hContact = HContactFromUIN(dwUin, nullptr);
if (hContact) // user sent us xtraz, he supports it
SetContactCapabilities(hContact, CAPF_XTRAZ);
@@ -296,7 +296,7 @@ void CIcqProto::handleXtrazInvitation(DWORD dwUin, char* szMsg, BOOL bThruDC) void CIcqProto::handleXtrazData(DWORD dwUin, char* szMsg, BOOL bThruDC)
{
- MCONTACT hContact = HContactFromUIN(dwUin, NULL);
+ MCONTACT hContact = HContactFromUIN(dwUin, nullptr);
if (hContact) // user sent us xtraz, he supports it
SetContactCapabilities(hContact, CAPF_XTRAZ);
@@ -330,7 +330,7 @@ void CIcqProto::handleXtrazData(DWORD dwUin, char* szMsg, BOOL bThruDC) // Create message to notify user
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.szMessage = szWork;
int bAdded;
@@ -352,7 +352,7 @@ void CIcqProto::handleXtrazData(DWORD dwUin, char* szMsg, BOOL bThruDC) DWORD CIcqProto::SendXtrazNotifyRequest(MCONTACT hContact, char* szQuery, char* szNotify, int bForced)
{
DWORD dwUin;
- if (getContactUid(hContact, &dwUin, NULL))
+ if (getContactUid(hContact, &dwUin, nullptr))
return 0; // Invalid contact
if (!CheckContactCapabilities(hContact, CAPF_XTRAZ) && !bForced)
@@ -385,7 +385,7 @@ void CIcqProto::SendXtrazNotifyResponse(DWORD dwUin, DWORD dwMID, DWORD dwMID2, char *szResBody = MangleXml(szResponse, nResponseLen);
size_t nBodyLen = mir_strlen(szResBody) + 21;
char *szBody = (char*)_alloca(nBodyLen);
- MCONTACT hContact = HContactFromUIN(dwUin, NULL);
+ MCONTACT hContact = HContactFromUIN(dwUin, nullptr);
if (hContact != INVALID_CONTACT_ID && !CheckContactCapabilities(hContact, CAPF_XTRAZ)) {
SAFE_FREE(&szResBody);
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index d2d8a81dd6..372bff14ef 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -97,9 +97,9 @@ INT_PTR CIcqProto::GetInfoSetting(WPARAM hContact, LPARAM lParam) cgs->pValue->pszVal = mir_strdup(dbv.pszVal);
else if (type == DBVT_WCHAR) {
if (dbv.type != DBVT_UTF8) {
- int len = MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, NULL, 0);
+ int len = MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, nullptr, 0);
cgs->pValue->pwszVal = (WCHAR*)mir_alloc((len + 1)*sizeof(WCHAR));
- if (cgs->pValue->pwszVal == NULL)
+ if (cgs->pValue->pwszVal == nullptr)
rc = 1;
else {
MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, cgs->pValue->pwszVal, len);
@@ -107,19 +107,19 @@ INT_PTR CIcqProto::GetInfoSetting(WPARAM hContact, LPARAM lParam) }
}
else {
- char *savePtr = dbv.pszVal ? mir_strcpy((char*)_alloca(mir_strlen(dbv.pszVal) + 1), dbv.pszVal) : NULL;
+ char *savePtr = dbv.pszVal ? mir_strcpy((char*)_alloca(mir_strlen(dbv.pszVal) + 1), dbv.pszVal) : nullptr;
if (!mir_utf8decode(savePtr, &cgs->pValue->pwszVal))
rc = 1;
}
}
else if (type == DBVT_UTF8) {
cgs->pValue->pszVal = mir_utf8encode(dbv.pszVal);
- if (cgs->pValue->pszVal == NULL)
+ if (cgs->pValue->pszVal == nullptr)
rc = 1;
}
else if (type == DBVT_ASCIIZ) {
cgs->pValue->pszVal = mir_strdup(dbv.pszVal);
- mir_utf8decode(cgs->pValue->pszVal, NULL);
+ mir_utf8decode(cgs->pValue->pszVal, nullptr);
}
cgs->pValue->type = type;
@@ -156,14 +156,14 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM) if (!icqOnline() || !wParam)
return 0;
- PBYTE buf = NULL;
+ PBYTE buf = nullptr;
size_t buflen = 0;
// userinfo
ppackTLVWord(&buf, &buflen, 0x1C2, (WORD)GetACP());
if (wParam & CIXT_CONTACT) { // contact information
- BYTE *pBlock = NULL;
+ BYTE *pBlock = nullptr;
size_t cbBlock = 0;
int nItems = 0;
@@ -205,7 +205,7 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM) }
if (wParam & CIXT_WORK) {
- BYTE *pBlock = NULL;
+ BYTE *pBlock = nullptr;
size_t cbBlock = 0;
int nItems = 1;
@@ -227,7 +227,7 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM) }
if (wParam & CIXT_EDUCATION) {
- BYTE *pBlock = NULL;
+ BYTE *pBlock = nullptr;
size_t cbBlock = 0;
int nItems = 1;
@@ -240,7 +240,7 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM) }
if (wParam & CIXT_LOCATION) {
- BYTE *pBlock = NULL;
+ BYTE *pBlock = nullptr;
size_t cbBlock = 0;
int nItems = 1;
@@ -269,7 +269,7 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM) }
if (wParam & CIXT_BACKGROUND) {
- BYTE *pBlock = NULL;
+ BYTE *pBlock = nullptr;
size_t cbBlock = 0;
int nItems = 0;
@@ -410,7 +410,7 @@ INT_PTR CIcqProto::GrantAuthorization(WPARAM wParam, LPARAM) return 0; // Invalid contact
// send without reason, do we need any ?
- icq_sendGrantAuthServ(dwUin, szUid, NULL);
+ icq_sendGrantAuthServ(dwUin, szUid, nullptr);
// auth granted, remove contact menu item
delSetting(wParam, "Grant");
}
@@ -425,7 +425,7 @@ int CIcqProto::OnIdleChanged(WPARAM, LPARAM lParam) if (bPrivacy)
return 0;
- setDword("IdleTS", bIdle ? time(0) : 0);
+ setDword("IdleTS", bIdle ? time(nullptr) : 0);
if (m_bTempVisListEnabled) // remove temporary visible users
sendEntireListServ(ICQ_BOS_FAMILY, ICQ_CLI_REMOVETEMPVISIBLE, BUL_TEMPVISIBLE);
@@ -442,7 +442,7 @@ INT_PTR CIcqProto::RevokeAuthorization(WPARAM wParam, LPARAM) if (getContactUid(wParam, &dwUin, &szUid))
return 0; // Invalid contact
- if (MessageBox(NULL, TranslateT("Are you sure you want to revoke user's authorization?\nThis will remove you from his/her list on some clients."), TranslateT("Confirmation"), MB_ICONQUESTION | MB_YESNO) != IDYES)
+ if (MessageBox(nullptr, TranslateT("Are you sure you want to revoke user's authorization?\nThis will remove you from his/her list on some clients."), TranslateT("Confirmation"), MB_ICONQUESTION | MB_YESNO) != IDYES)
return 0;
icq_sendRevokeAuthServ(dwUin, szUid);
@@ -466,7 +466,7 @@ INT_PTR CIcqProto::SendYouWereAdded(WPARAM, LPARAM lParam) CCSDATA* ccs = (CCSDATA*)lParam;
if (ccs->hContact) {
DWORD dwUin;
- if (getContactUid(ccs->hContact, &dwUin, NULL))
+ if (getContactUid(ccs->hContact, &dwUin, nullptr))
return 1; // Invalid contact
DWORD dwMyUin = getContactUin(NULL);
@@ -498,7 +498,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM, LPARAM lParam) }
wchar_t tszMyFile[MAX_PATH + 1];
- GetFullAvatarFileName(0, NULL, dwPaFormat, tszMyFile, MAX_PATH);
+ GetFullAvatarFileName(0, nullptr, dwPaFormat, tszMyFile, MAX_PATH);
// if not in our storage, copy
if (mir_wstrcmp(tszFile, tszMyFile) && !CopyFile(tszFile, tszMyFile, FALSE)) {
@@ -507,7 +507,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM, LPARAM lParam) }
BYTE *hash = calcMD5HashOfFile(tszMyFile);
- if (hash == NULL)
+ if (hash == nullptr)
return -1;
BYTE ihash[0x14];
@@ -635,7 +635,7 @@ INT_PTR icq_getEventTextMissedMessage(WPARAM pEvent, LPARAM datatype) DBEVENTINFO *dbei = (DBEVENTINFO *)pEvent;
INT_PTR nRetVal = 0;
- char *pszText = NULL;
+ char *pszText = nullptr;
if (dbei->cbBlob > 1) {
switch (((WORD*)dbei->pBlob)[0]) {
@@ -660,7 +660,7 @@ INT_PTR icq_getEventTextMissedMessage(WPARAM pEvent, LPARAM datatype) break;
}
if (datatype == DBVT_WCHAR) {
- int wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pszText, (int)mir_strlen(pszText), NULL, 0);
+ int wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pszText, (int)mir_strlen(pszText), nullptr, 0);
WCHAR *pwszText = (WCHAR*)_alloca((wchars + 1) * sizeof(WCHAR));
pwszText[wchars] = 0;
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index e8ee23bc74..10ea203387 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -101,7 +101,7 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- srand(time(NULL));
+ srand(time(nullptr));
_tzset();
// Register the module
diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp index 4688dbe1c4..c3c73afc4b 100644 --- a/protocols/IcqOscarJ/src/log.cpp +++ b/protocols/IcqOscarJ/src/log.cpp @@ -55,7 +55,7 @@ void __cdecl CIcqProto::icq_LogMessageThread(void* arg) bErrorBoxVisible = TRUE;
if (err->szMsg && err->szTitle)
- MessageBoxUtf(NULL, err->szMsg, err->szTitle, MB_OK);
+ MessageBoxUtf(nullptr, err->szMsg, err->szTitle, MB_OK);
SAFE_FREE((void**)&err->szMsg);
SAFE_FREE((void**)&err);
bErrorBoxVisible = FALSE;
@@ -85,7 +85,7 @@ void CIcqProto::icq_LogUsingErrorCode(int level, DWORD dwError, const char *szMs char str[1024];
char str2[64];
char szErrorMsg[512];
- char *pszErrorMsg = NULL;
+ char *pszErrorMsg = nullptr;
int bNeedFree = FALSE;
switch (dwError) {
@@ -120,7 +120,7 @@ void CIcqProto::icq_LogUsingErrorCode(int level, DWORD dwError, const char *szMs default:
wchar_t err[512];
- if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, err, _countof(err), NULL)) {
+ if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, dwError, 0, err, _countof(err), nullptr)) {
pszErrorMsg = make_utf8_string(err);
bNeedFree = TRUE;
}
diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp index 6b15f2a877..a99e1e6849 100644 --- a/protocols/IcqOscarJ/src/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/loginpassword.cpp @@ -84,5 +84,5 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA void CIcqProto::RequestPassword()
{
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_LOGINPW), NULL, LoginPasswdDlgProc, LPARAM(this));
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_LOGINPW), nullptr, LoginPasswdDlgProc, LPARAM(this));
}
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index b315cbc3b7..d413daecd0 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -60,8 +60,8 @@ char* FindFilePathContainer(const char **files, int iFile, char *szContainer) if (!_strnicmp(files[i], szThisFile, len) && (szThisFile[len] == '\\' || szThisFile[len] == '/')) {
const char *pszLastBackslash;
- if (((pszLastBackslash = strrchr(files[i], '\\')) == NULL) &&
- ((pszLastBackslash = strrchr(files[i], '/')) == NULL)) {
+ if (((pszLastBackslash = strrchr(files[i], '\\')) == nullptr) &&
+ ((pszLastBackslash = strrchr(files[i], '/')) == nullptr)) {
mir_strcpy(szContainer, files[i]);
}
else {
@@ -130,7 +130,7 @@ oscar_filetransfer* CIcqProto::FindOscarTransfer(MCONTACT hContact, DWORD dwID1, }
}
- return NULL;
+ return nullptr;
}
// Release file transfer structure
@@ -155,7 +155,7 @@ void CIcqProto::SafeReleaseFileTransfer(basic_filetransfer **bft) for (int i = 0; i < (int)ift->dwFileCount; i++) {
// szThisFile can be a duplicate of pszFiles[i]
if (ift->szThisFile == ift->pszFiles[i])
- ift->szThisFile = NULL;
+ ift->szThisFile = nullptr;
SAFE_FREE(&ift->pszFiles[i]);
}
SAFE_FREE((void**)&ift->pszFiles);
@@ -269,13 +269,13 @@ oscar_listener* CIcqProto::CreateOscarListener(oscar_filetransfer *ft, NETLIBNEW if (listener) {
listener->ppro = this;
listener->ft = ft;
- if (listener->hBoundPort = NetLib_BindPort(handler, listener, &listener->wPort, NULL))
+ if (listener->hBoundPort = NetLib_BindPort(handler, listener, &listener->wPort, nullptr))
return listener; // Success
SAFE_FREE((void**)&listener);
}
- return NULL; // Failure
+ return nullptr; // Failure
}
@@ -285,7 +285,7 @@ void CIcqProto::ReleaseOscarListener(oscar_listener **pListener) if (listener) { // Close listening port
if (listener->hBoundPort) {
Netlib_CloseHandle(listener->hBoundPort);
- listener->hBoundPort = NULL;
+ listener->hBoundPort = nullptr;
}
NetLog_Direct("Oscar listener on port %d released.", listener->wPort);
@@ -300,7 +300,7 @@ void CIcqProto::ReleaseOscarListener(oscar_listener **pListener) void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwID1, DWORD dwID2, WORD wCommand)
{
- MCONTACT hContact = HContactFromUID(dwUin, szUID, NULL);
+ MCONTACT hContact = HContactFromUID(dwUin, szUID, nullptr);
if (wCommand == 0) { // this is OFT request
oscar_tlv_chain* chain = readIntoTLVChain(&buf, wLen, 0);
@@ -310,8 +310,8 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char * if (wAckType == 1) { // This is first request in this OFT
oscar_filetransfer *ft = CreateOscarTransfer();
- char *pszFileName = NULL;
- char *pszDescription = NULL;
+ char *pszFileName = nullptr;
+ char *pszDescription = nullptr;
debugLogA("This is a file request");
@@ -479,7 +479,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char * PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = mir_utf8decodeW(pszDescription);
pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
@@ -737,7 +737,7 @@ HANDLE CIcqProto::oftInitTransfer(MCONTACT hContact, DWORD dwUin, char* szUid, c // Release transfer
SafeReleaseFileTransfer((basic_filetransfer**)&ft);
- return 0; // Failure
+ return nullptr; // Failure
}
#ifdef __GNUC__
#define OSCAR_MAX_SIZE 0x100000000ULL
@@ -751,7 +751,7 @@ HANDLE CIcqProto::oftInitTransfer(MCONTACT hContact, DWORD dwUin, char* szUid, c // Release transfer
SafeReleaseFileTransfer((basic_filetransfer**)&ft);
- return 0; // Failure
+ return nullptr; // Failure
}
debugLogA("OFT: Found %d files.", ft->wFilesCount);
@@ -799,7 +799,7 @@ HANDLE CIcqProto::oftInitTransfer(MCONTACT hContact, DWORD dwUin, char* szUid, c if (nFirstDirLen) { // got root dir from first container, check if others are only sub-dirs
for (i = 0; i < ft->containerCount; i++) {
if (_strnicmp((char*)ft->file_containers[i], (char*)szFirstDir, nFirstDirLen)) {
- szFirstDir = NULL;
+ szFirstDir = nullptr;
break;
}
}
@@ -838,10 +838,10 @@ HANDLE CIcqProto::oftFileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_ DWORD dwUin;
uid_str szUid;
if (getContactUid(hContact, &dwUin, &szUid))
- return 0; // Invalid contact
+ return nullptr; // Invalid contact
if (!IsValidOscarTransfer(ft))
- return 0; // Invalid transfer
+ return nullptr; // Invalid transfer
ft->szSavePath = make_utf8_string(szPath);
@@ -916,7 +916,7 @@ void CIcqProto::oftFileResume(oscar_filetransfer *ft, int action, const wchar_t {
int openFlags;
- if (ft->connection == NULL)
+ if (ft->connection == nullptr)
return;
oscar_connection *oc = ft->connection;
@@ -1012,7 +1012,7 @@ static void oft_buildProtoFileTransferStatus(oscar_filetransfer* ft, PROTOFILETR if (ft->flags & OFTF_SENDING)
pfts->pszFiles = ft->files_list;
else
- pfts->pszFiles = NULL; /* FIXME */
+ pfts->pszFiles = nullptr; /* FIXME */
pfts->totalFiles = ft->wFilesCount;
pfts->currentFileNumber = ft->iCurrentFile;
pfts->totalBytes = ft->qwTotalSize;
@@ -1154,10 +1154,10 @@ void __cdecl CIcqProto::oft_connectionThread(oscarthreadstartinfo *otsi) nloc.szHost = inet_ntoa(addr);
nloc.wPort = oc.ft->wRemotePort;
nloc.timeout = 8; // 8 secs to connect
- oc.hConnection = NetLib_OpenConnection(m_hDirectNetlibUser, oc.type == OCT_REVERSE ? "Reverse " : NULL, &nloc);
+ oc.hConnection = NetLib_OpenConnection(m_hDirectNetlibUser, oc.type == OCT_REVERSE ? "Reverse " : nullptr, &nloc);
if (!oc.hConnection && addr2.S_un.S_addr) { // first address failed, try second one if available
nloc.szHost = inet_ntoa(addr2);
- oc.hConnection = NetLib_OpenConnection(m_hDirectNetlibUser, oc.type == OCT_REVERSE ? "Reverse " : NULL, &nloc);
+ oc.hConnection = NetLib_OpenConnection(m_hDirectNetlibUser, oc.type == OCT_REVERSE ? "Reverse " : nullptr, &nloc);
}
if (!oc.hConnection) {
if (oc.type == OCT_NORMAL) { // connection failed, try reverse
@@ -1321,7 +1321,7 @@ void __cdecl CIcqProto::oft_connectionThread(oscarthreadstartinfo *otsi) {
mir_cslock l(oftMutex);
if (m_arFileTransfers.indexOf(oc.ft) != -1)
- oc.ft->connection = NULL; // release link
+ oc.ft->connection = nullptr; // release link
}
// Give server some time for abort/cancel to arrive
SleepEx(1000, TRUE);
diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp index 096fde4896..a29d454ce8 100644 --- a/protocols/IcqOscarJ/src/stdpackets.cpp +++ b/protocols/IcqOscarJ/src/stdpackets.cpp @@ -117,7 +117,7 @@ static void packServDCInfo(icq_packet *p, CIcqProto* ppro, BOOL bEmpty) static void packServChannel2Header(icq_packet *p, CIcqProto* ppro, DWORD dwUin, size_t wLen, DWORD dwID1, DWORD dwID2, DWORD dwCookie, WORD wVersion, BYTE bMsgType, BYTE bMsgFlags, WORD wPriority, int isAck, int includeDcInfo, BYTE bRequestServerAck)
{
- packServMsgSendHeader(p, dwCookie, dwID1, dwID2, dwUin, NULL, 0x0002, wLen + 95 + (bRequestServerAck ? 4 : 0) + (includeDcInfo ? 14 : 0));
+ packServMsgSendHeader(p, dwCookie, dwID1, dwID2, dwUin, nullptr, 0x0002, wLen + 95 + (bRequestServerAck ? 4 : 0) + (includeDcInfo ? 14 : 0));
packWord(p, 0x05); // TLV type
packWord(p, WORD(wLen + 91 + (includeDcInfo ? 14 : 0))); /* TLV len */
@@ -236,9 +236,9 @@ void CIcqProto::icq_setidle(int bAllow) void CIcqProto::icq_setstatus(WORD wStatus, const char *szStatusNote)
{
- char *szCurrentStatusNote = szStatusNote ? getSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, NULL) : NULL;
+ char *szCurrentStatusNote = szStatusNote ? getSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, nullptr) : nullptr;
size_t wStatusMoodLen = 0, wStatusNoteLen = 0, wSessionDataLen = 0;
- char *szMoodData = NULL;
+ char *szMoodData = nullptr;
if (szStatusNote && mir_strcmp(szCurrentStatusNote, szStatusNote)) { // status note was changed, update now
DBVARIANT dbv = { DBVT_DELETED };
@@ -427,7 +427,7 @@ DWORD CIcqProto::icq_SendChannel4Message(DWORD dwUin, MCONTACT hContact, BYTE bM // Pack the standard header
icq_packet packet;
- packServMsgSendHeader(&packet, dwCookie, pCookieData->dwMsgID1, pCookieData->dwMsgID2, dwUin, NULL, 4, wPacketLength + wMsgLen);
+ packServMsgSendHeader(&packet, dwCookie, pCookieData->dwMsgID1, pCookieData->dwMsgID2, dwUin, nullptr, 4, wPacketLength + wMsgLen);
// Pack first TLV
packWord(&packet, 0x05); // TLV(5)
@@ -477,7 +477,7 @@ void CIcqProto::sendOwnerInfoRequest(void) packDWord(&packet, 0x01);
packWord(&packet, wDataLen);
- packTLVUID(&packet, 0x32, m_dwLocalUIN, NULL);
+ packTLVUID(&packet, 0x32, m_dwLocalUIN, nullptr);
}
sendServPacket(&packet);
@@ -508,7 +508,7 @@ DWORD CIcqProto::icq_sendGetInfoServ(MCONTACT hContact, DWORD dwUin, int bManual return 0;
DBVARIANT infoToken = { DBVT_DELETED };
- BYTE *pToken = NULL;
+ BYTE *pToken = nullptr;
WORD cbToken = 0;
if (!getSetting(hContact, DBSETTING_METAINFO_TOKEN, &infoToken)) { // retrieve user details using privacy token
@@ -546,7 +546,7 @@ DWORD CIcqProto::icq_sendGetInfoServ(MCONTACT hContact, DWORD dwUin, int bManual packWord(&packet, wDataLen);
if (pToken)
packTLV(&packet, 0x3C, cbToken, pToken);
- packTLVUID(&packet, 0x32, dwUin, NULL);
+ packTLVUID(&packet, 0x32, dwUin, nullptr);
sendServPacket(&packet);
@@ -689,7 +689,7 @@ void CIcqProto::icq_sendSetAimAwayMsgServ(const char *szMsg) serverPacketInit(&packet, 19);
packFNACHeader(&packet, ICQ_LOCATION_FAMILY, ICQ_LOCATION_SET_USER_INFO, 0, dwCookie);
packTLV(&packet, 0x0f, 1, (LPBYTE)"\x02");
- packTLV(&packet, 0x04, 0, NULL);
+ packTLV(&packet, 0x04, 0, nullptr);
}
sendServPacket(&packet);
@@ -697,7 +697,7 @@ void CIcqProto::icq_sendSetAimAwayMsgServ(const char *szMsg) void CIcqProto::icq_sendFileSendServv7(filetransfer* ft, const char *szFiles)
{
- char *szFilesAnsi = NULL, *szDescrAnsi = NULL;
+ char *szFilesAnsi = nullptr, *szDescrAnsi = nullptr;
if (!utf8_decode(szFiles, &szFilesAnsi))
szFilesAnsi = _strdup(szFiles); // Legacy fix
@@ -728,7 +728,7 @@ void CIcqProto::icq_sendFileSendServv7(filetransfer* ft, const char *szFiles) void CIcqProto::icq_sendFileSendServv8(filetransfer* ft, const char *szFiles, int nAckType)
{
icq_packet packet;
- char *szFilesAnsi = NULL, *szDescrAnsi = NULL;
+ char *szFilesAnsi = nullptr, *szDescrAnsi = nullptr;
if (!utf8_decode(szFiles, &szFilesAnsi))
szFilesAnsi = _strdup(szFiles); // Legacy fix
@@ -742,7 +742,7 @@ void CIcqProto::icq_sendFileSendServv8(filetransfer* ft, const char *szFiles, in // 202 + UIN len + file description (no null) + file name (null included)
// Packet size = Flap length + 4
size_t wFlapLen = 178 + wDescrLen + wFilesLen + (nAckType == ACKTYPE_SERVER ? 4 : 0);
- packServMsgSendHeader(&packet, ft->dwCookie, ft->pMessage.dwMsgID1, ft->pMessage.dwMsgID2, ft->dwUin, NULL, 2, wFlapLen);
+ packServMsgSendHeader(&packet, ft->dwCookie, ft->pMessage.dwMsgID1, ft->pMessage.dwMsgID2, ft->dwUin, nullptr, 2, wFlapLen);
// TLV(5) header
packServTLV5HeaderMsg(&packet, 138 + wDescrLen + wFilesLen, ft->pMessage.dwMsgID1, ft->pMessage.dwMsgID2, 1);
@@ -783,7 +783,7 @@ void CIcqProto::icq_sendFileSendServv8(filetransfer* ft, const char *szFiles, in void CIcqProto::icq_sendFileAcceptServv8(DWORD dwUin, DWORD TS1, DWORD TS2, DWORD dwCookie, const char *szFiles, const char *szDescr, DWORD dwTotalSize, WORD wPort, BOOL accepted, int nAckType)
{
icq_packet packet;
- char *szFilesAnsi = NULL, *szDescrAnsi = NULL;
+ char *szFilesAnsi = nullptr, *szDescrAnsi = nullptr;
/* if !accepted, szDescr == szReason, szFiles = "" */
@@ -801,7 +801,7 @@ void CIcqProto::icq_sendFileAcceptServv8(DWORD dwUin, DWORD TS1, DWORD TS2, DWOR // 202 + UIN len + file description (no null) + file name (null included)
// Packet size = Flap length + 4
size_t wFlapLen = 178 + wDescrLen + wFilesLen + (nAckType == ACKTYPE_SERVER ? 4 : 0);
- packServMsgSendHeader(&packet, dwCookie, TS1, TS2, dwUin, NULL, 2, wFlapLen);
+ packServMsgSendHeader(&packet, dwCookie, TS1, TS2, dwUin, nullptr, 2, wFlapLen);
// TLV(5) header
packServTLV5HeaderMsg(&packet, 138 + wDescrLen + wFilesLen, TS1, TS2, 2);
@@ -842,7 +842,7 @@ void CIcqProto::icq_sendFileAcceptServv8(DWORD dwUin, DWORD TS1, DWORD TS2, DWOR void CIcqProto::icq_sendFileAcceptServv7(DWORD dwUin, DWORD TS1, DWORD TS2, DWORD dwCookie, const char* szFiles, const char* szDescr, DWORD dwTotalSize, WORD wPort, BOOL accepted, int nAckType)
{
icq_packet packet;
- char *szFilesAnsi = NULL, *szDescrAnsi = NULL;
+ char *szFilesAnsi = nullptr, *szDescrAnsi = nullptr;
/* if !accepted, szDescr == szReason, szFiles = "" */
@@ -860,7 +860,7 @@ void CIcqProto::icq_sendFileAcceptServv7(DWORD dwUin, DWORD TS1, DWORD TS2, DWOR // 150 + UIN len + file description (with null) + file name (2 nulls)
// Packet size = Flap length + 4
size_t wFlapLen = 127 + wDescrLen + 1 + wFilesLen + (nAckType == ACKTYPE_SERVER ? 4 : 0);
- packServMsgSendHeader(&packet, dwCookie, TS1, TS2, dwUin, NULL, 2, wFlapLen);
+ packServMsgSendHeader(&packet, dwCookie, TS1, TS2, dwUin, nullptr, 2, wFlapLen);
// TLV(5) header
packServTLV5HeaderMsg(&packet, 88 + wDescrLen + wFilesLen, TS1, TS2, 2);
@@ -922,7 +922,7 @@ void CIcqProto::icq_sendFileDenyServ(DWORD dwUin, filetransfer *ft, const char * void CIcqProto::icq_sendAwayMsgReplyServ(DWORD dwUin, DWORD dwMsgID1, DWORD dwMsgID2, WORD wCookie, WORD wVersion, BYTE msgType, char** szMsg)
{
- MCONTACT hContact = HContactFromUIN(dwUin, NULL);
+ MCONTACT hContact = HContactFromUIN(dwUin, nullptr);
if (validateStatusMessageRequest(hContact, msgType)) {
NotifyEventHooks(m_modeMsgsEvent, (WPARAM)msgType, (LPARAM)dwUin);
@@ -930,7 +930,7 @@ void CIcqProto::icq_sendAwayMsgReplyServ(DWORD dwUin, DWORD dwMsgID1, DWORD dwMs mir_cslock l(m_modeMsgsMutex);
if (szMsg && *szMsg) {
- char *pszMsg = NULL;
+ char *pszMsg = nullptr;
WORD wReplyVersion = ICQ_VERSION;
if (wVersion >= 9) {
@@ -951,7 +951,7 @@ void CIcqProto::icq_sendAwayMsgReplyServ(DWORD dwUin, DWORD dwMsgID1, DWORD dwMs wMsgLen = MAX_MESSAGESNACSIZE;
icq_packet packet;
- packServAdvancedMsgReply(&packet, dwUin, NULL, dwMsgID1, dwMsgID2, wCookie, wReplyVersion, msgType, 3, wMsgLen + 3);
+ packServAdvancedMsgReply(&packet, dwUin, nullptr, dwMsgID1, dwMsgID2, wCookie, wReplyVersion, msgType, 3, wMsgLen + 3);
packLEWord(&packet, WORD(wMsgLen + 1));
packBuffer(&packet, (LPBYTE)pszMsg, wMsgLen);
packByte(&packet, 0);
@@ -964,7 +964,7 @@ void CIcqProto::icq_sendAwayMsgReplyServ(DWORD dwUin, DWORD dwMsgID1, DWORD dwMs void CIcqProto::icq_sendAwayMsgReplyServExt(DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wCookie, WORD wVersion, BYTE msgType, char **szMsg)
{
- MCONTACT hContact = HContactFromUID(dwUin, szUID, NULL);
+ MCONTACT hContact = HContactFromUID(dwUin, szUID, nullptr);
if (validateStatusMessageRequest(hContact, msgType)) {
NotifyEventHooks(m_modeMsgsEvent, (WPARAM)msgType, (LPARAM)dwUin);
@@ -972,7 +972,7 @@ void CIcqProto::icq_sendAwayMsgReplyServExt(DWORD dwUin, char *szUID, DWORD dwMs mir_cslock l(m_modeMsgsMutex);
if (szMsg && *szMsg) {
- char *pszMsg = NULL;
+ char *pszMsg = nullptr;
WORD wReplyVersion = ICQ_VERSION;
if (wVersion >= 9)
@@ -1021,7 +1021,7 @@ void CIcqProto::icq_sendAwayMsgReplyServExt(DWORD dwUin, char *szUID, DWORD dwMs void CIcqProto::icq_sendAdvancedMsgAck(DWORD dwUin, DWORD dwTimestamp, DWORD dwTimestamp2, WORD wCookie, BYTE bMsgType, BYTE bMsgFlags)
{
icq_packet packet;
- packServAdvancedMsgReply(&packet, dwUin, NULL, dwTimestamp, dwTimestamp2, wCookie, ICQ_VERSION, bMsgType, bMsgFlags, 11);
+ packServAdvancedMsgReply(&packet, dwUin, nullptr, dwTimestamp, dwTimestamp2, wCookie, ICQ_VERSION, bMsgType, bMsgFlags, 11);
packEmptyMsg(&packet); // Status message
packMsgColorInfo(&packet);
@@ -1073,7 +1073,7 @@ DWORD CIcqProto::SearchByUin(DWORD dwUin) pBuffer.wLen = wInfoLen;
// Initialize our handy data buffer
- packTLVUID(&pBuffer, 0x32, dwUin, NULL);
+ packTLVUID(&pBuffer, 0x32, dwUin, nullptr);
// Send it off for further packing
return sendDirectorySearchPacket(pBuffer.pData, wInfoLen, 0, FALSE);
@@ -1088,15 +1088,15 @@ DWORD CIcqProto::SearchByNames(const char *pszNick, const char *pszFirstName, co if (m_bLegacyFix) {
// Legacy protocol uses ANSI-string searches
- char* pszNickAnsi = NULL;
+ char* pszNickAnsi = nullptr;
if (!utf8_decode(pszNick, &pszNickAnsi))
pszNickAnsi = _strdup(pszNick);
- char* pszFirstNameAnsi = NULL;
+ char* pszFirstNameAnsi = nullptr;
if (!utf8_decode(pszFirstName, &pszFirstNameAnsi))
pszFirstNameAnsi = _strdup(pszFirstName);
- char* pszLastNameAnsi = NULL;
+ char* pszLastNameAnsi = nullptr;
if (!utf8_decode(pszLastName, &pszLastNameAnsi))
pszLastNameAnsi = _strdup(pszLastName);
@@ -1202,7 +1202,7 @@ DWORD CIcqProto::sendDirectorySearchPacket(const BYTE *pSearchData, size_t wData _ASSERTE(wDataLen >= 4);
cookie_directory_data *pCookieData = (cookie_directory_data*)SAFE_MALLOC(sizeof(cookie_directory_data));
- if (pCookieData == NULL)
+ if (pCookieData == nullptr)
return 0;
pCookieData->bRequestType = DIRECTORYREQUEST_SEARCH;
@@ -1264,7 +1264,7 @@ DWORD CIcqProto::sendTLVSearchPacket(BYTE bType, char* pSearchDataBuf, WORD wSea DWORD CIcqProto::icq_sendAdvancedSearchServ(BYTE* fieldsBuffer, size_t bufferLen)
{
cookie_search *pCookie = (cookie_search*)SAFE_MALLOC(sizeof(cookie_search));
- if (pCookie == 0)
+ if (pCookie == nullptr)
return 0;
pCookie->bSearchType = SEARCHTYPE_DETAILS;
@@ -1281,7 +1281,7 @@ DWORD CIcqProto::icq_sendAdvancedSearchServ(BYTE* fieldsBuffer, size_t bufferLen DWORD CIcqProto::icq_searchAimByEmail(const char* pszEmail, DWORD dwSearchId)
{
cookie_search *pCookie;
- if (!FindCookie(dwSearchId, NULL, (void**)&pCookie)) {
+ if (!FindCookie(dwSearchId, nullptr, (void**)&pCookie)) {
dwSearchId = 0;
pCookie = (cookie_search*)SAFE_MALLOC(sizeof(cookie_search));
pCookie->bSearchType = SEARCHTYPE_EMAIL;
@@ -1340,9 +1340,9 @@ DWORD CIcqProto::icq_sendSMSServ(const char *szPhoneNumber, const char *szMsg) {
DWORD dwCookie;
WORD wBufferLen;
- char *szBuffer = NULL;
+ char *szBuffer = nullptr;
char szTime[30];
- time_t now = time(NULL);
+ time_t now = time(nullptr);
strftime(szTime, sizeof(szTime), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&now));
/* Sun, 00 Jan 0000 00:00:00 GMT */
@@ -1571,11 +1571,11 @@ void CIcqProto::icq_sendAuthResponseServ(DWORD dwUin, char* szUid, int auth, con void CIcqProto::icq_sendYouWereAddedServ(DWORD dwUin, DWORD dwMyUin)
{
- DWORD dwID1 = time(NULL);
+ DWORD dwID1 = time(nullptr);
DWORD dwID2 = RandRange(0, 0x00FF);
icq_packet packet;
- packServMsgSendHeader(&packet, 0, dwID1, dwID2, dwUin, NULL, 0x0004, 17);
+ packServMsgSendHeader(&packet, 0, dwID1, dwID2, dwUin, nullptr, 0x0004, 17);
packWord(&packet, 0x0005); // TLV(5)
packWord(&packet, 0x0009);
packLEDWord(&packet, dwMyUin);
@@ -1591,7 +1591,7 @@ void CIcqProto::icq_sendXtrazRequestServ(DWORD dwUin, DWORD dwCookie, char* szBo size_t wCoreLen = 11 + getPluginTypeIdLen(pCookieData->bMessageType) + nBodyLen;
icq_packet packet;
- packServMsgSendHeader(&packet, dwCookie, pCookieData->dwMsgID1, pCookieData->dwMsgID2, dwUin, NULL, 2, 99 + wCoreLen);
+ packServMsgSendHeader(&packet, dwCookie, pCookieData->dwMsgID1, pCookieData->dwMsgID2, dwUin, nullptr, 2, 99 + wCoreLen);
// TLV(5) header
packServTLV5HeaderMsg(&packet, 55 + wCoreLen, pCookieData->dwMsgID1, pCookieData->dwMsgID2, 1);
@@ -1617,7 +1617,7 @@ void CIcqProto::icq_sendXtrazRequestServ(DWORD dwUin, DWORD dwCookie, char* szBo void CIcqProto::icq_sendXtrazResponseServ(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szBody, size_t nBodyLen, int nType)
{
icq_packet packet;
- packServAdvancedMsgReply(&packet, dwUin, NULL, dwMID, dwMID2, wCookie, ICQ_VERSION, MTYPE_PLUGIN, 0, getPluginTypeIdLen(nType) + 11 + nBodyLen);
+ packServAdvancedMsgReply(&packet, dwUin, nullptr, dwMID, dwMID2, wCookie, ICQ_VERSION, MTYPE_PLUGIN, 0, getPluginTypeIdLen(nType) + 11 + nBodyLen);
packEmptyMsg(&packet);
@@ -1634,7 +1634,7 @@ void CIcqProto::icq_sendXtrazResponseServ(DWORD dwUin, DWORD dwMID, DWORD dwMID2 void CIcqProto::icq_sendReverseReq(directconnect *dc, DWORD dwCookie, cookie_message_data *pCookie)
{
icq_packet packet;
- packServMsgSendHeader(&packet, dwCookie, pCookie->dwMsgID1, pCookie->dwMsgID2, dc->dwRemoteUin, NULL, 2, 0x47);
+ packServMsgSendHeader(&packet, dwCookie, pCookie->dwMsgID1, pCookie->dwMsgID2, dc->dwRemoteUin, nullptr, 2, 0x47);
packServTLV5HeaderBasic(&packet, 0x29, pCookie->dwMsgID1, pCookie->dwMsgID2, 0, MCAP_REVERSE_DC_REQ);
diff --git a/protocols/IcqOscarJ/src/tlv.cpp b/protocols/IcqOscarJ/src/tlv.cpp index f79e4ee9ea..ad14045898 100644 --- a/protocols/IcqOscarJ/src/tlv.cpp +++ b/protocols/IcqOscarJ/src/tlv.cpp @@ -32,11 +32,11 @@ /* set maxTlvs<=0 to get all TLVs in length, or a positive integer to get at most the first n */
oscar_tlv_chain* readIntoTLVChain(BYTE **buf, size_t wLen, int maxTlvs)
{
- oscar_tlv_chain *now, *last = NULL, *chain = NULL;
+ oscar_tlv_chain *now, *last = nullptr, *chain = nullptr;
WORD now_tlv_len;
if (!buf || !wLen)
- return NULL;
+ return nullptr;
intptr_t len = wLen;
while (len > 0) { /* don't use unsigned variable for this check */
@@ -44,7 +44,7 @@ oscar_tlv_chain* readIntoTLVChain(BYTE **buf, size_t wLen, int maxTlvs) if (!now) {
disposeChain(&chain);
- return NULL;
+ return nullptr;
}
unpackWord(buf, &(now->tlv.wType));
@@ -53,7 +53,7 @@ oscar_tlv_chain* readIntoTLVChain(BYTE **buf, size_t wLen, int maxTlvs) len -= 4;
if (now_tlv_len < 1)
- now->tlv.pData = NULL;
+ now->tlv.pData = nullptr;
else if (now_tlv_len <= len) {
now->tlv.pData = (BYTE *)SAFE_MALLOC(now_tlv_len);
if (now->tlv.pData)
@@ -98,7 +98,7 @@ oscar_tlv* oscar_tlv_chain::getTLV(WORD wType, WORD wIndex) list = list->next;
}
- return NULL;
+ return nullptr;
}
WORD oscar_tlv_chain::getChainLength()
@@ -141,7 +141,7 @@ oscar_tlv* oscar_tlv_chain::putTLV(WORD wType, size_t wLen, BYTE *pData, BOOL bR oscar_tlv_chain* oscar_tlv_chain::removeTLV(oscar_tlv *pTLV)
{
- oscar_tlv_chain *list = this, *prev = NULL, *chain = this;
+ oscar_tlv_chain *list = this, *prev = nullptr, *chain = this;
while (list) {
if (&list->tlv == pTLV) {
if (prev) // relink
@@ -151,7 +151,7 @@ oscar_tlv_chain* oscar_tlv_chain::removeTLV(oscar_tlv *pTLV) list = list->next;
}
else // result is an empty chain (NULL)
- chain = NULL;
+ chain = nullptr;
// release chain item memory
SAFE_FREE((void**)&list->tlv.pData);
SAFE_FREE((void**)&list);
@@ -249,14 +249,14 @@ char* oscar_tlv_chain::getString(WORD wType, WORD wIndex) if (pTLV) {
char *str = (char*)SAFE_MALLOC(pTLV->wLen + 1); /* For \0 */
if (!str)
- return NULL;
+ return nullptr;
memcpy(str, pTLV->pData, pTLV->wLen);
str[pTLV->wLen] = '\0';
return str;
}
- return NULL;
+ return nullptr;
}
void disposeChain(oscar_tlv_chain **chain)
@@ -273,12 +273,12 @@ void disposeChain(oscar_tlv_chain **chain) now = next;
}
- *chain = NULL;
+ *chain = nullptr;
}
oscar_tlv_record_list* readIntoTLVRecordList(BYTE **buf, size_t wLen, int nCount)
{
- oscar_tlv_record_list *list = NULL, *last = NULL;
+ oscar_tlv_record_list *list = nullptr, *last = nullptr;
while (wLen >= 2) {
WORD wRecordSize;
@@ -325,7 +325,7 @@ void disposeRecordList(oscar_tlv_record_list** list) now = next;
}
- *list = NULL;
+ *list = nullptr;
}
oscar_tlv_chain* oscar_tlv_record_list::getRecordByTLV(WORD wType, int nValue)
@@ -337,5 +337,5 @@ oscar_tlv_chain* oscar_tlv_record_list::getRecordByTLV(WORD wType, int nValue) list = list->next;
}
- return NULL;
+ return nullptr;
}
diff --git a/protocols/IcqOscarJ/src/upload.cpp b/protocols/IcqOscarJ/src/upload.cpp index 00edab4095..f714c9cecc 100644 --- a/protocols/IcqOscarJ/src/upload.cpp +++ b/protocols/IcqOscarJ/src/upload.cpp @@ -40,7 +40,7 @@ int CIcqProto::StringToListItemId(const char *szSetting,int def) FieldNamesItem *list = (FieldNamesItem*)setting[i].pList;
- char *szValue = getSettingStringUtf(NULL, szSetting, NULL);
+ char *szValue = getSettingStringUtf(NULL, szSetting, nullptr);
if (!szValue)
return def;
diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp index 1e25d1215e..67ef1ec9ef 100644 --- a/protocols/IcqOscarJ/src/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/userinfotab.cpp @@ -45,7 +45,7 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac {
DBVARIANT dbv = { 0 };
char str[MAX_PATH];
- char* pstr = NULL;
+ char* pstr = nullptr;
int unspecified = 0;
int bUtf = 0, bDbv = 0, bAlloc = 0;
@@ -73,7 +73,7 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac }
}
else {
- if (szModule == NULL)
+ if (szModule == nullptr)
unspecified = 1;
else {
unspecified = db_get(hContact, szModule, szSetting, &dbv);
@@ -110,8 +110,8 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac BYTE bXStatus = ppro->getContactXStatus(hContact);
if (bXStatus) {
- char *pXName = ppro->getSettingStringUtf(hContact, DBSETTING_XSTATUS_NAME, NULL);
- if (pXName == NULL) // give default name
+ char *pXName = ppro->getSettingStringUtf(hContact, DBSETTING_XSTATUS_NAME, nullptr);
+ if (pXName == nullptr) // give default name
pXName = ICQTranslateUtf(nameXStatus[bXStatus - 1]);
mir_snprintf(str, "%s (%s)", pszStatus, pXName);
@@ -153,7 +153,7 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac case DBVT_WCHAR:
unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
if (!unspecified && pstr != szSetting) {
- pstr = ppro->getSettingStringUtf(hContact, szModule, szSetting, NULL);
+ pstr = ppro->getSettingStringUtf(hContact, szModule, szSetting, nullptr);
bUtf = 1;
bAlloc = 1;
}
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 9b5c097550..af26203a66 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -33,10 +33,10 @@ struct gateway_index static mir_cs gatewayMutex;
-static gateway_index *gateways = NULL;
+static gateway_index *gateways = nullptr;
static int gatewayCount = 0;
-static DWORD *spammerList = NULL;
+static DWORD *spammerList = nullptr;
static int spammerListCount = 0;
@@ -232,7 +232,7 @@ char** CIcqProto::MirandaStatusToAwayMsg(int nStatus) return &m_modeMsgs.szFfc;
default:
- return NULL;
+ return nullptr;
}
}
@@ -421,7 +421,7 @@ MCONTACT CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) if (Added)
*Added = 0;
- MCONTACT hContact = HandleFromCacheByUid(dwUin, NULL);
+ MCONTACT hContact = HandleFromCacheByUid(dwUin, nullptr);
if (hContact)
return hContact;
@@ -431,7 +431,7 @@ MCONTACT CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) dwContactUin = getContactUin(hContact);
if (dwContactUin == dwUin) {
- AddToContactsCache(hContact, dwUin, NULL);
+ AddToContactsCache(hContact, dwUin, nullptr);
return hContact;
}
@@ -466,9 +466,9 @@ MCONTACT CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) icq_QueueUser(hContact);
if (icqOnline())
- icq_sendNewContact(dwUin, NULL);
+ icq_sendNewContact(dwUin, nullptr);
}
- AddToContactsCache(hContact, dwUin, NULL);
+ AddToContactsCache(hContact, dwUin, nullptr);
*Added = 1;
debugLogA("ICQ contact %u created ok", dwUin);
return hContact;
@@ -583,7 +583,7 @@ char* __fastcall strstrnull(const char *str, const char *substr) if (str)
return (char*)strstr(str, substr);
- return NULL;
+ return nullptr;
}
char* __fastcall null_strdup(const char *string)
@@ -591,7 +591,7 @@ char* __fastcall null_strdup(const char *string) if (string)
return _strdup(string);
- return NULL;
+ return nullptr;
}
@@ -600,14 +600,14 @@ WCHAR* __fastcall null_strdup(const WCHAR *string) if (string)
return wcsdup(string);
- return NULL;
+ return nullptr;
}
char* __fastcall null_strcpy(char *dest, const char *src, size_t maxlen)
{
if (!dest)
- return NULL;
+ return nullptr;
if (src && src[0]) {
strncpy(dest, src, maxlen);
@@ -623,7 +623,7 @@ char* __fastcall null_strcpy(char *dest, const char *src, size_t maxlen) WCHAR* __fastcall null_strcpy(WCHAR *dest, const WCHAR *src, size_t maxlen)
{
if (!dest)
- return NULL;
+ return nullptr;
if (src && src[0]) {
wcsncpy(dest, src, maxlen);
@@ -802,7 +802,7 @@ char* ApplyEncoding(const char *string, const char *pszEncoding) if (string) // consider it CP_ACP
return ansi_to_utf8(string);
- return NULL;
+ return nullptr;
}
void CIcqProto::ResetSettingsOnListReload()
@@ -973,7 +973,7 @@ int CIcqProto::IsMetaInfoChanged(MCONTACT hContact) db_free(&infoSaved);
- if ((time(NULL) - dwInfoTime) > 14 * 3600 * 24) {
+ if ((time(nullptr) - dwInfoTime) > 14 * 3600 * 24) {
res = 3; // threshold exceeded
}
}
@@ -1015,7 +1015,7 @@ void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay) }
rlck.unlock();
- BYTE *pBuffer = NULL;
+ BYTE *pBuffer = nullptr;
size_t cbBuffer = 0;
ppackTLV(&pBuffer, &cbBuffer, 0x226, mir_strlen(setStatusNoteText), (BYTE*)setStatusNoteText);
@@ -1047,8 +1047,8 @@ void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay) rlck.unlock();
// check if the session data were not updated already
- char *szCurrentStatusNote = getSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, NULL);
- char *szCurrentStatusMood = NULL;
+ char *szCurrentStatusNote = getSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, nullptr);
+ char *szCurrentStatusMood = nullptr;
DBVARIANT dbv = { DBVT_DELETED };
if (m_bMoodsEnabled && !getString(DBSETTING_STATUS_MOOD, &dbv))
@@ -1111,7 +1111,7 @@ int CIcqProto::SetStatusNote(const char *szStatusNote, DWORD dwDelay, int bForce mir_cslock l(cookieMutex);
if (!setStatusNoteText && (!m_bMoodsEnabled || !setStatusMoodData)) { // check if the status note was changed and if yes, create thread to change it
- char *szCurrentStatusNote = getSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, NULL);
+ char *szCurrentStatusNote = getSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, nullptr);
if (mir_strcmp(szCurrentStatusNote, szStatusNote)) { // status note was changed
// create thread to change status note on existing server connection
@@ -1120,7 +1120,7 @@ int CIcqProto::SetStatusNote(const char *szStatusNote, DWORD dwDelay, int bForce if (dwDelay)
ForkThread(&CIcqProto::SetStatusNoteThread, (void*)dwDelay);
else // we cannot afford any delay, so do not run in separate thread
- SetStatusNoteThread(NULL);
+ SetStatusNoteThread(nullptr);
bChanged = TRUE;
}
@@ -1147,7 +1147,7 @@ int CIcqProto::SetStatusMood(const char *szMoodData, DWORD dwDelay) mir_cslock l(cookieMutex);
if (!setStatusNoteText && !setStatusMoodData) { // check if the status mood was changed and if yes, create thread to change it
- char *szCurrentStatusMood = NULL;
+ char *szCurrentStatusMood = nullptr;
DBVARIANT dbv = { DBVT_DELETED };
if (!getString(DBSETTING_STATUS_MOOD, &dbv))
@@ -1159,7 +1159,7 @@ int CIcqProto::SetStatusMood(const char *szMoodData, DWORD dwDelay) if (dwDelay)
ForkThread(&CIcqProto::SetStatusNoteThread, (void*)dwDelay);
else // we cannot afford any delay, so do not run in separate thread
- SetStatusNoteThread(NULL);
+ SetStatusNoteThread(nullptr);
bChanged = TRUE;
}
@@ -1321,13 +1321,13 @@ void __fastcall SAFE_FREE(void** p) {
if (*p) {
free(*p);
- *p = NULL;
+ *p = nullptr;
}
}
void* __fastcall SAFE_MALLOC(size_t size)
{
- void* p = NULL;
+ void* p = nullptr;
if (size) {
p = malloc(size);
@@ -1388,7 +1388,7 @@ void NetLib_CloseConnection(HNETLIBCONN *hConnection, int bServerConn) {
if (*hConnection) {
Netlib_CloseHandle(*hConnection);
- *hConnection = NULL;
+ *hConnection = nullptr;
if (bServerConn)
FreeGatewayIndex(*hConnection);
@@ -1400,7 +1400,7 @@ void NetLib_SafeCloseHandle(HANDLE *hConnection) {
if (*hConnection) {
Netlib_CloseHandle(*hConnection);
- *hConnection = NULL;
+ *hConnection = nullptr;
}
}
@@ -1430,7 +1430,7 @@ int CIcqProto::NetLog_Uni(BOOL bDC, const char *fmt, ...) char* __fastcall ICQTranslateUtf(const char *src)
{ // this takes UTF-8 strings only!!!
- char *szRes = NULL;
+ char *szRes = nullptr;
if (!mir_strlen(src)) { // for the case of empty strings
return null_strdup(src);
@@ -1467,7 +1467,7 @@ char* CIcqProto::GetUserStoredPassword(char *szBuffer, size_t cbSize) if (mir_strlen(szBuffer))
return szBuffer;
- return NULL;
+ return nullptr;
}
@@ -1481,7 +1481,7 @@ char* CIcqProto::GetUserPassword(BOOL bAlways) return m_szPassword;
}
- return NULL;
+ return nullptr;
}
@@ -1530,7 +1530,7 @@ const char* ExtractFileName(const char *fullname) const char *szFileName;
// already is only filename
- if (((szFileName = strrchr(fullname, '\\')) == NULL) && ((szFileName = strrchr(fullname, '/')) == NULL))
+ if (((szFileName = strrchr(fullname, '\\')) == nullptr) && ((szFileName = strrchr(fullname, '/')) == nullptr))
return fullname;
return szFileName + 1; // skip backslash
@@ -1539,7 +1539,7 @@ const char* ExtractFileName(const char *fullname) char* FileNameToUtf(const wchar_t *filename)
{
- WCHAR *usFileName = NULL;
+ WCHAR *usFileName = nullptr;
int wchars = GetLongPathName(filename, usFileName, 0);
usFileName = (WCHAR*)_alloca((wchars + 1) * sizeof(WCHAR));
GetLongPathName(filename, usFileName, wchars);
@@ -1702,11 +1702,11 @@ int MessageBoxUtf(HWND hWnd, const char *szText, const char *szCaption, UINT uTy char* CIcqProto::ConvertMsgToUserSpecificAnsi(MCONTACT hContact, const char* szMsg)
{ // this takes utf-8 encoded message
WORD wCP = getWord(hContact, "CodePage", m_wAnsiCodepage);
- char* szAnsi = NULL;
+ char* szAnsi = nullptr;
if (wCP != CP_ACP) // convert to proper codepage
if (!utf8_decode_codepage(szMsg, &szAnsi, wCP))
- return NULL;
+ return nullptr;
return szAnsi;
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 6a887eadf0..252d82ee82 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(0);
+ gce.time = time(nullptr);
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(0);
+ gce.time = time(nullptr);
}
switch (gce.iType = action) {
@@ -1137,7 +1137,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if ((GetTickCount() - dwLastBanKickTime) > BAN_KICK_INTERVAL) {
wchar_t *resourceName_copy = NEWWSTR_ALLOCA(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds
- wchar_t *szInviteTo = 0;
+ wchar_t *szInviteTo = nullptr;
int idx = gch->dwData - IDM_LINK0;
LISTFOREACH(i, ppro, LIST_CHATROOM)
{
@@ -1382,7 +1382,7 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) if (m_bJabberOnline) {
wchar_t tszID[100];
- int64_t id = (_time64(0) << 16) + (GetTickCount() & 0xFFFF);
+ int64_t id = (_time64(nullptr) << 16) + (GetTickCount() & 0xFFFF);
wchar_t *buf = NEWWSTR_ALLOCA(gch->ptszText);
Chat_UnescapeTags(buf);
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index c6646f52c7..3173d6757a 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -85,7 +85,7 @@ void CJabberProto::OnConsoleProcessXml(HXML node, DWORD flags) if (node && m_pDlgConsole) {
if (XmlGetName(node)) {
if (FilterXml(node, flags)) {
- StringBuf buf = {0};
+ StringBuf buf = {};
sttAppendBufRaw(&buf, RTF_HEADER);
sttRtfAppendXml(&buf, node, flags, 1);
sttAppendBufRaw(&buf, RTF_SEPARATOR);
@@ -186,7 +186,7 @@ static void sttAppendBufW(StringBuf *buf, const WCHAR *str) static void sttEmptyBuf(StringBuf *buf)
{
if (buf->buf) mir_free(buf->buf);
- buf->buf = 0;
+ buf->buf = nullptr;
buf->size = 0;
buf->offset = 0;
}
@@ -509,7 +509,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (xmlTmp)
m_proto->m_ThreadInfo->send(xmlTmp);
else {
- StringBuf buf = { 0 };
+ StringBuf buf = {};
sttAppendBufRaw(&buf, RTF_HEADER);
sttAppendBufRaw(&buf, RTF_BEGINPLAINXML);
sttAppendBufT(&buf, TranslateT("Outgoing XML parsing error"));
@@ -614,7 +614,7 @@ void __cdecl CJabberProto::ConsoleThread(void*) void CJabberProto::ConsoleInit()
{
- m_hThreadConsole = ForkThreadEx(&CJabberProto::ConsoleThread, 0, &m_dwConsoleThreadId);
+ m_hThreadConsole = ForkThreadEx(&CJabberProto::ConsoleThread, nullptr, &m_dwConsoleThreadId);
}
void CJabberProto::ConsoleUninit()
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 1c74eb3ac9..98dde44e89 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -1182,23 +1182,23 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM { nullptr, LPGENW("Contact Menu..."), SD_ACT_USERMENU, SD_FLG_NONODE},
{ nullptr, LPGENW("View vCard"), SD_ACT_VCARD, SD_FLG_NONODE},
{ JABBER_FEAT_MUC, LPGENW("Join chatroom"), SD_ACT_JOIN, SD_FLG_NORESOURCE},
- {0},
+ {nullptr},
{ nullptr, LPGENW("Refresh Info"), SD_ACT_REFRESH},
{ nullptr, LPGENW("Refresh Children"), SD_ACT_REFRESHCHILDREN},
- {0},
+ {nullptr},
{ nullptr, LPGENW("Add to favorites"), SD_ACT_FAVORITE},
{ nullptr, LPGENW("Add to roster"), SD_ACT_ROSTER, SD_FLG_NONODE | SD_FLG_NOTONROSTER},
{ JABBER_FEAT_MUC, LPGENW("Bookmark chatroom"), SD_ACT_BOOKMARK, SD_FLG_NORESOURCE | SD_FLG_HASUSER},
{ L"jabber:iq:search", LPGENW("Add search directory"), SD_ACT_ADDDIRECTORY},
{ JABBER_FEAT_BYTESTREAMS, LPGENW("Use this proxy"), SD_ACT_PROXY},
- {0},
+ {nullptr},
{ JABBER_FEAT_REGISTER, LPGENW("Register"), SD_ACT_REGISTER},
{ L"jabber:iq:gateway", LPGENW("Unregister"), SD_ACT_UNREGISTER, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED},
{ JABBER_FEAT_COMMANDS, LPGENW("Commands..."), SD_ACT_ADHOC},
- {0},
+ {nullptr},
{ L"jabber:iq:gateway", LPGENW("Logon"), SD_ACT_LOGON, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_ONLINE},
{ L"jabber:iq:gateway", LPGENW("Logoff"), SD_ACT_LOGOFF, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_NOTONLINE},
- {0},
+ {nullptr},
{ nullptr, LPGENW("Copy JID"), SD_ACT_COPYJID},
{ nullptr, LPGENW("Copy node name"), SD_ACT_COPYNODE},
{ nullptr, LPGENW("Copy node information"), SD_ACT_COPYINFO},
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index bfbf88cd6e..1c3f03a575 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 = { sizeof(mii) };
CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii);
- m_tmJabberIdleStartTime = time(0) - mii.idleTime * 60;
+ m_tmJabberIdleStartTime = time(nullptr) - mii.idleTime * 60;
}
else m_tmJabberIdleStartTime = 0;
diff --git a/protocols/JabberG/src/jabber_filterlist.cpp b/protocols/JabberG/src/jabber_filterlist.cpp index 97b4178c4c..848c2ec451 100644 --- a/protocols/JabberG/src/jabber_filterlist.cpp +++ b/protocols/JabberG/src/jabber_filterlist.cpp @@ -98,7 +98,7 @@ static LRESULT CALLBACK sttEditBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wPara if (fdat->m_filterText) mir_free(fdat->m_filterText);
int length = GetWindowTextLength(hwnd) + 1;
if (length == 1)
- fdat->m_filterText = 0;
+ fdat->m_filterText = nullptr;
else {
fdat->m_filterText = (wchar_t *)mir_alloc(sizeof(wchar_t) * length);
GetWindowText(hwnd, fdat->m_filterText, length);
@@ -165,10 +165,10 @@ LRESULT CCtrlFilterListView::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lPara case 1:
if (m_trackFilter && fdat->m_hwndEditBox) {
- wchar_t *str = 0;
+ wchar_t *str = nullptr;
int length = GetWindowTextLength(fdat->m_hwndEditBox) + 1;
if (length == 1)
- str = 0;
+ str = nullptr;
else {
str = (wchar_t *)mir_alloc(sizeof(wchar_t) * length);
GetWindowText(fdat->m_hwndEditBox, str, length);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index fbec892638..032e4cdf24 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -156,7 +156,7 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) }
deltaHeight += rcText.bottom - rcText.top;
- SetWindowPos(GetDlgItem(hwndForm, IDC_INSTRUCTION), 0, 0, 0,
+ SetWindowPos(GetDlgItem(hwndForm, IDC_INSTRUCTION), nullptr, 0, 0,
oldWidth,
rcText.bottom - rcText.top,
SWP_NOMOVE | SWP_NOZORDER);
@@ -164,7 +164,7 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) GetWindowRect(GetDlgItem(hwndForm, IDC_WHITERECT), &rcText);
MapWindowPoints(nullptr, hwndForm, (LPPOINT)&rcText, 2);
rcText.bottom += deltaHeight;
- SetWindowPos(GetDlgItem(hwndForm, IDC_WHITERECT), 0, 0, 0,
+ SetWindowPos(GetDlgItem(hwndForm, IDC_WHITERECT), nullptr, 0, 0,
rcText.right - rcText.left,
rcText.bottom - rcText.top,
SWP_NOMOVE | SWP_NOZORDER);
@@ -172,7 +172,7 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) GetWindowRect(GetDlgItem(hwndForm, IDC_FRAME1), &rcText);
MapWindowPoints(nullptr, hwndForm, (LPPOINT)&rcText, 2);
rcText.top += deltaHeight;
- SetWindowPos(GetDlgItem(hwndForm, IDC_FRAME1), 0,
+ SetWindowPos(GetDlgItem(hwndForm, IDC_FRAME1), nullptr,
rcText.left,
rcText.top,
0, 0,
@@ -181,7 +181,7 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) GetWindowRect(GetDlgItem(hwndForm, IDC_FRAME), &rcText);
MapWindowPoints(nullptr, hwndForm, (LPPOINT)&rcText, 2);
rcText.top += deltaHeight;
- SetWindowPos(GetDlgItem(hwndForm, IDC_FRAME), 0,
+ SetWindowPos(GetDlgItem(hwndForm, IDC_FRAME), nullptr,
rcText.left,
rcText.top,
rcText.right - rcText.left,
@@ -191,7 +191,7 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) GetWindowRect(GetDlgItem(hwndForm, IDC_VSCROLL), &rcText);
MapWindowPoints(nullptr, hwndForm, (LPPOINT)&rcText, 2);
rcText.top += deltaHeight;
- SetWindowPos(GetDlgItem(hwndForm, IDC_VSCROLL), 0,
+ SetWindowPos(GetDlgItem(hwndForm, IDC_VSCROLL), nullptr,
rcText.left,
rcText.top,
rcText.right - rcText.left,
@@ -268,9 +268,9 @@ void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayo }
if (item->hLabel)
- SetWindowPos(item->hLabel, 0, 0, 0, rcLabel.right - rcLabel.left, rcLabel.bottom - rcLabel.top, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(item->hLabel, nullptr, 0, 0, rcLabel.right - rcLabel.left, rcLabel.bottom - rcLabel.top, SWP_NOZORDER | SWP_NOMOVE);
if (item->hCtrl)
- SetWindowPos(item->hCtrl, 0, 0, 0, rcCtrl.right - rcCtrl.left, rcCtrl.bottom - rcCtrl.top, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(item->hCtrl, nullptr, 0, 0, rcCtrl.right - rcCtrl.left, rcCtrl.bottom - rcCtrl.top, SWP_NOZORDER | SWP_NOMOVE);
item->ptLabel.x = rcLabel.left;
item->ptLabel.y = rcLabel.top;
@@ -396,11 +396,11 @@ void JabberFormLayoutControls(HWND hwndStatic, TJabberFormLayoutInfo *layout_inf for (int i = 0; i < controls->getCount(); i++) {
if ((*controls)[i]->hLabel)
- SetWindowPos((*controls)[i]->hLabel, 0,
+ SetWindowPos((*controls)[i]->hLabel, nullptr,
layout_info->offset + (*controls)[i]->ptLabel.x, layout_info->y_pos + (*controls)[i]->ptLabel.y, 0, 0,
SWP_NOZORDER | SWP_NOSIZE);
if ((*controls)[i]->hCtrl)
- SetWindowPos((*controls)[i]->hCtrl, 0,
+ SetWindowPos((*controls)[i]->hCtrl, nullptr,
layout_info->offset + (*controls)[i]->ptCtrl.x, layout_info->y_pos + (*controls)[i]->ptCtrl.y, 0, 0,
SWP_NOZORDER | SWP_NOSIZE);
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 1ec5ec20c4..294c197487 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -277,8 +277,8 @@ static int sttRoomListAppend(HWND hwndList, RoomInfo::Overlay overlay, const wch {
RoomInfo *info = (RoomInfo *)mir_alloc(sizeof(RoomInfo));
info->overlay = overlay;
- info->line1 = line1 ? mir_wstrdup(line1) : 0;
- info->line2 = line2 ? mir_wstrdup(line2) : 0;
+ info->line1 = line1 ? mir_wstrdup(line1) : nullptr;
+ info->line2 = line2 ? mir_wstrdup(line2) : nullptr;
int id = SendMessage(hwndList, CB_ADDSTRING, 0, (LPARAM)name);
SendMessage(hwndList, CB_SETITEMDATA, id, (LPARAM)info);
@@ -650,7 +650,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) LISTFOREACH(i, m_proto, LIST_BOOKMARK)
{
- JABBER_LIST_ITEM *item = 0;
+ JABBER_LIST_ITEM *item = nullptr;
if (item = m_proto->ListGetItemPtrFromIndex(i))
if (!mir_wstrcmp(item->type, L"conference"))
AppendMenu(hMenu, MF_STRING, (UINT_PTR)item, item->name);
@@ -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(0);
+ gce.time = time(nullptr);
gce.ptszNick = oldNick;
gce.ptszUID = newNick;
gce.ptszText = newNick;
@@ -946,7 +946,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) // leaving room
else if (!mir_wstrcmp(type, L"unavailable")) {
- const wchar_t *str = 0;
+ const wchar_t *str = nullptr;
if (xNode != nullptr && item->nick != nullptr) {
HXML reasonNode = XmlGetChild(itemNode, "reason");
str = XmlGetAttrValue(itemNode, L"jid");
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 98957ca5eb..e008da1f0c 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -119,7 +119,7 @@ void CIconPool::RegisterIcon(const char *name, wchar_t *filename, int iconid, wc item->m_name = mir_strdup(name);
item->m_szIcolibName = mir_strdup(szSettingName);
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.defaultFile.w = filename;
sid.pszName = szSettingName;
sid.section.w = szSection;
@@ -201,7 +201,7 @@ static inline wchar_t qtoupper(wchar_t c) static BOOL WildComparei(const wchar_t *name, const wchar_t *mask)
{
- const wchar_t *last = '\0';
+ const wchar_t *last = nullptr;
for (;; mask++, name++) {
if (*mask != '?' && qtoupper(*mask) != qtoupper(*name))
break;
@@ -285,8 +285,8 @@ static HICON LoadTransportIcon(char *filename, int i, char *IconName, wchar_t *S if (hi) has_proto_icon = TRUE;
if (hi && nf) DestroyIcon(hi);
if (IconName != nullptr && SectName != nullptr) {
- SKINICONDESC sid = { 0 };
- sid.hDefaultIcon = (has_proto_icon) ? nullptr : Skin_LoadProtoIcon(0, -internalidx);
+ SKINICONDESC sid = {};
+ sid.hDefaultIcon = (has_proto_icon) ? nullptr : Skin_LoadProtoIcon(nullptr, -internalidx);
sid.section.w = SectName;
sid.pszName = IconName;
sid.description.w = Description;
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index 4d9929b945..d9e88f7560 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -61,7 +61,7 @@ bool CJabberIqManager::Start() if (m_hExpirerThread || m_bExpirerThreadShutdownRequest)
return false;
- m_hExpirerThread = ppro->ForkThreadEx(&CJabberProto::ExpirerThread, this, 0);
+ m_hExpirerThread = ppro->ForkThreadEx(&CJabberProto::ExpirerThread, this, nullptr);
if (!m_hExpirerThread)
return false;
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index c8dfdfbde9..f6ff5655de 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(0) - m_tmJabberIdleStartTime : 0));
+ << XATTRI(L"seconds", m_tmJabberIdleStartTime ? time(nullptr) - m_tmJabberIdleStartTime : 0));
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 94a2fbb7ea..aeecad1744 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -173,7 +173,7 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) void CJabberProto::OnLoggedIn()
{
m_bJabberOnline = true;
- m_tmJabberLoggedInTime = time(0);
+ m_tmJabberLoggedInTime = time(nullptr);
m_ThreadInfo->dwLoginRqs = 0;
@@ -1415,7 +1415,7 @@ void CJabberProto::OnIqResultGotAvatar(MCONTACT hContact, HXML n, const wchar_t if (mimeType != nullptr)
pictureType = ProtoGetAvatarFormatByMimeType(mimeType);
else
- pictureType = ProtoGetBufferFormat(body, 0);
+ pictureType = ProtoGetBufferFormat(body, nullptr);
if (pictureType == PA_FORMAT_UNKNOWN) {
debugLogW(L"Invalid mime type specified for picture: %s", mimeType);
return;
@@ -1582,7 +1582,7 @@ void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo *pInfo) if (szSeconds) {
int nSeconds = _wtoi(szSeconds);
if (nSeconds > 0)
- lastActivity = time(0) - nSeconds;
+ lastActivity = time(nullptr) - nSeconds;
}
LPCTSTR szLastStatusMessage = XPathT(iqNode, "query[@xmlns='jabber:iq:last']");
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index c37e63b50a..03d4b5d6a7 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -187,7 +187,7 @@ void g_MenuInit(void) CreateServiceFunction("Jabber/MenuChoose", JabberMenuChooseService);
- hChooserMenu = Menu_AddObject("JabberAccountChooser", LPGEN("Jabber account chooser"), 0, "Jabber/MenuChoose");
+ hChooserMenu = Menu_AddObject("JabberAccountChooser", LPGEN("Jabber account chooser"), nullptr, "Jabber/MenuChoose");
{
CMenuItem mi;
mi.name.a = "Cancel";
@@ -847,7 +847,7 @@ int g_OnToolbarInit(WPARAM, LPARAM) if (g_Instances.getCount() == 0)
return 0;
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
CreateServiceFunction("JABBER/*/Groupchat", g_ToolbarHandleJoinGroupchat);
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 91d7955c7e..7900f2711d 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -91,7 +91,7 @@ MCONTACT CJabberProto::DBCreateContact(const wchar_t *jid, const wchar_t *nick, SendGetVcard(szJid);
if (JABBER_LIST_ITEM *pItem = ListAdd(LIST_ROSTER, jid, hNewContact))
- pItem->bUseResource = wcschr(szJid, '/') != 0;
+ pItem->bUseResource = wcschr(szJid, '/') != nullptr;
debugLogW(L"Create Jabber contact jid=%s, nick=%s", szJid, nick);
DBCheckIsTransportedContact(szJid, hNewContact);
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 4467b392f7..dd80f9d395 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static wchar_t* StrTrimCopy(wchar_t *str)
{
- if (!str) return 0;
+ if (!str) return nullptr;
while (*str && iswspace(*str)) ++str;
if (!*str) return mir_wstrdup(str);
@@ -468,7 +468,7 @@ private: void InsertTag(HTREEITEM htiRoot, const wchar_t *tag, bool bSelect)
{
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.hParent = htiRoot;
tvi.hInsertAfter = TVI_LAST;
tvi.itemex.mask = TVIF_TEXT | TVIF_PARAM;
@@ -509,7 +509,7 @@ private: m_tvFilter.DeleteAllItems();
- TVINSERTSTRUCT tvis = { 0 };
+ TVINSERTSTRUCT tvis = {};
tvis.hInsertAfter = TVI_LAST;
tvis.itemex.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvis.itemex.stateMask = tvis.itemex.state = TVIS_BOLD | TVIS_EXPANDED;
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp index 7f29fd009f..d06af0543d 100755 --- a/protocols/JabberG/src/jabber_omemo.cpp +++ b/protocols/JabberG/src/jabber_omemo.cpp @@ -118,7 +118,7 @@ namespace omemo { goto complete;
}
- result = EVP_DigestInit_ex(ctx, EVP_sha512(), 0);
+ result = EVP_DigestInit_ex(ctx, EVP_sha512(), nullptr);
if (result == 1) {
result = SG_SUCCESS;
}
@@ -163,7 +163,7 @@ namespace omemo { goto complete;
}
- result = EVP_DigestInit_ex(ctx, EVP_sha512(), 0);
+ result = EVP_DigestInit_ex(ctx, EVP_sha512(), nullptr);
if (result == 1) {
result = SG_SUCCESS;
}
@@ -214,7 +214,7 @@ namespace omemo { return EVP_aes_256_ctr();
}
}
- return 0;
+ return nullptr;
}
int encrypt_func(signal_buffer **output,
@@ -226,7 +226,7 @@ namespace omemo { {
//TODO: use netlib for log
int result = 0;
- uint8_t *out_buf = 0;
+ uint8_t *out_buf = nullptr;
const EVP_CIPHER *evp_cipher = aes_cipher(cipher, key_len);
if (!evp_cipher) {
@@ -247,7 +247,7 @@ namespace omemo { EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(&ctx);
- result = EVP_EncryptInit_ex(&ctx, evp_cipher, 0, key, iv);
+ result = EVP_EncryptInit_ex(&ctx, evp_cipher, nullptr, key, iv);
if (!result) {
//fprintf(stderr, "cannot initialize cipher\n");
result = SG_ERR_UNKNOWN;
@@ -306,7 +306,7 @@ namespace omemo { {
//TODO: use netlib for log
int result = 0;
- uint8_t *out_buf = 0;
+ uint8_t *out_buf = nullptr;
const EVP_CIPHER *evp_cipher = aes_cipher(cipher, key_len);
if (!evp_cipher) {
@@ -327,7 +327,7 @@ namespace omemo { EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(&ctx);
- result = EVP_DecryptInit_ex(&ctx, evp_cipher, 0, key, iv);
+ result = EVP_DecryptInit_ex(&ctx, evp_cipher, nullptr, key, iv);
if (!result) {
///fprintf(stderr, "cannot initialize cipher\n");
result = SG_ERR_UNKNOWN;
@@ -592,7 +592,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(0), global_context);
+ signal_protocol_key_helper_generate_signed_pre_key(&signed_pre_key, new_dev->device_key, signed_pre_key_id, time(nullptr), 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);
@@ -1247,7 +1247,7 @@ namespace omemo { char *setting_name = (char*)mir_alloc(strlen(id_str) + 65);
mir_snprintf(setting_name, strlen(id_str) + 64, "%s%s", "OmemoSignalIdentity_", id_str);
mir_free(id_str);
- if (key_data != 0)
+ if (key_data != nullptr)
db_set_blob(data->hContact, data->proto->m_szModuleName, setting_name, key_data, (unsigned int)key_len); //TODO: check return value
else
db_unset(data->hContact, data->proto->m_szModuleName, setting_name);
@@ -1711,7 +1711,7 @@ void CJabberProto::OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime) }
if (deserialized && pm)
{
- int ret = session_cipher_decrypt_pre_key_signal_message((*(std::map<MCONTACT, std::map<unsigned int, omemo::omemo_session_jabber_internal_ptrs> >*)m_omemo.sessions_internal)[hContact][sender_dev_id_int].cipher, pm, 0, &decrypted_key);
+ int ret = session_cipher_decrypt_pre_key_signal_message((*(std::map<MCONTACT, std::map<unsigned int, omemo::omemo_session_jabber_internal_ptrs> >*)m_omemo.sessions_internal)[hContact][sender_dev_id_int].cipher, pm, nullptr, &decrypted_key);
switch (ret)
{
case SG_SUCCESS:
@@ -1766,7 +1766,7 @@ void CJabberProto::OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime) }
if (deserialized && sm)
{
- ret = session_cipher_decrypt_signal_message((*(std::map<MCONTACT, std::map<unsigned int, omemo::omemo_session_jabber_internal_ptrs> >*)m_omemo.sessions_internal)[hContact][sender_dev_id_int].cipher, sm, 0, &decrypted_key);
+ ret = session_cipher_decrypt_signal_message((*(std::map<MCONTACT, std::map<unsigned int, omemo::omemo_session_jabber_internal_ptrs> >*)m_omemo.sessions_internal)[hContact][sender_dev_id_int].cipher, sm, nullptr, &decrypted_key);
switch (ret)
{
case SG_SUCCESS:
@@ -2098,7 +2098,7 @@ bool CJabberProto::OmemoCheckSession(MCONTACT hContact) wchar_t szBareJid[JABBER_MAX_JID_LEN];
unsigned int *dev_id = (unsigned int*)mir_alloc(sizeof(unsigned int));
*dev_id = id;
- XmlNodeIq iq(AddIQ(&CJabberProto::OmemoOnIqResultGetBundle, JABBER_IQ_TYPE_GET, 0, 0UL, -1, dev_id));
+ XmlNodeIq iq(AddIQ(&CJabberProto::OmemoOnIqResultGetBundle, JABBER_IQ_TYPE_GET, nullptr, 0UL, -1, dev_id));
iq << XATTR(L"from", JabberStripJid(m_ThreadInfo->fullJID, szBareJid, _countof_portable(szBareJid)));
wchar_t *jid = ContactToJID(hContact);
iq << XATTR(L"to", jid);
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 5b3911e893..e75c01de02 100755 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber_caps.h"
#include "jabber_opttree.h"
-static BOOL(WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
+static BOOL(WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = nullptr;
/////////////////////////////////////////////////////////////////////////////////////////
// JabberRegisterDlgProc - the dialog proc for registering new account
@@ -539,7 +539,7 @@ private: void btnRegister_OnClick(CCtrlButton *)
{
- PSHNOTIFY pshn = { 0 };
+ PSHNOTIFY pshn = {};
pshn.hdr.code = PSN_APPLY;
pshn.hdr.hwndFrom = m_hwnd;
SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
@@ -1823,7 +1823,7 @@ private: void btnRegister_OnClick(CCtrlButton *)
{
- PSHNOTIFY pshn = { 0 };
+ PSHNOTIFY pshn = {};
pshn.hdr.code = PSN_APPLY;
pshn.hdr.hwndFrom = m_hwnd;
SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp index dc067efb28..ef65f14eb6 100644 --- a/protocols/JabberG/src/jabber_opttree.cpp +++ b/protocols/JabberG/src/jabber_opttree.cpp @@ -129,7 +129,7 @@ void CCtrlTreeOpts::OnInit() hItem = FindNamedItem(hSection, pItemName);
if (!sectionName || !hItem) {
if (!hItem) {
- TVINSERTSTRUCT tvis = { 0 };
+ TVINSERTSTRUCT tvis = {};
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_LAST;//TVI_SORT;
tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
@@ -163,7 +163,7 @@ void CCtrlTreeOpts::OnInit() TranslateTree();
ShowWindow(m_hwnd, SW_SHOW);
- SelectItem(FindNamedItem(0, nullptr));
+ SelectItem(FindNamedItem(nullptr, nullptr));
}
void CCtrlTreeOpts::OnDestroy()
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index ef1db75054..bff28c6457 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -431,7 +431,7 @@ public: // append known chatroom jids from bookmarks
LISTFOREACH(i, m_proto, LIST_BOOKMARK)
{
- JABBER_LIST_ITEM *item = 0;
+ JABBER_LIST_ITEM *item = nullptr;
if (item = m_proto->ListGetItemPtrFromIndex(i))
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, (LPARAM)item->jid);
}
@@ -648,7 +648,7 @@ protected: CPrivacyList *pList;
- TCLCInfo(): newJids(1, TJidData::cmp), bChanged(false), pList(0) {}
+ TCLCInfo(): newJids(1, TJidData::cmp), bChanged(false), pList(nullptr) {}
~TCLCInfo()
{
for (int i=0; i < newJids.getCount(); i++) {
@@ -667,10 +667,10 @@ protected: HANDLE findJid(wchar_t *jid)
{
- TJidData data = {0};
+ TJidData data = {};
data.jid = jid;
TJidData *found = newJids.find(&data);
- return found ? found->hItem : 0;
+ return found ? found->hItem : nullptr;
}
};
@@ -1374,7 +1374,7 @@ void CJabberDlgPrivacyLists::CListApplyList(HWND hwndList, CPrivacyList *pList) goto lbl_return;
for (CPrivacyListRule *pRule = pList->GetFirstRule(); pRule; pRule = pRule->GetNext()) {
- HANDLE hItem = 0;
+ HANDLE hItem = nullptr;
switch (pRule->GetType()) {
case Jid:
hItem = CListAddContact(hwndList, pRule->GetValue());
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 6b6c5b9adc..fa20992ff9 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -68,7 +68,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : m_privacyMenuServiceAllocated(-1),
m_priorityMenuVal(0),
m_priorityMenuValSet(false),
- m_hPrivacyMenuRoot(0),
+ m_hPrivacyMenuRoot(nullptr),
m_hPrivacyMenuItems(10),
m_lstJabberFeatCapPairsDynamic(2),
m_uEnabledFeatCapsDynamic(0)
@@ -425,7 +425,7 @@ int CJabberProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) HANDLE __cdecl CJabberProto::FileAllow(MCONTACT /*hContact*/, HANDLE hTransfer, const wchar_t *szPath)
{
if (!m_bJabberOnline)
- return 0;
+ return nullptr;
filetransfer *ft = (filetransfer*)hTransfer;
ft->std.tszWorkingDir = mir_wstrdup(szPath);
@@ -650,7 +650,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid) JABBER_SEARCH_BASIC *jsb;
if (!m_bJabberOnline || (jsb = (JABBER_SEARCH_BASIC*)mir_alloc(sizeof(JABBER_SEARCH_BASIC))) == nullptr)
- return 0;
+ return nullptr;
if (wcschr(szJid, '@') == nullptr) {
wchar_t *szServer = mir_a2u(m_ThreadInfo->conn.server);
@@ -687,7 +687,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid) HANDLE __cdecl CJabberProto::SearchByEmail(const wchar_t *email)
{
if (!m_bJabberOnline || email == nullptr)
- return 0;
+ return nullptr;
ptrA szServerName(getStringA("Jud"));
@@ -791,23 +791,23 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t** ppszFiles)
{
- if (!m_bJabberOnline) return 0;
+ if (!m_bJabberOnline) return nullptr;
if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
- return 0;
+ return nullptr;
ptrW jid(getWStringA(hContact, "jid"));
if (jid == nullptr)
- return 0;
+ return nullptr;
struct _stati64 statbuf;
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item == nullptr)
- return 0;
+ return nullptr;
// Check if another file transfer session request is pending (waiting for disco result)
if (item->ft != nullptr)
- return 0;
+ return nullptr;
JabberCapsBits jcb = GetResourceCapabilities(item->jid);
if (jcb == JABBER_RESOURCE_CAPS_IN_PROGRESS) {
@@ -833,7 +833,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri // XEP-0096 and OOB not supported?
|| !(jcb & (JABBER_CAPS_SI_FT | JABBER_CAPS_OOB))) {
MsgPopup(hContact, TranslateT("No compatible file transfer mechanism exists"), item->jid);
- return 0;
+ return nullptr;
}
filetransfer *ft = new filetransfer(this);
@@ -915,7 +915,7 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const c {
OmemoPutMessageToOutgoingQueue(hContact, unused_unknown, pszSrc);
int id = SerialNext();
- TFakeAckParams *param = new TFakeAckParams(hContact, 0, id);
+ TFakeAckParams *param = new TFakeAckParams(hContact, nullptr, id);
ForkThread(&CJabberProto::SendMessageAckThread, param);
return id;
}
@@ -998,7 +998,7 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const c }
m_ThreadInfo->send(m);
- ForkThread(&CJabberProto::SendMessageAckThread, new TFakeAckParams(hContact, 0, id));
+ ForkThread(&CJabberProto::SendMessageAckThread, new TFakeAckParams(hContact, nullptr, id));
}
else {
XmlAddAttr(m, L"to", szClientJid); XmlAddAttrID(m, id);
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 2d873ad70a..610c2d5514 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -684,7 +684,7 @@ int CJabberProto::AdhocQuitMirandaHandler(HXML, CJabberIqInfo *pInfo, CJabberAdh fieldNode = XmlGetChildByTag(xNode,"field", "var", L"allow-shutdown");
if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value")))
if (XmlGetText(valueNode) && _wtoi(XmlGetText(valueNode)))
- CallFunctionAsync(JabberQuitMirandaIMThread, 0);
+ CallFunctionAsync(JabberQuitMirandaIMThread, nullptr);
return JABBER_ADHOC_HANDLER_STATUS_COMPLETED;
}
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 996018d1a8..d298054cc2 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -105,8 +105,8 @@ static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat) int Order = (FieldDat->bHidden) ? -1 : FieldDat->Order; - HWND hwndLabel = CreateWindowEx(0, L"STATIC", (LPCTSTR)TranslateW(FieldDat->Label), WS_CHILD, CornerX, CornerY + Order * 40, width, 13, hwndParent, nullptr, hInst, 0); - HWND hwndVar = CreateWindowEx(0 | WS_EX_CLIENTEDGE, L"EDIT", (LPCTSTR)FieldDat->defValue, WS_CHILD | WS_TABSTOP, CornerX + 5, CornerY + Order * 40 + 14, width, 20, hwndParent, nullptr, hInst, 0); + HWND hwndLabel = CreateWindowEx(0, L"STATIC", (LPCTSTR)TranslateW(FieldDat->Label), WS_CHILD, CornerX, CornerY + Order * 40, width, 13, hwndParent, nullptr, hInst, nullptr); + HWND hwndVar = CreateWindowEx(0 | WS_EX_CLIENTEDGE, L"EDIT", (LPCTSTR)FieldDat->defValue, WS_CHILD | WS_TABSTOP, CornerX + 5, CornerY + Order * 40 + 14, width, 20, hwndParent, nullptr, hInst, nullptr); SendMessage(hwndLabel, WM_SETFONT, (WPARAM)hFont, 0); SendMessage(hwndVar, WM_SETFONT, (WPARAM)hFont, 0); if (!FieldDat->bHidden) { @@ -719,7 +719,7 @@ HWND __cdecl CJabberProto::CreateExtendedSearchUI(HWND parent) return CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCHUSER), parent, JabberSearchAdvancedDlgProc, (LPARAM)this); } - return 0; // Failure + return nullptr; // Failure } ////////////////////////////////////////////////////////////////////////// @@ -728,15 +728,15 @@ HWND __cdecl CJabberProto::CreateExtendedSearchUI(HWND parent) HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) { if (!m_bJabberOnline || !hwndDlg) - return 0; //error + return nullptr; //error JabberSearchData * dat = (JabberSearchData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (!dat) - return 0; //error + return nullptr; //error // check if server connected (at least one field exists) if (dat->nJSInfCount == 0) - return 0; + return nullptr; // formating request BOOL fRequestNotEmpty = FALSE; @@ -776,5 +776,5 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) m_ThreadInfo->send(iq); return (HWND)pInfo->GetIqId(); } - return 0; + return nullptr; } diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 126befb184..4a1fec9a73 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -440,7 +440,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) szMsgBody += 5;
wchar_t *szDelim = wcschr(szMsgBody, ';');
if (szDelim)
- szDelim = 0;
+ szDelim = nullptr;
JabberHttpUrlDecode(szMsgBody);
}
}
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 33dff7e34f..13681ceb0f 100755 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -40,7 +40,7 @@ struct UserInfoStringBuf wchar_t *buf; size_t size, offset; - UserInfoStringBuf() { buf = 0; size = 0; offset = 0; } + UserInfoStringBuf() { buf = nullptr; size = 0; offset = 0; } ~UserInfoStringBuf() { mir_free(buf); } void append(wchar_t *str) { @@ -151,7 +151,7 @@ void sttCleanupInfo(HWND hwndTree, int stage) break; } - HTREEITEM hItemTmp = 0; + HTREEITEM hItemTmp = nullptr; if (hItemTmp = TreeView_GetChild(hwndTree, hItem)) hItem = hItemTmp; else if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem)) @@ -178,7 +178,7 @@ static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, else mir_wstrncpy(buf, value, _countof(buf)); - TVINSERTSTRUCT tvis = {0}; + TVINSERTSTRUCT tvis = {}; tvis.hParent = htiRoot; tvis.hInsertAfter = TVI_LAST; tvis.itemex.mask = TVIF_TEXT|TVIF_PARAM; @@ -505,7 +505,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa if (GetWindowLongPtr((HWND)wParam, GWL_ID) == IDC_TV_INFO) { HWND hwndTree = GetDlgItem(hwndDlg, IDC_TV_INFO); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - HTREEITEM hItem = 0; + HTREEITEM hItem = nullptr; if ((pt.x == -1) && (pt.y == -1)) { if (hItem = TreeView_GetSelection(hwndTree)) { diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 2ec6c71e85..bfa0387296 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(0) - m_tmJabberIdleStartTime);
+ p << XQUERY(JABBER_FEAT_LAST_ACTIVITY) << XATTRI(L"seconds", time(nullptr) - m_tmJabberIdleStartTime);
if (m_options.EnableAvatars) {
HXML x = p << XCHILDNS(L"x", L"vcard-temp:x:update");
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp index f4c899d3cd..a667148534 100644 --- a/protocols/JabberG/src/jabber_xml.cpp +++ b/protocols/JabberG/src/jabber_xml.cpp @@ -307,7 +307,7 @@ void XPath::ProcessPath(LookupInfo &info, bool bCreate) XPath::PathType XPath::LookupImpl(bool bCreate)
{
LookupState state = S_START;
- LookupInfo info = {0};
+ LookupInfo info = {};
for (LPCTSTR p = m_szPath; state < S_FINAL; ++p) {
switch (state) {
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index 20bfae5769..d162edeb5e 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -101,7 +101,7 @@ extern "C" __declspec(dllexport) int Unload(void) DestroyXStatusIcons();
if (g_hDLLXStatusIcons) {
FreeLibrary(g_hDLLXStatusIcons);
- g_hDLLXStatusIcons = NULL;
+ g_hDLLXStatusIcons = nullptr;
}
return 0;
diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp index cfcda90d31..bb365c8c67 100644 --- a/protocols/MRA/src/MraAdvancedSearch.cpp +++ b/protocols/MRA/src/MraAdvancedSearch.cpp @@ -14,7 +14,7 @@ static const FieldNames GenderField[] = {
{ 1, LPGENW("Male") },
{ 2, LPGENW("Female") },
- { 0, NULL }
+ { 0, nullptr }
};
static const FieldNames MonthField[] =
@@ -31,7 +31,7 @@ static const FieldNames MonthField[] = { 10, LPGENW("October") },
{ 11, LPGENW("November") },
{ 12, LPGENW("December") },
- { 0, NULL }
+ { 0, nullptr }
};
static const FieldNames ZodiakField[] =
@@ -48,7 +48,7 @@ static const FieldNames ZodiakField[] = { 10, LPGENW("Capricorn") },
{ 11, LPGENW("Aquarius") },
{ 12, LPGENW("Pisces") },
- { 0, NULL }
+ { 0, nullptr }
};
void ResetComboBox(HWND hWndCombo)
@@ -309,5 +309,5 @@ HWND CMraProto::CreateExtendedSearchUI(HWND owner) if (g_hInstance && owner)
return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MRAADVANCEDSEARCH), owner, AdvancedSearchDlgProc, (LPARAM)this);
- return NULL;
+ return nullptr;
}
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index d28e9e6ff1..961c5c3329 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -37,7 +37,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle) {
mir_snprintf(szAvtSectName, "%s Avatars", m_szModuleName);
- if (phAvatarsQueueHandle == NULL)
+ if (phAvatarsQueueHandle == nullptr)
return ERROR_INVALID_HANDLE;
MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = new MRA_AVATARS_QUEUE();
@@ -77,7 +77,7 @@ void CMraProto::MraAvatarsQueueClear(HANDLE hQueue) PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_UNKNOWN;
- while (FifoMTItemPop(pmraaqAvatarsQueue, NULL, (LPVOID*)&pmraaqiAvatarsQueueItem) == NO_ERROR) {
+ while (FifoMTItemPop(pmraaqAvatarsQueue, nullptr, (LPVOID*)&pmraaqiAvatarsQueueItem) == NO_ERROR) {
ai.hContact = pmraaqiAvatarsQueueItem->hContact;
ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&ai, 0);
mir_free(pmraaqiAvatarsQueueItem);
@@ -105,7 +105,7 @@ void CMraProto::MraAvatarsQueueDestroy(HANDLE hQueue) DWORD CMraProto::MraAvatarsQueueAdd(HANDLE hQueue, DWORD dwFlags, MCONTACT hContact, DWORD *pdwAvatarsQueueID)
{
MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hQueue;
- if (pmraaqAvatarsQueue == NULL || g_bShutdown)
+ if (pmraaqAvatarsQueue == nullptr || g_bShutdown)
return ERROR_INVALID_HANDLE;
MRA_AVATARS_QUEUE_ITEM *pmraaqiAvatarsQueueItem = (MRA_AVATARS_QUEUE_ITEM*)mir_calloc(sizeof(MRA_AVATARS_QUEUE_ITEM));
@@ -139,21 +139,21 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) size_t dwAvatarSizeServer;
FILETIME ftLastModifiedTimeServer, ftLastModifiedTimeLocal;
SYSTEMTIME stAvatarLastModifiedTimeLocal;
- HNETLIBCONN hConnection = NULL;
+ HNETLIBCONN hConnection = nullptr;
NETLIBSELECT nls = { 0 };
INTERNET_TIME itAvatarLastModifiedTimeServer;
WCHAR szErrorText[2048];
Thread_SetName("MRA: AvatarsThreadProc");
- HANDLE hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ HANDLE hThreadEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
{
mir_cslock lck(pmraaqAvatarsQueue->cs);
pmraaqAvatarsQueue->hThreadEvents[pmraaqAvatarsQueue->iThreadsRunning++] = hThreadEvent;
}
while (!g_bShutdown) {
- if (FifoMTItemPop(pmraaqAvatarsQueue, NULL, (LPVOID*)&pmraaqiAvatarsQueueItem) != NO_ERROR) { // waiting until service stop or new task
+ if (FifoMTItemPop(pmraaqAvatarsQueue, nullptr, (LPVOID*)&pmraaqiAvatarsQueueItem) != NO_ERROR) { // waiting until service stop or new task
NETLIB_CLOSEHANDLE(hConnection);
WaitForSingleObjectEx(hThreadEvent, INFINITE, FALSE);
continue;
@@ -175,12 +175,12 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) CMStringA szUser = szEmail.Tokenize("@", iStart);
CMStringA szDomain = szEmail.Tokenize("@", iStart);
if (!szUser.IsEmpty() && !szDomain.IsEmpty()) {
- ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_CONNECTING, NULL, 0);
- if (hConnection == NULL)
+ ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_CONNECTING, nullptr, 0);
+ if (hConnection == nullptr)
hConnection = MraAvatarsHttpConnect(pmraaqAvatarsQueue->hNetlibUser, szServer, dwServerPort);
if (hConnection) {
- ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_CONNECTED, NULL, 0);
- ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_SENTREQUEST, NULL, 0);
+ ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_CONNECTED, nullptr, 0);
+ ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_SENTREQUEST, nullptr, 0);
if (!MraAvatarsHttpTransaction(hConnection, REQUEST_HEAD, szUser, szDomain, szServer, MAHTRO_AVTMRIM, bUseKeepAliveConn, &dwResultCode, &bKeepAlive, &dwAvatarFormat, &dwAvatarSizeServer, &itAvatarLastModifiedTimeServer)) {
switch (dwResultCode) {
case 200:
@@ -226,14 +226,14 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) }
if (bDownloadNew) {
- if (hConnection == NULL)
+ if (hConnection == nullptr)
hConnection = MraAvatarsHttpConnect(pmraaqAvatarsQueue->hNetlibUser, szServer, dwServerPort);
if (hConnection) {
- ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_DATA, NULL, 0);
+ ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_DATA, nullptr, 0);
if (MraAvatarsHttpTransaction(hConnection, REQUEST_GET, szUser, szDomain, szServer, MAHTRO_AVT, bUseKeepAliveConn, &dwResultCode, &bKeepAlive, &dwAvatarFormat, &dwAvatarSizeServer, &itAvatarLastModifiedTimeServer) == NO_ERROR && dwResultCode == 200) {
if (!MraAvatarsGetFileName(pmraaqAvatarsQueue, pmraaqiAvatarsQueueItem->hContact, dwAvatarFormat, wszFileName)) {
- HANDLE hFile = CreateFile(wszFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(wszFileName, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
DWORD dwWritten = 0;
bContinue = TRUE;
@@ -256,7 +256,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) bContinue = FALSE;
}
else {
- if (WriteFile(hFile, (LPVOID)&btBuff, dwReceived, &dwReceived, NULL)) {
+ if (WriteFile(hFile, (LPVOID)&btBuff, dwReceived, &dwReceived, nullptr)) {
dwWritten += dwReceived;
if (dwWritten >= dwAvatarSizeServer)
bContinue = FALSE;
@@ -335,7 +335,7 @@ HNETLIBCONN MraAvatarsHttpConnect(HNETLIBUSER hNetlibUser, LPCSTR lpszHost, DWOR do {
hConnection = Netlib_OpenConnection(hNetlibUser, &nloc);
}
- while (--dwCurConnectReTryCount && hConnection == NULL);
+ while (--dwCurConnectReTryCount && hConnection == nullptr);
return hConnection;
}
@@ -365,7 +365,7 @@ DWORD MraAvatarsHttpTransaction(HNETLIBCONN hConnection, DWORD dwRequestType, LP mir_snprintf(szBuff, "http://%s/%s/%s/%s", lpszHost, lpszDomain, lpszUser, lpszReqObj);
CMStringA szSelfVersionString = MraGetSelfVersionString();
- NETLIBHTTPHEADER nlbhHeaders[8] = { 0 };
+ NETLIBHTTPHEADER nlbhHeaders[8] = {};
nlbhHeaders[0].szName = "User-Agent"; nlbhHeaders[0].szValue = (LPSTR)szSelfVersionString.c_str();
nlbhHeaders[1].szName = "Accept-Encoding"; nlbhHeaders[1].szValue = "deflate";
nlbhHeaders[2].szName = "Pragma"; nlbhHeaders[2].szValue = "no-cache";
@@ -416,8 +416,8 @@ bool CMraProto::MraAvatarsGetContactTime(MCONTACT hContact, LPSTR lpszValueName, INTERNET_TIME itAvatarLastModifiedTimeLocal;
CMStringA szBuff;
- if (NULL == lpszValueName ||
- NULL == pstTime)
+ if (nullptr == lpszValueName ||
+ nullptr == pstTime)
return false;
if (false == mraGetStringA(hContact, lpszValueName, szBuff))
return false;
@@ -448,7 +448,7 @@ void CMraProto::MraAvatarsSetContactTime(MCONTACT hContact, LPSTR lpszValueName, DWORD CMraProto::MraAvatarsGetFileName(HANDLE hQueue, MCONTACT hContact, DWORD dwFormat, CMStringW &res)
{
res.Empty();
- if (hQueue == NULL)
+ if (hQueue == nullptr)
return ERROR_INVALID_HANDLE;
if (IsContactChatAgent(hContact))
@@ -522,7 +522,7 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hQueue, DWORD dwFlags, MCONTACT if (bQueueAdd || (dwFlags & GAIF_FORCE))
if (!MraAvatarsQueueAdd(hQueue, dwFlags, hContact, pdwAvatarsQueueID)) {
- MraAvatarsSetContactTime(hContact, "AvatarLastCheckTime", NULL);
+ MraAvatarsSetContactTime(hContact, "AvatarLastCheckTime", nullptr);
dwRetCode = GAIR_WAITFOR;
}
return dwRetCode;
@@ -535,7 +535,7 @@ DWORD CMraProto::MraAvatarsQueueGetAvatarSimple(HANDLE hQueue, DWORD dwFlags, MC PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
- DWORD dwRetCode = MraAvatarsQueueGetAvatar(hQueue, dwFlags, hContact, NULL, (DWORD*)&ai.format, ai.filename);
+ DWORD dwRetCode = MraAvatarsQueueGetAvatar(hQueue, dwFlags, hContact, nullptr, (DWORD*)&ai.format, ai.filename);
if (dwRetCode != GAIR_SUCCESS)
return dwRetCode;
@@ -606,9 +606,9 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara db_set_b(NULL, MRA_AVT_SECT_NAME, "Enable", IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
db_set_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", IsDlgButtonChecked(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE));
db_set_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", IsDlgButtonChecked(hWndDlg, IDC_RETURN_ABC_PATH));
- db_set_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", GetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, NULL, FALSE));
+ db_set_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", GetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, nullptr, FALSE));
db_set_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", IsDlgButtonChecked(hWndDlg, IDC_USE_KEEPALIVE_CONN));
- db_set_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
+ db_set_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, nullptr, FALSE));
wchar_t szServer[MAX_PATH];
GetDlgItemText(hWndDlg, IDC_SERVER, szServer, _countof(szServer));
@@ -623,7 +623,7 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara DWORD CMraProto::MraAvatarsDeleteContactAvatarFile(HANDLE hQueue, MCONTACT hContact)
{
- if (hQueue == NULL)
+ if (hQueue == nullptr)
return ERROR_INVALID_HANDLE;
DWORD dwAvatarFormat = GetContactAvatarFormat(hContact, PA_FORMAT_UNKNOWN);
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index 69e663239f..44dbfab5f8 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -64,7 +64,7 @@ INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, CMStringW wszID, wszUID, wszNick;
- GCEVENT gce = { m_szModuleName, 0, iType };
+ GCEVENT gce = { m_szModuleName, nullptr, iType };
if (hContactChatSession) {
mraGetStringW(hContactChatSession, "e-mail", wszID);
gce.ptszID = wszID.c_str();
@@ -88,7 +88,7 @@ INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, gce.ptszNick = wszNick;
}
else {
- MCONTACT hContactSender = MraHContactFromEmail(lpszUID, FALSE, TRUE, NULL);
+ MCONTACT hContactSender = MraHContactFromEmail(lpszUID, FALSE, TRUE, nullptr);
wszUID = lpszUID;
if (hContactSender)
gce.ptszNick = pcli->pfnGetContactDisplayName(hContactSender, 0);
@@ -106,7 +106,7 @@ INT_PTR CMraProto::MraChatSessionInvite(MCONTACT hContactChatSession, const CMSt CMStringW wszBuff;
wszBuff.Format(L"[%s]: %s", _A2T(lpszEMailInMultiChat.c_str()), TranslateT("invite sender"));
- return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ACTION, GCEF_ADDTOLOG, lpszEMailInMultiChat, NULL, wszBuff, 0, dwTime);
+ return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ACTION, GCEF_ADDTOLOG, lpszEMailInMultiChat, nullptr, wszBuff, 0, dwTime);
}
INT_PTR CMraProto::MraChatSessionMembersAdd(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime)
@@ -116,7 +116,7 @@ INT_PTR CMraProto::MraChatSessionMembersAdd(MCONTACT hContactChatSession, const CMStringW wszBuff;
wszBuff.Format(L"[%s]: %s", _A2T(lpszEMailInMultiChat), TranslateT("invite new members"));
- return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ACTION, GCEF_ADDTOLOG, lpszEMailInMultiChat, NULL, wszBuff, 0, dwTime);
+ return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ACTION, GCEF_ADDTOLOG, lpszEMailInMultiChat, nullptr, wszBuff, 0, dwTime);
}
INT_PTR CMraProto::MraChatSessionJoinUser(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime)
@@ -130,7 +130,7 @@ INT_PTR CMraProto::MraChatSessionJoinUser(MCONTACT hContactChatSession, const CM INT_PTR CMraProto::MraChatSessionLeftUser(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime)
{
if (hContactChatSession)
- return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_PART, GCEF_ADDTOLOG, lpszEMailInMultiChat, NULL, NULL, 0, dwTime);
+ return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_PART, GCEF_ADDTOLOG, lpszEMailInMultiChat, nullptr, nullptr, 0, dwTime);
return 1;
}
@@ -138,7 +138,7 @@ INT_PTR CMraProto::MraChatSessionLeftUser(MCONTACT hContactChatSession, const CM INT_PTR CMraProto::MraChatSessionSetIviter(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat)
{
if (hContactChatSession && !lpszEMailInMultiChat.IsEmpty())
- return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ADDSTATUS, 0, lpszEMailInMultiChat, lpwszStatuses[MRA_CHAT_STATUS_INVITER], NULL, 0, 0);
+ return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ADDSTATUS, 0, lpszEMailInMultiChat, lpwszStatuses[MRA_CHAT_STATUS_INVITER], nullptr, 0, 0);
return 1;
}
@@ -146,7 +146,7 @@ INT_PTR CMraProto::MraChatSessionSetIviter(MCONTACT hContactChatSession, const C INT_PTR CMraProto::MraChatSessionSetOwner(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat)
{
if (hContactChatSession && !lpszEMailInMultiChat.IsEmpty())
- return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ADDSTATUS, 0, lpszEMailInMultiChat, lpwszStatuses[MRA_CHAT_STATUS_OWNER], NULL, 0, 0);
+ return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ADDSTATUS, 0, lpszEMailInMultiChat, lpwszStatuses[MRA_CHAT_STATUS_OWNER], nullptr, 0, 0);
return 1;
}
@@ -155,7 +155,7 @@ INT_PTR CMraProto::MraChatSessionSetOwner(MCONTACT hContactChatSession, const CM INT_PTR CMraProto::MraChatSessionMessageAdd(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, const CMStringW &lpwszMessage, DWORD dwTime)
{
if (hContactChatSession)
- return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_MESSAGE, GCEF_ADDTOLOG, lpszEMailInMultiChat, NULL, lpwszMessage, 0, dwTime);
+ return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_MESSAGE, GCEF_ADDTOLOG, lpszEMailInMultiChat, nullptr, lpwszMessage, 0, dwTime);
return 1;
}
@@ -171,18 +171,18 @@ int CMraProto::MraChatGcEventHook(WPARAM, LPARAM lParam) case GC_USER_MESSAGE:
if (gch->ptszText && mir_wstrlen(gch->ptszText)) {
CMStringA szEmail = gch->ptszID;
- MCONTACT hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL);
+ MCONTACT hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, nullptr);
BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
DWORD dwFlags = 0;
if (getByte("RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE) && (MraContactCapabilitiesGet(hContact)&FEATURE_FLAG_RTF_MESSAGE))
dwFlags |= MESSAGE_FLAG_RTF;
- INT_PTR iSendRet = MraMessage(bSlowSend, hContact, ACKTYPE_MESSAGE, dwFlags, szEmail, gch->ptszText, NULL, 0);
+ INT_PTR iSendRet = MraMessage(bSlowSend, hContact, ACKTYPE_MESSAGE, dwFlags, szEmail, gch->ptszText, nullptr, 0);
if (bSlowSend == FALSE)
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)iSendRet, 0);
- MraChatSessionEventSendByHandle(hContact, GC_EVENT_MESSAGE, GCEF_ADDTOLOG, "", NULL, gch->ptszText, 0, (DWORD)_time32(NULL));
+ MraChatSessionEventSendByHandle(hContact, GC_EVENT_MESSAGE, GCEF_ADDTOLOG, "", nullptr, gch->ptszText, 0, (DWORD)_time32(nullptr));
}
break;
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index e540e98d94..ae7938fe4b 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -124,7 +124,7 @@ INT_PTR CALLBACK MraFilesQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, WCHAR szBuff[MAX_PATH];
GetDlgItemText(hWndDlg, IDC_FILE_SEND_EXTRA_ADDRESS, szBuff, _countof(szBuff));
ppro->mraSetStringW(NULL, "FileSendExtraAddresses", szBuff);
- ppro->setDword("FileSendBlockSize", (DWORD)GetDlgItemInt(hWndDlg, IDC_FILE_SEND_BLOCK_SIZE, NULL, FALSE));
+ ppro->setDword("FileSendBlockSize", (DWORD)GetDlgItemInt(hWndDlg, IDC_FILE_SEND_BLOCK_SIZE, nullptr, FALSE));
ppro->setByte("FileSendEnableMRIMProxyCons", IsDlgButtonChecked(hWndDlg, IDC_FILE_SEND_ENABLE_MRIMPROXY_CONS));
return TRUE;
}
@@ -159,7 +159,7 @@ void MraFilesQueueDestroy(HANDLE hQueue) MRA_FILES_QUEUE_ITEM *dat;
{
mir_cslock l(pmrafqFilesQueue->cs);
- while (ListMTItemGetFirst(pmrafqFilesQueue, NULL, (LPVOID*)&dat) == NO_ERROR)
+ while (ListMTItemGetFirst(pmrafqFilesQueue, nullptr, (LPVOID*)&dat) == NO_ERROR)
MraFilesQueueItemFree(dat);
}
delete pmrafqFilesQueue;
@@ -177,7 +177,7 @@ DWORD MraFilesQueueItemFindByID(HANDLE hQueue, DWORD dwIDRequest, MRA_FILES_QUEU mir_cslock l(pmrafqFilesQueue->cs);
ListMTIteratorMoveFirst(pmrafqFilesQueue, &lmtiIterator);
do {
- if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&dat) == NO_ERROR)
+ if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&dat) == NO_ERROR)
if (dat->dwIDRequest == dwIDRequest) {
if (ppmrafqFilesQueueItem)
*ppmrafqFilesQueueItem = dat;
@@ -195,7 +195,7 @@ HANDLE MraFilesQueueItemProxyByID(HANDLE hQueue, DWORD dwIDRequest) if (!MraFilesQueueItemFindByID(hQueue, dwIDRequest, &dat))
return dat->hMraMrimProxyData;
- return NULL;
+ return nullptr;
}
void MraFilesQueueItemFree(MRA_FILES_QUEUE_ITEM *dat)
@@ -282,7 +282,7 @@ DWORD CMraProto::MraFilesQueueAccept(HANDLE hQueue, DWORD dwIDRequest, LPCWSTR l pmftpp->hFilesQueueHandle = hFilesQueueHandle;
pmftpp->dat = dat;
- dat->hThread = ForkThreadEx(&CMraProto::MraFilesQueueRecvThreadProc, pmftpp, 0);
+ dat->hThread = ForkThreadEx(&CMraProto::MraFilesQueueRecvThreadProc, pmftpp, nullptr);
}
return dwRetErrorCode;
}
@@ -313,7 +313,7 @@ DWORD CMraProto::MraFilesQueueCancel(HANDLE hQueue, DWORD dwIDRequest, BOOL bSen SetEvent(dat->hWaitHandle);
- if (dat->hThread == NULL)
+ if (dat->hThread == nullptr)
MraFilesQueueItemFree(dat);
}
return dwRetErrorCode;
@@ -347,7 +347,7 @@ DWORD MraFilesQueueFree(HANDLE hQueue, DWORD dwIDRequest) mir_cslock l(pmrafqFilesQueue->cs);
ListMTIteratorMoveFirst(pmrafqFilesQueue, &lmtiIterator);
do {
- if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&dat) == NO_ERROR)
+ if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&dat) == NO_ERROR)
if (dat->dwIDRequest == dwIDRequest) {
MraFilesQueueItemFree(dat);
return 0;
@@ -372,7 +372,7 @@ DWORD CMraProto::MraFilesQueueSendMirror(HANDLE hQueue, DWORD dwIDRequest, const MraAddrListGetFromBuff(szAddresses, &dat->malAddrList);
MraAddrListStoreToContact(dat->hContact, &dat->malAddrList);
- dat->hConnection = NULL;
+ dat->hConnection = nullptr;
SetEvent(dat->hWaitHandle);
}
return dwRetErrorCode;
@@ -427,7 +427,7 @@ bool CMraProto::MraFilesQueueHandCheck(HNETLIBCONN hConnection, MRA_FILES_QUEUE_ HANDLE CMraProto::MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *dat)
{
if (!dat)
- return NULL;
+ return nullptr;
if (getByte("FileSendEnableDirectConn", MRA_DEF_FS_ENABLE_DIRECT_CONN) && InterlockedExchangeAdd((volatile LONG*)&dat->bIsWorking, 0) && ((dat->bSending == FALSE && getByte("FileSendNoOutConnOnRcv", MRA_DEF_FS_NO_OUT_CONN_ON_RCV) == FALSE) || (dat->bSending == TRUE && getByte("FileSendNoOutConnOnSend", MRA_DEF_FS_NO_OUT_CONN_ON_SEND) == FALSE))) {
BOOL bFiltering = FALSE, bIsHTTPSProxyUsed = IsHTTPSProxyUsed(m_hNetlibUser);
@@ -453,7 +453,7 @@ HANDLE CMraProto::MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *dat) dwAddrCount = dat->malAddrList.dwAddrCount;
if (dwAddrCount) {
- dat->hConnection = NULL;
+ dat->hConnection = nullptr;
dwConnectReTryCount = getDword("ConnectReTryCountFileSend", MRA_DEFAULT_CONN_RETRY_COUNT_FILES);
nloc.cbSize = sizeof(nloc);
nloc.flags = NLOCF_V2;
@@ -473,7 +473,7 @@ HANDLE CMraProto::MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *dat) do {
dat->hConnection = Netlib_OpenConnection(m_hNetlibUser, &nloc);
}
- while (--dwCurConnectReTryCount && dat->hConnection == NULL);
+ while (--dwCurConnectReTryCount && dat->hConnection == nullptr);
if (dat->hConnection) {
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, (HANDLE)dat->dwIDRequest, 0);
@@ -510,9 +510,9 @@ LPWSTR GetFileNameFromFullPathW(LPWSTR lpwszFullPath, size_t dwFullPathSize) HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat)
{
if (!dat)
- return NULL;
+ return nullptr;
if (!InterlockedExchangeAdd((volatile LONG*)&dat->bIsWorking, 0))
- return NULL;
+ return nullptr;
CMStringA szEmail;
if (mraGetStringA(dat->hContact, "e-mail", szEmail)) {
@@ -547,7 +547,7 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat) }
if (dwAddrListSize) {
- dat->hWaitHandle = CreateEvent(NULL, TRUE, FALSE, NULL);
+ dat->hWaitHandle = CreateEvent(nullptr, TRUE, FALSE, nullptr);
if (dat->bSending == FALSE) // çàïðàøèâàåì çåðêàëüíîå ñîåäèíåíèå, òê ñàìè ïîäêëþ÷èòñÿ íå ñìîãëè
MraFileTransferAck(FILE_TRANSFER_MIRROR, szEmail, dat->dwIDRequest, szAddrList);
else { // çäåñü îòïðàâëÿåì çàïðîñ íà ïåðåäà÷ó(óñòàíîâëåíèå ñîåäèíåíèÿ)
@@ -569,7 +569,7 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat) if (dat->hMraMrimProxyData) {
// óñòàíàâëèâàåì äàííûå äëÿ ìàéëîâñêîé ïðîêñè, åñëè îíà ðàçðåøåíà
CMStringA lpszFiles = lpwszFiles;
- MraMrimProxySetData(dat->hMraMrimProxyData, szEmail, dat->dwIDRequest, MRIM_PROXY_TYPE_FILES, lpszFiles, "", NULL);
+ MraMrimProxySetData(dat->hMraMrimProxyData, szEmail, dat->dwIDRequest, MRIM_PROXY_TYPE_FILES, lpszFiles, "", nullptr);
}
MraFileTransfer(szEmail, dat->dwIDRequest, dat->dwFilesTotalSize, lpwszFiles, szAddrList);
@@ -578,7 +578,7 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat) }
WaitForSingleObjectEx(dat->hWaitHandle, INFINITE, FALSE);
CloseHandle(dat->hWaitHandle);
- dat->hWaitHandle = NULL;
+ dat->hWaitHandle = nullptr;
}
}
return dat->hConnection;
@@ -694,7 +694,7 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hQueue, DWORD dwFlags, MCONTACT // Send chain event
PROTORECVFILET prf;
prf.dwFlags = PRFF_UNICODE;
- prf.timestamp = _time32(NULL);
+ prf.timestamp = _time32(nullptr);
prf.descr.w = dat->pwszDescription;
prf.fileCount = 1;
prf.files.w = &dat->pwszFilesList;
@@ -791,20 +791,20 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) //dwBuffSizeUsed = (mir_snprintf((LPSTR)btBuff, _countof(btBuff), "%s %S", MRA_FT_GET_FILE, dat->pmfqfFiles[i].lpwszName)+1);
memcpy(btBuff, MRA_FT_GET_FILE, sizeof(MRA_FT_GET_FILE));
btBuff[(sizeof(MRA_FT_GET_FILE)-1)] = ' ';
- dwBuffSizeUsed = sizeof(MRA_FT_GET_FILE) + WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[i].lpwszName, (int)dat->pmfqfFiles[i].dwNameLen, (LPSTR)(btBuff + sizeof(MRA_FT_GET_FILE)), (int)(_countof(btBuff) - sizeof(MRA_FT_GET_FILE)), NULL, NULL);
+ dwBuffSizeUsed = sizeof(MRA_FT_GET_FILE) + WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[i].lpwszName, (int)dat->pmfqfFiles[i].dwNameLen, (LPSTR)(btBuff + sizeof(MRA_FT_GET_FILE)), (int)(_countof(btBuff) - sizeof(MRA_FT_GET_FILE)), nullptr, nullptr);
btBuff[dwBuffSizeUsed] = 0;
dwBuffSizeUsed++;
if (dwBuffSizeUsed == (size_t)Netlib_Send(dat->hConnection, (LPSTR)btBuff, (int)dwBuffSizeUsed, 0)) {// file request sended
- hFile = CreateFileW(wszFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ hFile = CreateFileW(wszFileName, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {// file opened/created, pre allocating disk space, for best perfomance
bOK = FALSE;
liFileSize.QuadPart = (LONGLONG)dat->pmfqfFiles[i].dwSize;
- if (SetFilePointerEx(hFile, liFileSize, NULL, FILE_BEGIN))
+ if (SetFilePointerEx(hFile, liFileSize, nullptr, FILE_BEGIN))
if (SetEndOfFile(hFile)) {
liFileSize.QuadPart = 0;
- bOK = SetFilePointerEx(hFile, liFileSize, NULL, FILE_BEGIN);
+ bOK = SetFilePointerEx(hFile, liFileSize, nullptr, FILE_BEGIN);
}
if (bOK) {// disk space pre allocated
@@ -831,7 +831,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) bContinue = FALSE;
}
else {
- if (WriteFile(hFile, (LPVOID)&btBuff, dwReceived, &dwReceived, NULL)) {
+ if (WriteFile(hFile, (LPVOID)&btBuff, dwReceived, &dwReceived, nullptr)) {
pfts.currentFileProgress += dwReceived;
pfts.totalProgress += dwReceived;
@@ -955,7 +955,7 @@ DWORD CMraProto::MraFilesQueueAddSend(HANDLE hQueue, DWORD dwFlags, MCONTACT hCo MRA_FILES_THREADPROC_PARAMS *pmftpp = (MRA_FILES_THREADPROC_PARAMS*)mir_calloc(sizeof(MRA_FILES_THREADPROC_PARAMS));
pmftpp->hFilesQueueHandle = hQueue;
pmftpp->dat = dat;
- dat->hThread = ForkThreadEx(&CMraProto::MraFilesQueueSendThreadProc, pmftpp, 0);
+ dat->hThread = ForkThreadEx(&CMraProto::MraFilesQueueSendThreadProc, pmftpp, nullptr);
return NO_ERROR;
}
@@ -1042,7 +1042,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) bFailed = TRUE;
for (j = 0; j < dat->dwFilesCount; j++) {
lpwszFileName = GetFileNameFromFullPathW(dat->pmfqfFiles[j].lpwszName, dat->pmfqfFiles[j].dwNameLen);
- szFileName[WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszFileName, (int)(dat->pmfqfFiles[j].dwNameLen - (lpwszFileName - dat->pmfqfFiles[j].lpwszName)), szFileName, _countof(szFileName), NULL, NULL)] = 0;
+ szFileName[WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszFileName, (int)(dat->pmfqfFiles[j].dwNameLen - (lpwszFileName - dat->pmfqfFiles[j].lpwszName)), szFileName, _countof(szFileName), nullptr, nullptr)] = 0;
if (!_memicmp(btBuff + sizeof(MRA_FT_GET_FILE), szFileName, dwBuffSizeUsed - (sizeof(MRA_FT_GET_FILE)+1))) {
bFailed = FALSE;
@@ -1051,7 +1051,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) }
if (bFailed == FALSE) {
- HANDLE hFile = CreateFileW(dat->pmfqfFiles[j].lpwszName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, (FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN), NULL);
+ HANDLE hFile = CreateFileW(dat->pmfqfFiles[j].lpwszName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, (FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN), nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
bOK = FALSE;
dwUpdateTimeNext = GetTickCount();
@@ -1061,11 +1061,11 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) pfts.currentFileProgress = 0;
//pfts.currentFileTime; //as seconds since 1970
- WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[j].lpwszName, (int)dat->pmfqfFiles[j].dwNameLen, szFileName, _countof(szFileName), NULL, NULL);
+ WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[j].lpwszName, (int)dat->pmfqfFiles[j].dwNameLen, szFileName, _countof(szFileName), nullptr, nullptr);
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)dat->dwIDRequest, (LPARAM)&pfts);
while (TRUE) { // read and sending
- if (ReadFile(hFile, btBuff, dwSendBlockSize, (DWORD*)&dwBuffSizeUsed, NULL)) {
+ if (ReadFile(hFile, btBuff, dwSendBlockSize, (DWORD*)&dwBuffSizeUsed, nullptr)) {
dwReceived = Netlib_Send(dat->hConnection, (LPSTR)btBuff, (int)dwBuffSizeUsed, 0);
if (dwBuffSizeUsed == dwReceived) {
pfts.currentFileProgress += dwBuffSizeUsed;
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index 5da2288ad1..99471e9fd4 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -56,7 +56,7 @@ HICON IconLibGetIcon(HANDLE hIcon) HICON IconLibGetIconEx(HANDLE hIcon, DWORD dwFlags)
{
- HICON hiIcon = NULL;
+ HICON hiIcon = nullptr;
if (hIcon) {
hiIcon = IcoLib_GetIconByHandle(hIcon);
if ((dwFlags & LR_SHARED) == 0)
@@ -81,7 +81,7 @@ void InitXStatusIcons() {
// load libs
wchar_t szBuff[MAX_FILEPATH];
- if (GetModuleFileName(NULL, szBuff, _countof(szBuff))) {
+ if (GetModuleFileName(nullptr, szBuff, _countof(szBuff))) {
LPWSTR lpwszFileName;
g_dwMirWorkDirPathLen = GetFullPathName(szBuff, MAX_FILEPATH, g_szMirWorkDirPath, &lpwszFileName);
if (g_dwMirWorkDirPathLen) {
@@ -92,26 +92,26 @@ void InitXStatusIcons() DWORD dwBuffLen;
DWORD dwErrorCode = FindFile(g_szMirWorkDirPath, (DWORD)g_dwMirWorkDirPathLen, L"xstatus_MRA.dll", -1, szBuff, _countof(szBuff), &dwBuffLen);
if (dwErrorCode == NO_ERROR) {
- g_hDLLXStatusIcons = LoadLibraryEx(szBuff, NULL, 0);
+ g_hDLLXStatusIcons = LoadLibraryEx(szBuff, nullptr, 0);
if (g_hDLLXStatusIcons) {
dwBuffLen = LoadString(g_hDLLXStatusIcons, IDS_IDENTIFY, szBuff, MAX_FILEPATH);
if (dwBuffLen == 0 || wcsnicmp(L"# Custom Status Icons #", szBuff, 23)) {
FreeLibrary(g_hDLLXStatusIcons);
- g_hDLLXStatusIcons = NULL;
+ g_hDLLXStatusIcons = nullptr;
}
}
}
}
}
- GetModuleFileName((g_hDLLXStatusIcons != NULL) ? g_hDLLXStatusIcons : g_hInstance, szBuff, _countof(szBuff));
+ GetModuleFileName((g_hDLLXStatusIcons != nullptr) ? g_hDLLXStatusIcons : g_hInstance, szBuff, _countof(szBuff));
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.section.w = LPGENW("Protocols")L"/" LPGENW("MRA") L"/" LPGENW("Custom Status");
sid.defaultFile.w = szBuff;
sid.flags = SIDF_ALL_UNICODE;
- hXStatusAdvancedStatusIcons[0] = NULL;
+ hXStatusAdvancedStatusIcons[0] = nullptr;
for (DWORD i = 1; i < MRA_XSTATUS_COUNT+1; i++) {
char szIconName[MAX_PATH];
mir_snprintf(szIconName, "mra_xstatus%ld", i);
diff --git a/protocols/MRA/src/MraMPop.cpp b/protocols/MRA/src/MraMPop.cpp index d29bd859ae..397cb0a51b 100644 --- a/protocols/MRA/src/MraMPop.cpp +++ b/protocols/MRA/src/MraMPop.cpp @@ -38,11 +38,11 @@ void MraMPopSessionQueueClear(HANDLE hQueue) MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hQueue;
pmpsqMPopSessionQueue->bKeyValid = false;
mir_free(pmpsqMPopSessionQueue->lpszMPOPKey);
- pmpsqMPopSessionQueue->lpszMPOPKey = NULL;
+ pmpsqMPopSessionQueue->lpszMPOPKey = nullptr;
pmpsqMPopSessionQueue->dwMPOPKeySize = 0;
MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
- while ( !FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi))
+ while ( !FifoMTItemPop(pmpsqMPopSessionQueue, nullptr, (LPVOID*)&pmpsqi))
mir_free(pmpsqi);
}
@@ -115,12 +115,12 @@ void CMraProto::MraMPopSessionQueueStart(HANDLE hQueue) while ( FifoMTGetCount(pmpsqMPopSessionQueue)) {
if (!pmpsqMPopSessionQueue->bKeyValid) { /* We have no key, try to get one. */
- if (0 == MraSendCMD(MRIM_CS_GET_MPOP_SESSION, NULL, 0)) /* Fail to send. */
+ if (0 == MraSendCMD(MRIM_CS_GET_MPOP_SESSION, nullptr, 0)) /* Fail to send. */
MraMPopSessionQueueFlush(hQueue);
return;
}
- if ( FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi) == NO_ERROR) {
+ if ( FifoMTItemPop(pmpsqMPopSessionQueue, nullptr, (LPVOID*)&pmpsqi) == NO_ERROR) {
CMStringA szUrl, szEmail;
if (mraGetStringA(NULL, "e-mail", szEmail)) {
pmpsqMPopSessionQueue->bKeyValid = false;
@@ -142,7 +142,7 @@ void CMraProto::MraMPopSessionQueueFlush(HANDLE hQueue) MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hQueue;
MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
- while (FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi) == NO_ERROR) {
+ while (FifoMTItemPop(pmpsqMPopSessionQueue, nullptr, (LPVOID*)&pmpsqi) == NO_ERROR) {
Utils_OpenUrl(pmpsqi->lpszUrl);
mir_free(pmpsqi);
}
@@ -168,7 +168,7 @@ DWORD MraMPopSessionQueueSetNewMPopKey(HANDLE hQueue, const CMStringA &szKey) }
pmpsqMPopSessionQueue->bKeyValid = false;
- pmpsqMPopSessionQueue->lpszMPOPKey = NULL;
+ pmpsqMPopSessionQueue->lpszMPOPKey = nullptr;
pmpsqMPopSessionQueue->dwMPOPKeySize = 0;
return GetLastError();
}
diff --git a/protocols/MRA/src/MraMRIMProxy.cpp b/protocols/MRA/src/MraMRIMProxy.cpp index 1f9aa28733..d5d5af1b9e 100644 --- a/protocols/MRA/src/MraMRIMProxy.cpp +++ b/protocols/MRA/src/MraMRIMProxy.cpp @@ -89,18 +89,18 @@ DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HNETLIBCONN *phCo }
// ìû èíèöèàòîðû
else {
- pmmpd->hWaitHandle = CreateEvent(NULL, TRUE, FALSE, NULL);
+ pmmpd->hWaitHandle = CreateEvent(nullptr, TRUE, FALSE, nullptr);
if (pmmpd->szEmail)
if (MraProxy(pmmpd->szEmail, pmmpd->dwIDRequest, pmmpd->dwDataType, pmmpd->lpszUserData, "", pmmpd->mguidSessionID))
WaitForSingleObjectEx(pmmpd->hWaitHandle, INFINITE, FALSE);
CloseHandle(pmmpd->hWaitHandle);
- pmmpd->hWaitHandle = NULL;
+ pmmpd->hWaitHandle = nullptr;
}
dwRetErrorCode = ERROR_NO_NETWORK;
if (pmmpd->malAddrList.dwAddrCount) {
- pmmpd->hConnection = NULL;
+ pmmpd->hConnection = nullptr;
bIsHTTPSProxyUsed = IsHTTPSProxyUsed(m_hNetlibUser);
dwConnectReTryCount = getDword("ConnectReTryCountMRIMProxy", MRA_DEFAULT_CONN_RETRY_COUNT_MRIMPROXY);
nloc.cbSize = sizeof(nloc);
@@ -114,7 +114,7 @@ DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HNETLIBCONN *phCo // ÷åðåç https ïðîêñè òîëüêî 443 ïîðò
if ((pmmpd->malAddrList.pMailAddress[i].dwPort == MRA_SERVER_PORT_HTTPS && bIsHTTPSProxyUsed) || bIsHTTPSProxyUsed == FALSE) {
if (pmmpd->dwDataType == MRIM_PROXY_TYPE_FILES)
- ProtoBroadcastAck(MraHContactFromEmail(pmmpd->szEmail, FALSE, TRUE, NULL), ACKTYPE_FILE, ACKRESULT_CONNECTING, (HANDLE)pmmpd->dwIDRequest, 0);
+ ProtoBroadcastAck(MraHContactFromEmail(pmmpd->szEmail, FALSE, TRUE, nullptr), ACKTYPE_FILE, ACKRESULT_CONNECTING, (HANDLE)pmmpd->dwIDRequest, 0);
nloc.szHost = inet_ntoa((*((in_addr*)&pmmpd->malAddrList.pMailAddress[i].dwAddr)));
nloc.wPort = (WORD)pmmpd->malAddrList.pMailAddress[i].dwPort;
@@ -123,7 +123,7 @@ DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HNETLIBCONN *phCo do {
pmmpd->hConnection = Netlib_OpenConnection(m_hNetlibUser, &nloc);
}
- while (--dwCurConnectReTryCount && pmmpd->hConnection == NULL);
+ while (--dwCurConnectReTryCount && pmmpd->hConnection == nullptr);
if (pmmpd->hConnection) {
nls.dwTimeout = (MRA_TIMEOUT_DIRECT_CONN*1000*2);
@@ -132,7 +132,7 @@ DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HNETLIBCONN *phCo dwRcvBuffSizeUsed = 0;
if (pmmpd->dwDataType == MRIM_PROXY_TYPE_FILES)
- ProtoBroadcastAck(MraHContactFromEmail(pmmpd->szEmail, FALSE, TRUE, NULL), ACKTYPE_FILE, ACKRESULT_CONNECTED, (HANDLE)pmmpd->dwIDRequest, 0);
+ ProtoBroadcastAck(MraHContactFromEmail(pmmpd->szEmail, FALSE, TRUE, nullptr), ACKTYPE_FILE, ACKRESULT_CONNECTED, (HANDLE)pmmpd->dwIDRequest, 0);
MraSendPacket(nls.hReadConns[0], 0, MRIM_CS_PROXY_HELLO, &pmmpd->mguidSessionID, sizeof(MRA_GUID));
while (bContinue) {
diff --git a/protocols/MRA/src/MraOfflineMsg.cpp b/protocols/MRA/src/MraOfflineMsg.cpp index dd0d93f1c5..1e75e886e3 100644 --- a/protocols/MRA/src/MraOfflineMsg.cpp +++ b/protocols/MRA/src/MraOfflineMsg.cpp @@ -14,7 +14,7 @@ static DWORD MraOfflineMessageConvertTime(INTERNET_TIME *pitTime) tziTimeZoneMailRu.Bias = pitTime->lTimeZone/100*60;
tziTimeZoneMailRu.DaylightBias = pitTime->lTimeZone%100;
SystemTimeToTzSpecificLocalTime(&tziTimeZoneMailRu, &pitTime->stTime, &stUniversalTime);
- SystemTimeToTzSpecificLocalTime(NULL, &stUniversalTime, &stTime);
+ SystemTimeToTzSpecificLocalTime(nullptr, &stUniversalTime, &stTime);
return (DWORD)MakeTime32FromLocalSystemTime(&stTime);
}
@@ -25,8 +25,8 @@ static DWORD MraOfflineMessageGetHeaderValueLow(LPSTR lpszHeaderLow, size_t dwHe if (lpszValue) {
lpszValue += dwValueNameSize;
LPSTR lpszValueEnd = (LPSTR)MemoryFind((lpszValue-lpszHeaderLow), lpszHeaderLow, dwHeaderSize, CRLF, (sizeof(CRLF)-1));
- if (lpszValueEnd == NULL) lpszValueEnd = (LPSTR)MemoryFind((lpszValue-lpszHeaderLow), lpszHeaderLow, dwHeaderSize, LF, (sizeof(LF)-1));
- if (lpszValueEnd == NULL) lpszValueEnd = (LPSTR)(lpszHeaderLow+dwHeaderSize);
+ if (lpszValueEnd == nullptr) lpszValueEnd = (LPSTR)MemoryFind((lpszValue-lpszHeaderLow), lpszHeaderLow, dwHeaderSize, LF, (sizeof(LF)-1));
+ if (lpszValueEnd == nullptr) lpszValueEnd = (LPSTR)(lpszHeaderLow+dwHeaderSize);
lpszValue = (LPSTR)MemoryFind((lpszValue-lpszHeaderLow), lpszHeaderLow, (lpszValueEnd-lpszHeaderLow), ":", 1);
if (lpszValue) {
@@ -70,9 +70,9 @@ static DWORD MraOfflineMessageGetHeaderValue(LPSTR lpszHeader, LPSTR lpszHeaderL if (lpszValue) {
lpszValue += dwValueNameSize;
LPSTR lpszValueEnd = (LPSTR)MemoryFind((lpszValue-lpszHeaderLow), lpszHeaderLow, dwHeaderSize, CRLF, (sizeof(CRLF)-1));
- if (lpszValueEnd == NULL)
+ if (lpszValueEnd == nullptr)
lpszValueEnd = (LPSTR)MemoryFind((lpszValue-lpszHeaderLow), lpszHeaderLow, dwHeaderSize, LF, (sizeof(LF)-1));
- if (lpszValueEnd == NULL)
+ if (lpszValueEnd == nullptr)
lpszValueEnd = (LPSTR)(lpszHeaderLow+dwHeaderSize);
lpszValue = (LPSTR)MemoryFind((lpszValue-lpszHeaderLow), lpszHeaderLow, (lpszValueEnd-lpszHeaderLow), ":", 1);
@@ -105,11 +105,11 @@ static DWORD MraOfflineMessageGetNextMIMEPart(LPSTR lpszBody, size_t dwBodySize, else if ((*((BYTE*)lpszMIMEPart)) == (*((BYTE*)LF)))
lpszMIMEPart += (sizeof(LF)-1);
else if ((*((WORD*)lpszMIMEPart)) == '--')
- lpszMIMEPart = NULL;
+ lpszMIMEPart = nullptr;
else
_CrtDbgBreak();
- if (lpszMIMEPart == NULL)
+ if (lpszMIMEPart == nullptr)
return ERROR_NO_MORE_ITEMS;
LPSTR lpszTemp = (LPSTR)MemoryFind((lpszMIMEPart-lpszBody), lpszBody, dwBodySize, lpszBoundary, dwBoundarySize);
if (lpszTemp) {// íàøëè êîíåö ìèìå ÷àñòè ñ òåêñòîì
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index 10d6599e9d..6b0d4fd4bd 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -11,7 +11,7 @@ static LPCWSTR lpcwszPopupsTypes[] = LPGENW("Warning"),
LPGENW("Error"),
LPGENW("NewMail"),
- NULL
+ nullptr
};
INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -114,7 +114,7 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR ppro->setDword(szBuff, SendDlgItemMessage(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_GETCOLOUR, 0, 0));
mir_snprintf(szBuff, "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
- ppro->setDword(szBuff, GetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, NULL, FALSE));
+ ppro->setDword(szBuff, GetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, nullptr, FALSE));
}
return TRUE;
}
@@ -174,7 +174,7 @@ LRESULT CALLBACK MraPopupDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM l if (HIWORD(wParam) == STN_CLICKED) { //It was a click on the Popup.
if (dat->iPopupType == MRA_POPUP_TYPE_EMAIL_STATUS) {
CallProtoService(dat->ppro->m_szModuleName, MRA_GOTO_INBOX, 0, 0);
- dat->ppro->hWndEMailPopupStatus = NULL;
+ dat->ppro->hWndEMailPopupStatus = nullptr;
}
}
PUDeletePopup(hWndDlg);
@@ -182,13 +182,13 @@ LRESULT CALLBACK MraPopupDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_CONTEXTMENU:
if (dat->iPopupType == MRA_POPUP_TYPE_EMAIL_STATUS)
- dat->ppro->hWndEMailPopupStatus = NULL;
+ dat->ppro->hWndEMailPopupStatus = nullptr;
PUDeletePopup(hWndDlg);
break;
case UM_FREEPLUGINDATA:
if (dat->iPopupType == MRA_POPUP_TYPE_EMAIL_STATUS)
- dat->ppro->hWndEMailPopupStatus = NULL;
+ dat->ppro->hWndEMailPopupStatus = nullptr;
mir_free(dat);
break;
}
@@ -217,7 +217,7 @@ void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, LPWSTR lpszTitle, // delete old email popup
if (dwType == MRA_POPUP_TYPE_EMAIL_STATUS && hWndEMailPopupStatus) {
PUDeletePopup(hWndEMailPopupStatus);
- hWndEMailPopupStatus = NULL;
+ hWndEMailPopupStatus = nullptr;
}
POPUPDATAT ppd = { 0 };
@@ -227,19 +227,19 @@ void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, LPWSTR lpszTitle, ppd.lchIcon = g_hMainIcon;
break;
case MRA_POPUP_TYPE_DEBUG:// IDI_APPLICATION
- ppd.lchIcon = (HICON)LoadImage(NULL, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_SHARED);
+ ppd.lchIcon = (HICON)LoadImage(nullptr, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_SHARED);
break;
case MRA_POPUP_TYPE_INFORMATION:// IDI_INFORMATION
- ppd.lchIcon = (HICON)LoadImage(NULL, IDI_INFORMATION, IMAGE_ICON, 0, 0, LR_SHARED);
+ ppd.lchIcon = (HICON)LoadImage(nullptr, IDI_INFORMATION, IMAGE_ICON, 0, 0, LR_SHARED);
break;
case MRA_POPUP_TYPE_QUESTION:// IDI_QUESTION
- ppd.lchIcon = (HICON)LoadImage(NULL, IDI_QUESTION, IMAGE_ICON, 0, 0, LR_SHARED);
+ ppd.lchIcon = (HICON)LoadImage(nullptr, IDI_QUESTION, IMAGE_ICON, 0, 0, LR_SHARED);
break;
case MRA_POPUP_TYPE_WARNING:// IDI_WARNING
- ppd.lchIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
+ ppd.lchIcon = (HICON)LoadImage(nullptr, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
break;
case MRA_POPUP_TYPE_ERROR:// IDI_ERROR
- ppd.lchIcon = (HICON)LoadImage(NULL, IDI_ERROR, IMAGE_ICON, 0, 0, LR_SHARED);
+ ppd.lchIcon = (HICON)LoadImage(nullptr, IDI_ERROR, IMAGE_ICON, 0, 0, LR_SHARED);
break;
case MRA_POPUP_TYPE_EMAIL_STATUS:
ppd.lchIcon = (HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_MAIL_NOTIFY), IMAGE_ICON, 0, 0, LR_SHARED);
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index ca19b6290a..91f84dca59 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -91,7 +91,7 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM) // âñåõ â offline // òê unsaved values ñîõðàíÿþòñÿ èõ íóæíî èíèöèàëèçèðîâàòü
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact != NULL; hContact = db_find_next(hContact, m_szModuleName))
- SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, 0, 0, 0);
+ SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, nullptr, nullptr, nullptr);
// unsaved values
db_set_resident(m_szModuleName, "LogonTS");
@@ -208,7 +208,7 @@ int CMraProto::AuthDeny(MEVENT hDBEvent, const wchar_t* szReason) if (mir_strcmp(dbei.szModule, m_szModuleName)) return 1;
DB_AUTH_BLOB blob(dbei.pBlob);
- MraMessage(FALSE, NULL, 0, 0, blob.get_email(), szReason, NULL, 0);
+ MraMessage(FALSE, NULL, 0, 0, blob.get_email(), szReason, nullptr, 0);
return 0;
}
@@ -221,11 +221,11 @@ int CMraProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) HANDLE CMraProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t *szPath)
{
- if (szPath != NULL)
+ if (szPath != nullptr)
if (MraFilesQueueAccept(hFilesQueueHandle, (DWORD_PTR)hTransfer, szPath, mir_wstrlen(szPath)) == NO_ERROR)
return hTransfer; // Success
- return NULL;
+ return nullptr;
}
int CMraProto::FileCancel(MCONTACT hContact, HANDLE hTransfer)
@@ -301,7 +301,7 @@ HANDLE CMraProto::SearchByEmail(const wchar_t *email) return MraWPRequestByEMail(NULL, ACKTYPE_SEARCH, szEmail);
}
- return NULL;
+ return nullptr;
}
HANDLE CMraProto::SearchByName(const wchar_t *pszNick, const wchar_t *pszFirstName, const wchar_t *pszLastName)
@@ -314,7 +314,7 @@ HANDLE CMraProto::SearchByName(const wchar_t *pszNick, const wchar_t *pszFirstNa return MraWPRequestW(NULL, ACKTYPE_SEARCH, dwRequestFlags, "", "", pszNick, pszFirstName, pszLastName, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -350,12 +350,12 @@ int CMraProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONTACT *hCo }
bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
- iRet = MraMessage(bSlowSend, hContact, ACKTYPE_CONTACTS, MESSAGE_FLAG_CONTACT, szEmail, wszData, NULL, 0);
+ iRet = MraMessage(bSlowSend, hContact, ACKTYPE_CONTACTS, MESSAGE_FLAG_CONTACT, szEmail, wszData, nullptr, 0);
if (bSlowSend == FALSE)
ProtoBroadcastAck(hContact, ACKTYPE_CONTACTS, ACKRESULT_SUCCESS, (HANDLE)iRet, 0);
}
}
- else ProtoBroadcastAck(hContact, ACKTYPE_CONTACTS, ACKRESULT_FAILED, NULL, (LPARAM)"You cannot send when you are offline.");
+ else ProtoBroadcastAck(hContact, ACKTYPE_CONTACTS, ACKRESULT_FAILED, nullptr, (LPARAM)"You cannot send when you are offline.");
return iRet;
}
@@ -363,7 +363,7 @@ int CMraProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONTACT *hCo HANDLE CMraProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFiles)
{
if (!m_bLoggedIn || !hContact || !ppszFiles)
- return NULL;
+ return nullptr;
size_t dwFilesCount;
for (dwFilesCount = 0; ppszFiles[dwFilesCount]; dwFilesCount++);
@@ -376,14 +376,14 @@ HANDLE CMraProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFile int CMraProto::SendMsg(MCONTACT hContact, int, const char *lpszMessage)
{
if (!m_bLoggedIn) {
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)"You cannot send when you are offline.");
+ ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)"You cannot send when you are offline.");
return 0;
}
DWORD dwFlags = 0;
CMStringW wszMessage(ptrW(mir_utf8decodeW(lpszMessage)));
if (wszMessage.IsEmpty()) {
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)"Cant allocate buffer for convert to unicode.");
+ ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)"Cant allocate buffer for convert to unicode.");
return 0;
}
@@ -425,8 +425,8 @@ int CMraProto::SetApparentMode(MCONTACT hContact, int mode) break;
}
- if (MraModifyContact(hContact, 0, &dwContactFlag)) {
- SetContactBasicInfoW(hContact, 0, SCBIF_FLAG, 0, 0, dwContactFlag, 0, 0, 0, 0, 0);
+ if (MraModifyContact(hContact, nullptr, &dwContactFlag)) {
+ SetContactBasicInfoW(hContact, 0, SCBIF_FLAG, 0, 0, dwContactFlag, 0, 0, nullptr, nullptr, nullptr);
return 0; // Success
}
}
@@ -463,9 +463,9 @@ int CMraProto::SetStatus(int iNewStatus) // âñåõ â offline, òîëüêî åñëè ìû áûâàëè ïîäêëþ÷åíû
if (dwOldStatusMode > ID_STATUS_OFFLINE)
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
- SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, 0, 0, 0);
+ SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, nullptr, nullptr, nullptr);
- if (m_hConnection != NULL)
+ if (m_hConnection != nullptr)
Netlib_Shutdown(m_hConnection);
}
else {
@@ -504,7 +504,7 @@ int CMraProto::SetStatus(int iNewStatus) HANDLE CMraProto::GetAwayMsg(MCONTACT hContact)
{
if (!m_bLoggedIn || !hContact)
- return 0;
+ return nullptr;
wchar_t szStatusDesc[MICBLOG_STATUS_MAX + MICBLOG_STATUS_MAX + MAX_PATH], szTime[64];
DWORD dwTime;
@@ -551,7 +551,7 @@ int CMraProto::UserIsTyping(MCONTACT hContact, int type) CMStringA szEmail;
if (MraGetContactStatus(hContact) != ID_STATUS_OFFLINE)
if (mraGetStringA(hContact, "e-mail", szEmail))
- if (MraMessage(FALSE, hContact, 0, MESSAGE_FLAG_NOTIFY, szEmail, L" ", NULL, 0))
+ if (MraMessage(FALSE, hContact, 0, MESSAGE_FLAG_NOTIFY, szEmail, L" ", nullptr, 0))
return 0;
return 1;
diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp index f12c479fee..373d77b19d 100644 --- a/protocols/MRA/src/MraRTFMsg.cpp +++ b/protocols/MRA/src/MraRTFMsg.cpp @@ -154,7 +154,7 @@ DWORD MraSymbolsToRTFTags(LPSTR lpszMessage, size_t dwMessageSize, LPSTR lpszMes while (dwFoundCount) {
for (i = 0;i<SYMBOLS_COUNT;i++)
- if (lpszFounded[i] && (lpszFounded[i]<lpszFounded[dwFirstFoundIndex] || lpszFounded[dwFirstFoundIndex] == NULL))
+ if (lpszFounded[i] && (lpszFounded[i]<lpszFounded[dwFirstFoundIndex] || lpszFounded[dwFirstFoundIndex] == nullptr))
dwFirstFoundIndex = i;
if (lpszFounded[dwFirstFoundIndex]) { // found
@@ -206,12 +206,12 @@ DWORD CMraProto::MraConvertToRTFW(const CMStringW &wszMessage, CMStringA &szMess LOGFONT lf = {0};
dwRTFFontColour = getDword("RTFFontColour", MRA_DEFAULT_RTF_FONT_COLOUR);
- if ( !mraGetContactSettingBlob(NULL, "RTFFont", &lf, sizeof(LOGFONT), NULL)) {
- HDC hDC = GetDC(NULL);// kegl
+ if ( !mraGetContactSettingBlob(NULL, "RTFFont", &lf, sizeof(LOGFONT), nullptr)) {
+ HDC hDC = GetDC(nullptr);// kegl
lf.lfCharSet = MRA_DEFAULT_RTF_FONT_CHARSET;
lf.lfHeight = -MulDiv(MRA_DEFAULT_RTF_FONT_SIZE, GetDeviceCaps(hDC, LOGPIXELSY), 72);
mir_wstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
- ReleaseDC(NULL, hDC);
+ ReleaseDC(nullptr, hDC);
}
dwFontSize = ((-lf.lfHeight)+(((-lf.lfHeight)+4)/8));
diff --git a/protocols/MRA/src/MraSelectEMail.cpp b/protocols/MRA/src/MraSelectEMail.cpp index 096da605d9..51d9078ff2 100644 --- a/protocols/MRA/src/MraSelectEMail.cpp +++ b/protocols/MRA/src/MraSelectEMail.cpp @@ -146,7 +146,7 @@ DWORD CMraProto::MraSelectEMailDlgShow(MCONTACT hContact, DWORD dwType) dat->ppro = this;
dat->hContact = hContact;
dat->dwType = dwType;
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_SELECT_EMAIL), NULL, MraSelectEMailDlgProc, (LPARAM)dat);
+ DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_SELECT_EMAIL), nullptr, MraSelectEMailDlgProc, (LPARAM)dat);
}
return 0;
}
diff --git a/protocols/MRA/src/MraSendQueue.cpp b/protocols/MRA/src/MraSendQueue.cpp index f35fea2fe6..52661d4fb1 100644 --- a/protocols/MRA/src/MraSendQueue.cpp +++ b/protocols/MRA/src/MraSendQueue.cpp @@ -42,7 +42,7 @@ void MraSendQueueDestroy(HANDLE hSendQueueHandle) MRA_SEND_QUEUE_ITEM *pmrasqiSendQueueItem;
{
mir_cslock l(pmrasqSendQueue->cs);
- while ( !ListMTItemGetFirst(pmrasqSendQueue, NULL, (LPVOID*)&pmrasqiSendQueueItem)) {
+ while ( !ListMTItemGetFirst(pmrasqSendQueue, nullptr, (LPVOID*)&pmrasqiSendQueueItem)) {
ListMTItemDelete(pmrasqSendQueue, pmrasqiSendQueueItem);
mir_free(pmrasqiSendQueueItem);
}
@@ -89,7 +89,7 @@ DWORD MraSendQueueFree(HANDLE hSendQueueHandle, DWORD dwCMDNum) mir_cslock l(pmrasqSendQueue->cs);
ListMTIteratorMoveFirst(pmrasqSendQueue, &lmtiIterator);
do {
- if ( !ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&pmrasqiSendQueueItem))
+ if ( !ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&pmrasqiSendQueueItem))
if (pmrasqiSendQueueItem->dwCMDNum == dwCMDNum) {
ListMTItemDelete(pmrasqSendQueue, pmrasqiSendQueueItem);
mir_free(pmrasqiSendQueueItem);
@@ -113,7 +113,7 @@ DWORD MraSendQueueFind(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD *pdwFlags, mir_cslock l(pmrasqSendQueue->cs);
ListMTIteratorMoveFirst(pmrasqSendQueue, &lmtiIterator);
do {
- if ( !ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&pmrasqiSendQueueItem))
+ if ( !ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&pmrasqiSendQueueItem))
if (pmrasqiSendQueueItem->dwCMDNum == dwCMDNum) {
if (pdwFlags) (*pdwFlags) = pmrasqiSendQueueItem->dwFlags;
if (phContact) (*phContact) = pmrasqiSendQueueItem->hContact;
@@ -144,7 +144,7 @@ DWORD MraSendQueueFindOlderThan(HANDLE hSendQueueHandle, DWORD dwTime, DWORD *pd ListMTIteratorMoveFirst(pmrasqSendQueue, &lmtiIterator);
do {
MRA_SEND_QUEUE_ITEM *pmrasqiSendQueueItem;
- if ( !ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&pmrasqiSendQueueItem))
+ if ( !ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&pmrasqiSendQueueItem))
if ((*((DWORDLONG*)&ftExpireTime))>(*((DWORDLONG*)&pmrasqiSendQueueItem->ftSendTime))) {
if (pdwCMDNum) *pdwCMDNum = pmrasqiSendQueueItem->dwCMDNum;
if (pdwFlags) *pdwFlags = pmrasqiSendQueueItem->dwFlags;
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index 957318c000..1c483c262c 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -30,7 +30,7 @@ INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM, LPARAM) if (!m_bLoggedIn)
return 0;
- if (MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_UPD_ALL_USERS_INFO_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Are you sure?"), TranslateT(MRA_UPD_ALL_USERS_INFO_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
CMStringA szEmail;
if (mraGetStringA(hContact, "e-mail", szEmail))
@@ -42,7 +42,7 @@ INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM, LPARAM) INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM, LPARAM)
{
- if (MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_CHK_USERS_AVATARS_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Are you sure?"), TranslateT(MRA_CHK_USERS_AVATARS_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
CMStringA szEmail;
if (mraGetStringA(hContact, "e-mail", szEmail))
@@ -58,10 +58,10 @@ INT_PTR CMraProto::MraRequestAuthForAll(WPARAM, LPARAM) if (!m_bLoggedIn)
return 0;
- if (MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_REQ_AUTH_FOR_ALL_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Are you sure?"), TranslateT(MRA_REQ_AUTH_FOR_ALL_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
DWORD dwContactSeverFlags;
- if (GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL) == NO_ERROR)
+ if (GetContactBasicInfoW(hContact, nullptr, nullptr, nullptr, &dwContactSeverFlags, nullptr, nullptr, nullptr, nullptr) == NO_ERROR)
if (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED && dwContactSeverFlags != -1)
MraRequestAuthorization(hContact, 0);
}
@@ -84,7 +84,7 @@ INT_PTR CMraProto::MraRequestAuthorization(WPARAM hContact, LPARAM) CMStringA szEmail;
if (mraGetStringA(hContact, "e-mail", szEmail)) {
BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
- int iRet = MraMessage(bSlowSend, hContact, ACKTYPE_AUTHREQ, MESSAGE_FLAG_AUTHORIZE, szEmail, wszAuthMessage, NULL, 0);
+ int iRet = MraMessage(bSlowSend, hContact, ACKTYPE_AUTHREQ, MESSAGE_FLAG_AUTHORIZE, szEmail, wszAuthMessage, nullptr, 0);
if (bSlowSend == FALSE)
ProtoBroadcastAck(hContact, ACKTYPE_AUTHREQ, ACKRESULT_SUCCESS, (HANDLE)iRet, 0);
@@ -222,7 +222,7 @@ int CMraProto::MraRebuildContactMenu(WPARAM hContact, LPARAM) bHasEMail = true;
bHasEMailMR = true;
bChatAgent = IsContactChatAgent(hContact);
- GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL);
+ GetContactBasicInfoW(hContact, nullptr, nullptr, nullptr, &dwContactSeverFlags, nullptr, nullptr, nullptr, nullptr);
mraGetStringW(hContact, DBSETTING_BLOGSTATUS, blogStatusMsgSize);
}
// non proto contact
@@ -315,7 +315,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM) }
else {
mi.name.w = (wchar_t*)lpcszXStatusNameDef[i];
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
}
hXStatusMenuItems[i] = Menu_AddStatusMenuItem(&mi, m_szModuleName);
}
@@ -327,7 +327,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM) HGENMENU CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bIsMain, const IconItem *pgdiItems, size_t dwCount, HGENMENU *hResult)
{
if (!pgdiItems || !dwCount || !hResult)
- return NULL;
+ return nullptr;
char szServiceFunction[MAX_PATH];
@@ -338,7 +338,7 @@ HGENMENU CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bI fnAddFunc = Menu_AddProtoMenuItem;
hRootMenu = Menu_GetProtocolRoot(this);
- if (hRootMenu == NULL) {
+ if (hRootMenu == nullptr) {
mi.name.w = m_tszUserName;
mi.flags = CMIF_UNICODE | CMIF_KEEPUNTRANSLATED;
mi.hIcolibItem = g_hMainIcon;
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index 68689c4385..aad1ff9c7c 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -165,12 +165,12 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L cf.lpLogFont = &lf;
cf.rgbColors = ppro->getDword("RTFFontColour", MRA_DEFAULT_RTF_FONT_COLOUR);
cf.Flags = (CF_SCREENFONTS | CF_EFFECTS | CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT);
- if (ppro->mraGetContactSettingBlob(NULL, "RTFFont", &lf, sizeof(LOGFONT), NULL) == FALSE) {
- HDC hDC = GetDC(NULL);// kegl
+ if (ppro->mraGetContactSettingBlob(NULL, "RTFFont", &lf, sizeof(LOGFONT), nullptr) == FALSE) {
+ HDC hDC = GetDC(nullptr);// kegl
lf.lfCharSet = MRA_DEFAULT_RTF_FONT_CHARSET;
lf.lfHeight = -MulDiv(MRA_DEFAULT_RTF_FONT_SIZE, GetDeviceCaps(hDC, LOGPIXELSY), 72);
mir_wstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
- ReleaseDC(NULL, hDC);
+ ReleaseDC(nullptr, hDC);
}
if (ChooseFont(&cf)) {
@@ -189,7 +189,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L wchar_t szBuff[MAX_PATH];
GetDlgItemText(hWndDlg, IDC_SERVER, szBuff, _countof(szBuff));
ppro->mraSetStringW(NULL, "Server", szBuff);
- ppro->setWord("ServerPort", (WORD)GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
+ ppro->setWord("ServerPort", (WORD)GetDlgItemInt(hWndDlg, IDC_SERVERPORT, nullptr, FALSE));
ppro->setByte("AutoAddContactsToServer", IsDlgButtonChecked(hWndDlg, IDC_AUTO_ADD_CONTACTS_TO_SERVER));
ppro->setByte("AutoAuthRequestOnLogon", IsDlgButtonChecked(hWndDlg, IDC_AUTO_AUTH_REQ_ON_LOGON));
ppro->setByte("AutoAuthGrandUsersInCList", IsDlgButtonChecked(hWndDlg, IDC_AUTO_AUTH_GRAND_IN_CLIST));
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index b9f669410c..effd097f75 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -23,7 +23,7 @@ DWORD CMraProto::StartConnect() MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, TranslateT("Please, setup password in options"));
else {
InterlockedExchange((volatile LONG*)&m_dwThreadWorkerLastPingTime, GetTickCount());
- if (INVALID_HANDLE_VALUE != ForkThreadEx(&CMraProto::MraThreadProc, NULL, 0))
+ if (INVALID_HANDLE_VALUE != ForkThreadEx(&CMraProto::MraThreadProc, nullptr, nullptr))
return 0; /* OK. */
MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, TranslateT("Thread creation failure"));
}
@@ -61,7 +61,7 @@ void CMraProto::MraThreadProc(LPVOID) InterlockedExchange((volatile LONG*)&m_dwThreadWorkerLastPingTime, GetTickCount());
m_hConnection = Netlib_OpenConnection(m_hNetlibUser, &nloc);
}
- while (--dwCurConnectReTryCount && m_hConnection == NULL);
+ while (--dwCurConnectReTryCount && m_hConnection == nullptr);
if (m_hConnection)
bConnected = TRUE;
@@ -84,7 +84,7 @@ void CMraProto::MraThreadProc(LPVOID) InterlockedExchange((volatile LONG*)&m_dwThreadWorkerLastPingTime, GetTickCount());
m_hConnection = Netlib_OpenConnection(m_hNetlibUser, &nloc);
}
- while (--dwCurConnectReTryCount && m_hConnection == NULL);
+ while (--dwCurConnectReTryCount && m_hConnection == nullptr);
if (m_hConnection) {
bConnected = TRUE;
@@ -98,7 +98,7 @@ void CMraProto::MraThreadProc(LPVOID) else {
if (bConnected == FALSE) {
ShowFormattedErrorMessage(L"Can't connect to MRIM server, error", GetLastError());
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NONETWORK);
}
}
@@ -145,7 +145,7 @@ DWORD CMraProto::MraGetNLBData(CMStringA &szHost, WORD *pwPort) InterlockedExchange((volatile LONG*)&m_dwThreadWorkerLastPingTime, GetTickCount());
nls.hReadConns[0] = Netlib_OpenConnection(m_hNetlibUser, &nloc);
}
- while (--dwCurConnectReTryCount && nls.hReadConns[0] == NULL);
+ while (--dwCurConnectReTryCount && nls.hReadConns[0] == nullptr);
if (nls.hReadConns[0]) {
nls.dwTimeout = 1000 * getDword("TimeOutReceiveNLB", MRA_DEFAULT_TIMEOUT_RECV_NLB);
@@ -215,7 +215,7 @@ DWORD CMraProto::MraNetworkDispatcher() m_dwNextPingSendTickTime = m_dwPingPeriod = MAXDWORD;
dwCMDNum = 0;
- MraSendCMD(MRIM_CS_HELLO, NULL, 0);
+ MraSendCMD(MRIM_CS_HELLO, nullptr, 0);
while (m_iStatus != ID_STATUS_OFFLINE && bContinue) {
int iSelectRet = Netlib_Select(&nls);
if (SOCKET_ERROR == iSelectRet) {
@@ -231,7 +231,7 @@ DWORD CMraProto::MraNetworkDispatcher() if (m_dwNextPingSendTickTime <= m_dwThreadWorkerLastPingTime) {
nls.dwTimeout = (m_dwPingPeriod * 1000);
m_dwNextPingSendTickTime = (m_dwThreadWorkerLastPingTime + nls.dwTimeout);
- MraSendCMD(MRIM_CS_PING, NULL, 0);
+ MraSendCMD(MRIM_CS_PING, nullptr, 0);
} else {
if (MAXDWORD != m_dwNextPingSendTickTime)
nls.dwTimeout = (m_dwNextPingSendTickTime - m_dwThreadWorkerLastPingTime);
@@ -383,7 +383,7 @@ bool CMraProto::CmdLoginAck() {
m_bLoggedIn = TRUE;
m_dwNextPingSendTickTime = 0; // force send ping
- MraSendCMD(MRIM_CS_PING, NULL, 0);
+ MraSendCMD(MRIM_CS_PING, nullptr, 0);
SetStatus(m_iDesiredStatus);
MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, GAIF_FORCE, NULL);
return true;
@@ -392,7 +392,7 @@ bool CMraProto::CmdLoginAck() // Unsuccessful authorization //LPS ## reason ## ïðè÷èíà îòêàçà
bool CMraProto::CmdLoginRejected(BinBuffer &buf)
{
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPASSWORD);
CMStringA reason; buf >> reason;
MraPopupShowW(NULL, MRA_POPUP_TYPE_ERROR, TranslateT("Logon error: invalid login/password"), _A2T(reason.c_str()));
@@ -412,7 +412,7 @@ bool CMraProto::CmdMessageAck(BinBuffer &buf) buf >> szMultiChatData; // LPS multichat_data
// ïîäòâåðæäàåì ïîëó÷åíèå, òîëüêî åñëè óäàëîñü åãî îáðàáîòàòü
- if (MraRecvCommand_Message((DWORD)_time32(NULL), dwFlags, szEmail, szText, szRTFText, szMultiChatData) == NO_ERROR)
+ if (MraRecvCommand_Message((DWORD)_time32(nullptr), dwFlags, szEmail, szText, szRTFText, szMultiChatData) == NO_ERROR)
if ((dwFlags & MESSAGE_FLAG_NORECV) == 0)
MraMessageRecv(szEmail, dwMsgID);
return true;
@@ -422,7 +422,7 @@ bool CMraProto::CmdMessageStatus(ULONG seq, BinBuffer &buf) {
DWORD dwAckType, dwTemp = buf.getDword();
MCONTACT hContact;
- if (!MraSendQueueFind(hSendQueueHandle, seq, NULL, &hContact, &dwAckType, NULL, NULL)) {
+ if (!MraSendQueueFind(hSendQueueHandle, seq, nullptr, &hContact, &dwAckType, nullptr, nullptr)) {
switch (dwTemp) {
case MESSAGE_DELIVERED:// Message delivered directly to user
ProtoBroadcastAckAsync(hContact, dwAckType, ACKRESULT_SUCCESS, (HANDLE)seq, 0);
@@ -562,7 +562,7 @@ bool CMraProto::CmdAuthAck(BinBuffer &buf) DBEVENTINFO dbei = {};
dbei.flags = DBEF_UTF;
dbei.szModule = m_szModuleName;
- dbei.timestamp = (DWORD)_time32(NULL);
+ dbei.timestamp = (DWORD)_time32(nullptr);
dbei.eventType = EVENTTYPE_ADDED;
dbei.cbBlob = szBuff.GetLength();
dbei.pBlob = (PBYTE)szBuff.GetString();
@@ -570,9 +570,9 @@ bool CMraProto::CmdAuthAck(BinBuffer &buf) }
DWORD dwTemp;
- GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwTemp, NULL, NULL, NULL, NULL);
+ GetContactBasicInfoW(hContact, nullptr, nullptr, nullptr, &dwTemp, nullptr, nullptr, nullptr, nullptr);
dwTemp &= ~CONTACT_INTFLAG_NOT_AUTHORIZED;
- SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, SCBIF_SERVER_FLAG, 0, 0, 0, dwTemp, 0, 0, 0, 0);
+ SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, SCBIF_SERVER_FLAG, 0, 0, 0, dwTemp, 0, nullptr, nullptr, nullptr);
setDword(hContact, "HooksLocked", TRUE);
db_unset(hContact, "CList", "NotOnList");
setDword(hContact, "HooksLocked", FALSE);
@@ -714,7 +714,7 @@ bool CMraProto::CmdUserStatus(BinBuffer &buf) bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf)
{
DWORD dwAckType; MCONTACT hContact;
- if (!MraSendQueueFind(hSendQueueHandle, seq, NULL, &hContact, &dwAckType, NULL, NULL)) {
+ if (!MraSendQueueFind(hSendQueueHandle, seq, nullptr, &hContact, &dwAckType, nullptr, nullptr)) {
DWORD dwTemp = buf.getDword();
switch (dwTemp) {
case CONTACT_OPER_SUCCESS:// ## äîáàâëåíèå ïðîèçâåäåíî óñïåøíî
@@ -725,7 +725,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) dwFlags |= SCBIF_GROUP_ID;
dwGroupID = MraMoveContactToGroup(hContact, -1, grpName);
}
- SetContactBasicInfoW(hContact, 0, dwFlags, buf.getDword(), dwGroupID, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, 0, 0, 0, 0);
+ SetContactBasicInfoW(hContact, 0, dwFlags, buf.getDword(), dwGroupID, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, 0, nullptr, nullptr, nullptr);
}
break;
case CONTACT_OPER_ERROR:// ## ïåðåäàííûå äàííûå áûëè íåêîððåêòíû
@@ -735,7 +735,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) ShowFormattedErrorMessage(L"Internal server error", NO_ERROR);
break;
case CONTACT_OPER_NO_SUCH_USER:// ## äîáàâëÿåìîãî ïîëüçîâàòåëÿ íå ñóùåñòâóåò â ñèñòåìå
- SetContactBasicInfoW(hContact, 0, SCBIF_SERVER_FLAG, 0, 0, 0, -1, 0, 0, 0, 0);
+ SetContactBasicInfoW(hContact, 0, SCBIF_SERVER_FLAG, 0, 0, 0, -1, 0, nullptr, nullptr, nullptr);
ShowFormattedErrorMessage(L"No such user to add", NO_ERROR);
break;
case CONTACT_OPER_INVALID_INFO:// ## íåêîððåêòíîå èìÿ ïîëüçîâàòåëÿ
@@ -762,14 +762,14 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf)
{
DWORD dwAckType, dwFlags; MCONTACT hContact;
- if (MraSendQueueFind(hSendQueueHandle, seq, &dwFlags, &hContact, &dwAckType, NULL, NULL)) {
+ if (MraSendQueueFind(hSendQueueHandle, seq, &dwFlags, &hContact, &dwAckType, nullptr, nullptr)) {
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, TranslateT("MRIM_ANKETA_INFO: not found in queue"));
return true;
}
switch (buf.getDword()) {
case MRIM_ANKETA_INFO_STATUS_NOUSER:// íå íàéäåíî íè îäíîé ïîäõîäÿùåé çàïèñè
- SetContactBasicInfoW(hContact, 0, SCBIF_SERVER_FLAG, 0, 0, 0, -1, 0, 0, 0, 0);
+ SetContactBasicInfoW(hContact, 0, SCBIF_SERVER_FLAG, 0, 0, 0, -1, 0, nullptr, nullptr, nullptr);
case MRIM_ANKETA_INFO_STATUS_DBERR:// îøèáêà áàçû äàííûõ
case MRIM_ANKETA_INFO_STATUS_RATELIMERR:// ñëèøêîì ìíîãî çàïðîñîâ, ïîèñê âðåìåííî çàïðåùåí
switch (dwAckType) {
@@ -805,7 +805,7 @@ bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf) while (!buf.eof()) {
// write to DB and exit loop
if (dwAckType == ACKTYPE_GETINFO && hContact) {
- setDword(hContact, "InfoTS", (DWORD)_time32(NULL));
+ setDword(hContact, "InfoTS", (DWORD)_time32(nullptr));
//MRA_LPS mralpsUsernameValue;
for (DWORD i = 0; i < dwFieldsNum; i++) {
CMStringA &fld = pmralpsFields[i];
@@ -927,7 +927,7 @@ bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf) }
} /* for */
// äëÿ àâòîðèçîâàííîãî íàì è òàê ïðèñûëàþò ïðàâèëüíûé ñòàòóñ
- GetContactBasicInfoW(hContact, &dwID, NULL, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL);
+ GetContactBasicInfoW(hContact, &dwID, nullptr, nullptr, &dwContactSeverFlags, nullptr, nullptr, nullptr, nullptr);
if (dwID == -1 || (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED)) {
/* Convert mail.ru statuses to miranda. */
dwStatus = GetMirandaStatusFromMraStatus(dwStatus, dwXStatus, &dwXStatus);
@@ -1019,7 +1019,7 @@ bool CMraProto::CmdGame(BinBuffer &buf) case GAME_INC_VERSION:
break;
case GAME_NO_SUCH_GAME:// user invisible
- if ((hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL)))
+ if ((hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, nullptr)))
if (MraGetContactStatus(hContact) == ID_STATUS_OFFLINE)
MraSetContactStatus(hContact, ID_STATUS_INVISIBLE);
break;
@@ -1244,7 +1244,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) MCONTACT hContact = MraHContactFromEmail(szEmail, TRUE, FALSE, &bAdded);
if (hContact) {
// already in list, remove the duplicate
- if (GetContactBasicInfoW(hContact, &dwTemp, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == NO_ERROR && dwTemp != -1) {
+ if (GetContactBasicInfoW(hContact, &dwTemp, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) == NO_ERROR && dwTemp != -1) {
_CrtDbgBreak();
}
else {
@@ -1252,7 +1252,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) if (bAdded) { // update user info
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_FLAG | SCBIF_SERVER_FLAG | SCBIF_STATUS | SCBIF_NICK | SCBIF_PHONES),
- dwID, dwGroupID, dwContactFlag, dwContactSeverFlags, dwTemp, NULL, &wszNick, &szCustomPhones);
+ dwID, dwGroupID, dwContactFlag, dwContactSeverFlags, dwTemp, nullptr, &wszNick, &szCustomPhones);
// request user info from server
MraUpdateContactInfo(hContact);
}
@@ -1264,7 +1264,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) }
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS),
- dwID, dwGroupID, dwContactFlag, dwContactSeverFlags, dwTemp, NULL, &wszNick, &szCustomPhones);
+ dwID, dwGroupID, dwContactFlag, dwContactSeverFlags, dwTemp, nullptr, &wszNick, &szCustomPhones);
if (wszNick.IsEmpty()) { // set the server-side nick
wszNick = pcli->pfnGetContactDisplayName(hContact, 0);
MraModifyContact(hContact, &dwID, &dwContactFlag, &dwGroupID, &szEmail, &wszNick, &szCustomPhones);
@@ -1309,7 +1309,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) wszAuthMessage = TranslateW(MRA_DEFAULT_AUTH_MESSAGE);
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- if (GetContactBasicInfoW(hContact, &dwID, NULL, NULL, NULL, NULL, &email, NULL, NULL) == NO_ERROR)
+ if (GetContactBasicInfoW(hContact, &dwID, nullptr, nullptr, nullptr, nullptr, &email, nullptr, nullptr) == NO_ERROR)
if (dwID == -1) {
if (IsEMailChatAgent(email)) {// ÷àò: åù¸ ðàç çàïðîñèì àâòîðèçàöèþ, ïîìåòèì êàê âèäèìûé â ñïèñêå, ïîñòîÿííûé
db_unset(hContact, "CList", "Hidden");
@@ -1324,7 +1324,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) if (db_get_b(hContact, "CList", "NotOnList", 0) == 0) { // set extra icons and upload contact
SetExtraIcons(hContact);
if (getByte("AutoAddContactsToServer", MRA_DEFAULT_AUTO_ADD_CONTACTS_TO_SERVER)) { //add all contacts to server
- GetContactBasicInfoW(hContact, NULL, &dwGroupID, NULL, NULL, NULL, NULL, &nick, &phones);
+ GetContactBasicInfoW(hContact, nullptr, &dwGroupID, nullptr, nullptr, nullptr, nullptr, &nick, &phones);
MraAddContact(hContact, (CONTACT_FLAG_VISIBLE | CONTACT_FLAG_UNICODE_NAME), dwGroupID, email, nick, &phones, &wszAuthMessage);
}
}
@@ -1339,7 +1339,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) // âñåõ â offline è id â íåñòàíäàðò
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS),
- -1, -2, 0, 0, ID_STATUS_OFFLINE, 0, 0, 0);
+ -1, -2, 0, 0, ID_STATUS_OFFLINE, nullptr, nullptr, nullptr);
// request user info from server
MraUpdateContactInfo(hContact);
}
@@ -1441,7 +1441,7 @@ bool CMraProto::CmdBlogStatus(BinBuffer &buf) buf >> dwFlags >> szEmail >> dwBlogStatusID >> dwTime >> wszText >> szString;
- if (MCONTACT hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL)) {
+ if (MCONTACT hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, nullptr)) {
if (dwFlags & MRIM_BLOG_STATUS_MUSIC)
mraSetStringW(hContact, DBSETTING_BLOGSTATUSMUSIC, wszText);
else {
@@ -1492,7 +1492,7 @@ bool CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader) case MRIM_CS_CONNECTION_PARAMS:// Èçìåíåíèå ïàðàìåòðîâ ñîåäèíåíèÿ
buf >> m_dwPingPeriod;
m_dwNextPingSendTickTime = 0; // force send ping
- MraSendCMD(MRIM_CS_PING, NULL, 0);
+ MraSendCMD(MRIM_CS_PING, nullptr, 0);
break;
case MRIM_CS_LOGOUT:// Ïîëüçîâàòåëü îòêëþ÷åí èç-çà ïàðàëëåëüíîãî âõîäà ñ åãî ëîãèíîì.
@@ -1514,7 +1514,7 @@ bool CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader) case MRIM_CS_SMS_ACK:
buf >> dwTemp;
- if (MraSendQueueFind(hSendQueueHandle, pmaHeader->seq, NULL, &hContact, &dwAckType, &pByte, &dwSize) == NO_ERROR) {
+ if (MraSendQueueFind(hSendQueueHandle, pmaHeader->seq, nullptr, &hContact, &dwAckType, &pByte, &dwSize) == NO_ERROR) {
/* pByte point to phone number ansi string. */
/* dwAckType = ICQACKTYPE_SMS */
CMStringA szEmail;
@@ -1662,12 +1662,12 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & if (dwFlags & MESSAGE_SMS_DELIVERY_REPORT) {
szText.Format("<sms_delivery_receipt><message_id>%s-1-1955988055-%s</message_id><destination>%s</destination><delivered>No</delivered><submition_time>%s</submition_time><error_code>0</error_code><error><id>15</id><params><param>%s</param></params></error></sms_delivery_receipt>",
szEmail.c_str(), szPhone.c_str(), szPhone.c_str(), szTime.c_str(), lpszMessageUTF);
- ProtoBroadcastAck(NULL, ICQACKTYPE_SMS, ACKRESULT_FAILED, 0, (LPARAM)szText.GetString());
+ ProtoBroadcastAck(NULL, ICQACKTYPE_SMS, ACKRESULT_FAILED, nullptr, (LPARAM)szText.GetString());
}
else { // new sms
szText.Format("<sms_message><source>Mail.ru</source><destination_UIN>%s</destination_UIN><sender>%s</sender><senders_network>Mail.ru</senders_network><text>%s</text><time>%s</time></sms_message>",
szEmail.c_str(), szPhone.c_str(), lpszMessageUTF, szTime.c_str());
- ProtoBroadcastAck(NULL, ICQACKTYPE_SMS, ACKRESULT_SUCCESS, 0, (LPARAM)szText.GetString());
+ ProtoBroadcastAck(NULL, ICQACKTYPE_SMS, ACKRESULT_SUCCESS, nullptr, (LPARAM)szText.GetString());
}
}
else {
@@ -1748,7 +1748,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & if (bAutoGrantAuth) { // auto grant auth
DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
- dbei.timestamp = _time32(NULL);
+ dbei.timestamp = _time32(nullptr);
dbei.flags = DBEF_READ | DBEF_UTF;
dbei.eventType = EVENTTYPE_AUTHREQUEST;
dbei.pBlob = (PBYTE)szBlob.c_str();
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 67f0969a99..0090d056ca 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -61,7 +61,7 @@ LPCSTR lpcszStatusUri[] = "status_52",
"status_53",
"status_dating",
- NULL
+ nullptr
};
LPCWSTR lpcszXStatusNameDef[] =
@@ -116,7 +116,7 @@ LPCWSTR lpcszXStatusNameDef[] = LPGENW("Star"),
LPGENW("Music"),
LPGENW("Dating"),
- NULL
+ nullptr
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -124,7 +124,7 @@ LPCWSTR lpcszXStatusNameDef[] = void CMraProto::SetExtraIcons(MCONTACT hContact)
{
DWORD dwID, dwGroupID, dwContactSeverFlags;
- if (GetContactBasicInfoW(hContact, &dwID, &dwGroupID, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL))
+ if (GetContactBasicInfoW(hContact, &dwID, &dwGroupID, nullptr, &dwContactSeverFlags, nullptr, nullptr, nullptr, nullptr))
return;
DWORD dwIconID = -1;
@@ -155,8 +155,8 @@ void CMraProto::SetExtraIcons(MCONTACT hContact) }
ExtraIcon_SetIcon(hExtraXstatusIcon, hContact,
- (IsXStatusValid(dwXStatus) || dwXStatus == MRA_MIR_XSTATUS_UNKNOWN) ? hXStatusAdvancedStatusIcons[dwXStatus] : NULL);
- ExtraIcon_SetIcon(hExtraInfo, hContact, (dwIconID != -1) ? gdiExtraStatusIconsItems[dwIconID].hIcolib : NULL);
+ (IsXStatusValid(dwXStatus) || dwXStatus == MRA_MIR_XSTATUS_UNKNOWN) ? hXStatusAdvancedStatusIcons[dwXStatus] : nullptr);
+ ExtraIcon_SetIcon(hExtraInfo, hContact, (dwIconID != -1) ? gdiExtraStatusIconsItems[dwIconID].hIcolib : nullptr);
}
INT_PTR CMraProto::MraXStatusMenu(WPARAM, LPARAM, LPARAM param)
@@ -175,7 +175,7 @@ int CMraProto::MraContactDeleted(WPARAM hContact, LPARAM) if (IsContactMra(hContact)) {
DWORD dwID, dwGroupID;
- GetContactBasicInfoW(hContact, &dwID, &dwGroupID, NULL, NULL, NULL, NULL, NULL, NULL);
+ GetContactBasicInfoW(hContact, &dwID, &dwGroupID, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
MraSetContactStatus(hContact, ID_STATUS_OFFLINE);
if (!db_get_b(hContact, "CList", "NotOnList", 0) || dwID != -1) {
@@ -218,7 +218,7 @@ int CMraProto::MraDbSettingChanged(WPARAM hContact, LPARAM lParam) break;
}
if (wszNick.GetLength())
- MraModifyContact(hContact, 0, 0, 0, 0, &wszNick);
+ MraModifyContact(hContact, nullptr, nullptr, nullptr, nullptr, &wszNick);
}
}
// Group setting
@@ -254,7 +254,7 @@ int CMraProto::MraDbSettingChanged(WPARAM hContact, LPARAM lParam) CMStringA szEmail, szPhones;
CMStringW wszNick;
DWORD dwGroupID, dwContactFlag;
- GetContactBasicInfoW(hContact, NULL, &dwGroupID, &dwContactFlag, NULL, NULL, &szEmail, &wszNick, &szPhones);
+ GetContactBasicInfoW(hContact, nullptr, &dwGroupID, &dwContactFlag, nullptr, nullptr, &szEmail, &wszNick, &szPhones);
MraAddContact(hContact, dwContactFlag, dwGroupID, szEmail, wszNick, &szPhones, &wszAuthMessage);
}
}
@@ -266,7 +266,7 @@ int CMraProto::MraDbSettingChanged(WPARAM hContact, LPARAM lParam) else
dwContactFlag |= CONTACT_FLAG_SHADOW;
- MraModifyContact(hContact, 0, &dwContactFlag);
+ MraModifyContact(hContact, nullptr, &dwContactFlag);
}
}
// Ignore section
@@ -278,7 +278,7 @@ int CMraProto::MraDbSettingChanged(WPARAM hContact, LPARAM lParam) else
dwContactFlag |= CONTACT_FLAG_IGNORE;
- MraModifyContact(hContact, 0, &dwContactFlag);
+ MraModifyContact(hContact, nullptr, &dwContactFlag);
}
}
// User info section
@@ -303,7 +303,7 @@ INT_PTR CMraProto::MraSetListeningTo(WPARAM, LPARAM lParam) {
LISTENINGTOINFO *pliInfo = (LISTENINGTOINFO*)lParam;
- if (pliInfo == NULL || pliInfo->cbSize != sizeof(LISTENINGTOINFO)) {
+ if (pliInfo == nullptr || pliInfo->cbSize != sizeof(LISTENINGTOINFO)) {
MraChangeUserBlogStatus(MRIM_BLOG_STATUS_MUSIC, L"", 0);
delSetting(DBSETTING_BLOGSTATUSMUSIC);
}
@@ -461,7 +461,7 @@ INT_PTR CMraProto::MraGetXStatusEx(WPARAM hContact, LPARAM lParam) // fill status name member
if (pData->flags & CSSF_MASK_NAME) {
if (pData->flags & CSSF_DEFAULT_NAME) {
- DWORD dwXStatus = (pData->wParam == NULL) ? m_iXStatus : *pData->wParam;
+ DWORD dwXStatus = (pData->wParam == nullptr) ? m_iXStatus : *pData->wParam;
if (!IsXStatusValid(dwXStatus))
return 1;
@@ -472,15 +472,15 @@ INT_PTR CMraProto::MraGetXStatusEx(WPARAM hContact, LPARAM lParam) if (dwStatusTitleSize > STATUS_TITLE_MAX)
dwStatusTitleSize = STATUS_TITLE_MAX;
- WideCharToMultiByte(MRA_CODE_PAGE, 0, lpcszXStatusNameDef[dwXStatus], (DWORD)dwStatusTitleSize, pData->pszName, MAX_PATH, NULL, NULL);
+ WideCharToMultiByte(MRA_CODE_PAGE, 0, lpcszXStatusNameDef[dwXStatus], (DWORD)dwStatusTitleSize, pData->pszName, MAX_PATH, nullptr, nullptr);
(*((CHAR*)(pData->pszName + dwStatusTitleSize))) = 0;
}
}
else {
if (pData->flags & CSSF_UNICODE)
- mraGetStaticStringW(hContact, DBSETTING_XSTATUSNAME, pData->pwszName, (STATUS_TITLE_MAX + 1), NULL);
+ mraGetStaticStringW(hContact, DBSETTING_XSTATUSNAME, pData->pwszName, (STATUS_TITLE_MAX + 1), nullptr);
else
- mraGetStaticStringA(hContact, DBSETTING_XSTATUSNAME, pData->pszName, (STATUS_TITLE_MAX + 1), NULL);
+ mraGetStaticStringA(hContact, DBSETTING_XSTATUSNAME, pData->pszName, (STATUS_TITLE_MAX + 1), nullptr);
}
}
@@ -489,9 +489,9 @@ INT_PTR CMraProto::MraGetXStatusEx(WPARAM hContact, LPARAM lParam) char szSetting[100];
mir_snprintf(szSetting, "XStatus%dMsg", m_iXStatus);
if (pData->flags & CSSF_UNICODE)
- mraGetStaticStringW(hContact, szSetting, pData->pwszMessage, (STATUS_DESC_MAX + 1), NULL);
+ mraGetStaticStringW(hContact, szSetting, pData->pwszMessage, (STATUS_DESC_MAX + 1), nullptr);
else
- mraGetStaticStringA(hContact, szSetting, pData->pszMessage, (STATUS_DESC_MAX + 1), NULL);
+ mraGetStaticStringA(hContact, szSetting, pData->pszMessage, (STATUS_DESC_MAX + 1), nullptr);
}
if ((pData->flags & CSSF_DISABLE_UI) && pData->wParam)
@@ -502,8 +502,8 @@ INT_PTR CMraProto::MraGetXStatusEx(WPARAM hContact, LPARAM lParam) //**deb ìîæíî îïòèìèçèðîâàòü, äàííûé ïàðàìåòð âîçìîæíî óæå áûë âû÷èñëåí ïðè ïîëó÷åíèè ñàìèõ òåêñòîâ
if (pData->flags & CSSF_STR_SIZES) {
- if (pData->wParam) mraGetStaticStringW(hContact, DBSETTING_XSTATUSNAME, NULL, 0, (size_t*)pData->wParam);
- if (pData->lParam) mraGetStaticStringW(hContact, DBSETTING_XSTATUSMSG, NULL, 0, (size_t*)pData->lParam);
+ if (pData->wParam) mraGetStaticStringW(hContact, DBSETTING_XSTATUSNAME, nullptr, 0, (size_t*)pData->wParam);
+ if (pData->lParam) mraGetStaticStringW(hContact, DBSETTING_XSTATUSMSG, nullptr, 0, (size_t*)pData->lParam);
}
return 0;
}
@@ -571,7 +571,7 @@ INT_PTR CMraProto::MraSendNudge(WPARAM hContact, LPARAM) CMStringA szEmail;
if (mraGetStringA(hContact, "e-mail", szEmail))
- if (MraMessage(FALSE, hContact, 0, (MESSAGE_FLAG_RTF | MESSAGE_FLAG_ALARM), szEmail, lpwszAlarmMessage, NULL, 0))
+ if (MraMessage(FALSE, hContact, 0, (MESSAGE_FLAG_RTF | MESSAGE_FLAG_ALARM), szEmail, lpwszAlarmMessage, nullptr, 0))
return 0;
}
return 1;
@@ -615,7 +615,7 @@ INT_PTR CMraProto::MraGetAvatarInfo(WPARAM wParam, LPARAM lParam) {
if (lParam) {
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
- return (INT_PTR)MraAvatarsQueueGetAvatar(hAvatarsQueueHandle, (DWORD)wParam, pai->hContact, NULL, (DWORD*)&pai->format, pai->filename);
+ return (INT_PTR)MraAvatarsQueueGetAvatar(hAvatarsQueueHandle, (DWORD)wParam, pai->hContact, nullptr, (DWORD*)&pai->format, pai->filename);
}
return GAIR_NOAVATAR;
}
@@ -638,10 +638,10 @@ int CMraProto::OnGroupChanged(WPARAM hContact, LPARAM lParam) {
if (hContact == NULL) {
CLISTGROUPCHANGE *cgc = (CLISTGROUPCHANGE*)lParam;
- if (cgc->pszOldName == NULL)
+ if (cgc->pszOldName == nullptr)
return 0;
- MraGroupItem *pGrp = NULL;
+ MraGroupItem *pGrp = nullptr;
for (int i = 0; i < m_groups.getCount(); i++) {
MraGroupItem &p = m_groups[i];
if (!mir_wstrcmp(p.m_name, cgc->pszOldName)) {
@@ -649,18 +649,18 @@ int CMraProto::OnGroupChanged(WPARAM hContact, LPARAM lParam) break;
}
}
- if (pGrp == NULL) // no MRA contacts in it
+ if (pGrp == nullptr) // no MRA contacts in it
return 0;
DWORD dwFlags = CONTACT_FLAG_GROUP;
CMStringW wszGroup;
- if (cgc->pszNewName != NULL) // renaming group
+ if (cgc->pszNewName != nullptr) // renaming group
wszGroup = cgc->pszNewName;
else { // removing group
dwFlags |= CONTACT_FLAG_REMOVED;
wszGroup = cgc->pszOldName;
}
- MraModifyContact(NULL, &pGrp->m_id, &dwFlags, 0, 0, &wszGroup);
+ MraModifyContact(NULL, &pGrp->m_id, &dwFlags, nullptr, nullptr, &wszGroup);
}
return 0;
}
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index 6be1bed1dd..5ff0f96647 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "version.h"
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInst, g_hOpenssl = NULL;
+HINSTANCE g_hInst, g_hOpenssl = nullptr;
int hLangpack;
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index 37d6208a8d..7e2858ceff 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -36,7 +36,7 @@ extern "C" /* WinINET delayloading */
typedef BOOL (*pfnInternetGetCookieExA)(LPCSTR, LPCSTR, LPSTR, LPDWORD, DWORD, LPVOID);
-pfnInternetGetCookieExA fpInternetGetCookieExA = NULL;
+pfnInternetGetCookieExA fpInternetGetCookieExA = nullptr;
#define LOAD_FN(name) (##name = (pfn##name)GetProcAddress(hLibSkylogin, #name))
@@ -148,9 +148,9 @@ static const char authPacket[] = // Tokens, tokens, tokens.....
GenericToken::GenericToken(const char *pszTokenName) :
m_pszTokenName(pszTokenName),
- m_pszToken(NULL),
+ m_pszToken(nullptr),
m_tExpires(0),
- m_proto(NULL)
+ m_proto(nullptr)
{
}
@@ -210,7 +210,7 @@ void GenericToken::Clear() char szTokenName[64];
mir_free(m_pszToken);
- m_pszToken = NULL;
+ m_pszToken = nullptr;
m_tExpires = 0;
mir_snprintf(szTokenName, sizeof(szTokenName), "%sToken", m_pszTokenName);
m_proto->delSetting(szTokenName);
@@ -301,14 +301,14 @@ bool SkypeToken::Refresh(bool bForce) time_t tExpires = (*root)["expiresIn"].as_int();
if (tExpires == 0)
tExpires = 86400;
- SetToken("skype_token " + szToken, time(NULL) + tExpires);
+ SetToken("skype_token " + szToken, time(nullptr) + tExpires);
bRet = true;
}
}
}
Netlib_FreeHttpRequest(nlhrReply);
}
- else m_proto->hHttpsConnection = NULL;
+ else m_proto->hHttpsConnection = nullptr;
return bRet;
}
@@ -319,7 +319,7 @@ const char* SkypeToken::XSkypetoken() char *pszRet = strchr(m_pszToken, ' ');
if (pszRet) return pszRet + 1;
}
- return NULL;
+ return nullptr;
}
@@ -351,7 +351,7 @@ int CMsnProto::MSN_GetPassportAuth(void) szPassword[99] = 0;
- time_t ts = time(NULL);
+ time_t ts = time(nullptr);
wchar_t szTs1[64], szTs2[64];
TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, L"I", szTs1, _countof(szTs1), 0);
@@ -364,13 +364,13 @@ int CMsnProto::MSN_GetPassportAuth(void) mir_strcpy(szPassportHost, defaultPassportUrl);
bool defaultUrlAllow = mir_strcmp(szPassportHost, defaultPassportUrl) != 0;
- char *tResult = NULL;
+ char *tResult = nullptr;
while (retVal == -1) {
unsigned status;
- tResult = getSslResult(&szPassportHost, szAuthInfo, NULL, status);
- if (tResult == NULL) {
+ tResult = getSslResult(&szPassportHost, szAuthInfo, nullptr, status);
+ if (tResult == nullptr) {
if (defaultUrlAllow) {
mir_strcpy(szPassportHost, defaultPassportUrl);
defaultUrlAllow = false;
@@ -386,14 +386,14 @@ int CMsnProto::MSN_GetPassportAuth(void) case 200:
const char *errurl;
{
- errurl = NULL;
+ errurl = nullptr;
ezxml_t xml = ezxml_parse_str(tResult, mir_strlen(tResult));
ezxml_t tokr = ezxml_get(xml, "S:Body", 0,
"wst:RequestSecurityTokenResponseCollection", 0,
"wst:RequestSecurityTokenResponse", -1);
- while (tokr != NULL) {
+ while (tokr != nullptr) {
ezxml_t toks = ezxml_get(tokr, "wst:RequestedSecurityToken", 0,
"wsse:BinarySecurityToken", -1);
@@ -402,7 +402,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(NULL) + 86400;
+ expires = xml_expires ? IsoToUnixTime(ezxml_txt(xml_expires)) : time(nullptr) + 86400;
if (mir_strcmp(addr, "http://Passport.NET/tb") == 0) {
@@ -454,7 +454,7 @@ int CMsnProto::MSN_GetPassportAuth(void) ezxml_t tokf = ezxml_get(xml, "S:Body", 0, "S:Fault", 0, "S:Detail", -1);
ezxml_t tokrdr = ezxml_child(tokf, "psf:redirectUrl");
- if (tokrdr != NULL) {
+ if (tokrdr != nullptr) {
mir_strcpy(szPassportHost, ezxml_txt(tokrdr));
debugLogA("Redirected to '%s'", szPassportHost);
}
@@ -494,7 +494,7 @@ int CMsnProto::MSN_GetPassportAuth(void) switch (retVal) {
case 3:
MSN_ShowError("Your username or password is incorrect");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPASSWORD);
break;
case 5:
@@ -502,7 +502,7 @@ int CMsnProto::MSN_GetPassportAuth(void) default:
MSN_ShowError("Unable to contact MS Passport servers check proxy/firewall settings");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NOSERVER);
break;
}
}
@@ -804,13 +804,13 @@ bool CMsnProto::RefreshOAuth(const char *pszRefreshToken, const char *pszService if (*ptExpires == 0)
bRet = false;
else
- *ptExpires += time(0);
+ *ptExpires += time(nullptr);
}
}
}
Netlib_FreeHttpRequest(nlhrReply);
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
return bRet;
}
@@ -926,9 +926,9 @@ LRESULT CALLBACK AuthWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar if (hMod) fpInternetGetCookieExA = (pfnInternetGetCookieExA)GetProcAddress(hMod, "InternetGetCookieExA");
}
if (fpInternetGetCookieExA &&
- fpInternetGetCookieExA("https://login.live.com", NULL, NULL, &cbCookie, INTERNET_COOKIE_HTTPONLY, NULL) &&
+ fpInternetGetCookieExA("https://login.live.com", nullptr, nullptr, &cbCookie, INTERNET_COOKIE_HTTPONLY, nullptr) &&
(pAuth->pszCookies = (char*)mir_alloc(cbCookie))) {
- fpInternetGetCookieExA("https://login.live.com", NULL, pAuth->pszCookies, &cbCookie, INTERNET_COOKIE_HTTPONLY, NULL);
+ fpInternetGetCookieExA("https://login.live.com", nullptr, pAuth->pszCookies, &cbCookie, INTERNET_COOKIE_HTTPONLY, nullptr);
}
else pAuth->pszCookies = mir_u2a(pAuth->pEmbed->getCookies());
PostMessage(hwnd, WM_CLOSE, 0, 0);
@@ -964,7 +964,7 @@ void __cdecl CMsnProto::msn_IEAuthThread(void *pParam) WNDCLASSEX wc = { 0 };
static const wchar_t *ClassName = L"SkypeLoginWindow";
- CoInitialize(NULL);
+ CoInitialize(nullptr);
wc.cbSize = sizeof(WNDCLASSEX);
wc.cbWndExtra = sizeof(void*);
@@ -975,11 +975,11 @@ void __cdecl CMsnProto::msn_IEAuthThread(void *pParam) if ((hWnd = CreateWindowEx(0, ClassName, L"MSN Login", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
- HWND_DESKTOP, NULL, g_hInst, pParam))) {
+ HWND_DESKTOP, nullptr, g_hInst, pParam))) {
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
- while (GetMessage(&msg, NULL, 0, 0)) {
+ while (GetMessage(&msg, nullptr, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -1122,7 +1122,7 @@ int CMsnProto::MSN_AuthOAuth(void) /* Get POST-Data and URL */
if (parseLoginPage(nlhrReply->pData, &nlhr, &post)) {
/* Get Cookies */
- nlhr.headers[1].szValue = (char*)alloca(CopyCookies(nlhrReply, NULL));
+ nlhr.headers[1].szValue = (char*)alloca(CopyCookies(nlhrReply, nullptr));
CopyCookies(nlhrReply, &nlhr.headers[1]);
if (*nlhr.headers[1].szValue) nlhr.headersCount++;
@@ -1138,7 +1138,7 @@ int CMsnProto::MSN_AuthOAuth(void) NETLIBHTTPREQUEST *nlhrReply2 = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply2) {
- char *pszURL = NULL, *pAccessToken, *pEnd;
+ char *pszURL = nullptr, *pAccessToken, *pEnd;
hHttpsConnection = nlhrReply2->nlc;
bPassportAuth = true;
@@ -1157,7 +1157,7 @@ int CMsnProto::MSN_AuthOAuth(void) * window in order to let user login there. May also be used for 2-factor auth */
if (nlhrReply2->resultCode == 200 && nlhrReply2->pData) {
UINT uThreadId;
- IEAUTH_PARAM param = { NULL, this, &nlhr, nlhrReply2, NULL, NULL };
+ IEAUTH_PARAM param = { nullptr, this, &nlhr, nlhrReply2, nullptr, nullptr };
bAskingForAuth = true;
WaitForSingleObject(ForkThreadEx(&CMsnProto::msn_IEAuthThread, ¶m, &uThreadId), INFINITE);
@@ -1165,7 +1165,7 @@ int CMsnProto::MSN_AuthOAuth(void) mir_free(authCookies);
authCookies = nlhr.headers[1].szValue = param.pszCookies;
Netlib_FreeHttpRequest(nlhrReply2);
- nlhrReply2 = NULL;
+ nlhrReply2 = nullptr;
bAskingForAuth = false;
bPassportAuth = false;
}
@@ -1208,7 +1208,7 @@ int CMsnProto::MSN_AuthOAuth(void) /* Copy auth Cookies to class for other web requests like contact list fetching to avoid ActiveSync */
if (nlhrReply) {
mir_free(authCookies);
- authCookies = nlhr.headers[1].szValue = (char*)mir_alloc(CopyCookies(nlhrReply, NULL));
+ authCookies = nlhr.headers[1].szValue = (char*)mir_alloc(CopyCookies(nlhrReply, nullptr));
CopyCookies(nlhrReply, &nlhr.headers[1]);
}
@@ -1262,17 +1262,17 @@ int CMsnProto::MSN_AuthOAuth(void) }
else retVal = 0;
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
}
}
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
}
}
if (nlhrReply)
Netlib_FreeHttpRequest(nlhrReply);
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
if (retVal <= 0) authSkypeComToken.Clear(); else {
if (bPassportAuth) {
diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp index 88491305fd..130f52d1c1 100644 --- a/protocols/MSN/src/msn_avatar.cpp +++ b/protocols/MSN/src/msn_avatar.cpp @@ -22,9 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CMsnProto::AvatarQueue_Init()
{
- hevAvatarQueue = ::CreateSemaphore(NULL, 0, 255, NULL);
+ hevAvatarQueue = ::CreateSemaphore(nullptr, 0, 255, nullptr);
- ForkThread(&CMsnProto::MSN_AvatarsThread, 0);
+ ForkThread(&CMsnProto::MSN_AvatarsThread, nullptr);
}
void CMsnProto::AvatarQueue_Uninit()
@@ -34,9 +34,9 @@ void CMsnProto::AvatarQueue_Uninit() void CMsnProto::pushAvatarRequest(MCONTACT hContact, LPCSTR pszUrl)
{
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
- if (pszUrl != NULL && *pszUrl != 0) {
+ if (pszUrl != nullptr && *pszUrl != 0) {
mir_cslock lck(csAvatarQueue);
for (int i = 0; i < lsAvatarQueue.getCount(); i++)
@@ -44,7 +44,7 @@ void CMsnProto::pushAvatarRequest(MCONTACT hContact, LPCSTR pszUrl) return;
lsAvatarQueue.insert(new AvatarQueueEntry(hContact, pszUrl));
- ReleaseSemaphore(hevAvatarQueue, 1, NULL);
+ ReleaseSemaphore(hevAvatarQueue, 1, nullptr);
}
}
@@ -62,7 +62,7 @@ bool CMsnProto::loadHttpAvatar(AvatarQueueEntry *p) nlhr.headersCount = 1;
NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(m_hNetlibUser, &nlhr);
- if (nlhrReply == NULL)
+ if (nlhrReply == nullptr)
return false;
if (nlhrReply->resultCode != 200 || nlhrReply->dataLength == 0) {
@@ -103,7 +103,7 @@ void __cdecl CMsnProto::MSN_AvatarsThread(void*) if (g_bTerminated)
break;
- AvatarQueueEntry *p = NULL;
+ AvatarQueueEntry *p = nullptr;
{
mir_cslock lck(csAvatarQueue);
if (lsAvatarQueue.getCount() > 0) {
@@ -112,11 +112,11 @@ void __cdecl CMsnProto::MSN_AvatarsThread(void*) }
}
- if (p == NULL)
+ if (p == nullptr)
continue;
if (!loadHttpAvatar(p))
- ProtoBroadcastAck(p->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, 0, 0);
+ ProtoBroadcastAck(p->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, nullptr, 0);
delete p;
}
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index b971c362e2..1b3b530669 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -48,7 +48,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p char *szNet, *szEmail;
wcsncpy(info->mChatID, _A2T(pszID), _countof(info->mChatID));
- parseWLID(NEWSTR_ALLOCA(pszID), &szNet, &szEmail, NULL);
+ parseWLID(NEWSTR_ALLOCA(pszID), &szNet, &szEmail, nullptr);
info->netId = atoi(szNet);
strncpy(info->szEmail, szEmail, sizeof(info->szEmail));
@@ -77,7 +77,7 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli) // If Chat ID already exists, don'T create a new one
const char *pszID = ezxml_txt(ezxml_child(xmli, "id"));
GCThreadData* info = MSN_GetThreadByChatId(_A2T(pszID));
- if (info == NULL) {
+ if (info == nullptr) {
info = new GCThreadData;
{
mir_cslock lck(m_csThreads);
@@ -91,10 +91,10 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli) const char *pszCreator = ezxml_txt(ezxml_get(xmli, "properties", 0, "creator", -1));
- for (ezxml_t memb = ezxml_get(xmli, "members", 0, "member", -1); memb != NULL; memb = ezxml_next(memb)) {
+ for (ezxml_t memb = ezxml_get(xmli, "members", 0, "member", -1); memb != nullptr; memb = ezxml_next(memb)) {
const char *mri = ezxml_txt(ezxml_child(memb, "mri"));
const char *role = ezxml_txt(ezxml_child(memb, "role"));
- GCUserItem *gcu = NULL;
+ GCUserItem *gcu = nullptr;
for (int j = 0; j < info->mJoinedContacts.getCount(); j++) {
if (!mir_strcmp(info->mJoinedContacts[j]->WLID, mri)) {
@@ -111,7 +111,7 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli) if (pszCreator && !mir_strcmp(mri, pszCreator)) info->mCreator = gcu;
char* szEmail, *szNet;
- parseWLID(NEWSTR_ALLOCA(mri), &szNet, &szEmail, NULL);
+ parseWLID(NEWSTR_ALLOCA(mri), &szNet, &szEmail, nullptr);
if (!mir_strcmpi(szEmail, GetMyUsername(atoi(szNet))))
info->mMe = gcu;
gcu->btag = 1;
@@ -156,7 +156,7 @@ const wchar_t *CMsnProto::MSN_GCGetRole(GCThreadData* thread, const char *pszWLI if (!mir_strcmp(thread->mJoinedContacts[j]->WLID, pszWLID))
return thread->mJoinedContacts[j]->role;
- return NULL;
+ return nullptr;
}
void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID)
@@ -166,8 +166,8 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID GCEVENT gce = { m_szModuleName, mChatID, GC_EVENT_TOPIC };
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = MsnTSToUnixtime(ezxml_txt(ezxml_child(xmli, "eventtime")));
- gce.ptszUID = initiator ? mir_a2u(initiator->txt) : NULL;
- MCONTACT hContInitiator = MSN_HContactFromEmail(initiator ? initiator->txt : NULL);
+ gce.ptszUID = initiator ? mir_a2u(initiator->txt) : nullptr;
+ MCONTACT hContInitiator = MSN_HContactFromEmail(initiator ? initiator->txt : nullptr);
gce.ptszNick = GetContactNameT(hContInitiator);
gce.ptszText = mir_a2u(ezxml_txt(ezxml_child(xmli, "value")));
Chat_Event(&gce);
@@ -203,7 +203,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID if (gce.iType) {
gce.time = MsnTSToUnixtime(ezxml_txt(ezxml_child(xmli, "eventtime")));
- const char *pszTarget = NULL;
+ const char *pszTarget = nullptr;
while (target) {
switch (gce.iType) {
@@ -221,7 +221,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID break;
}
char *szEmail, *szNet;
- parseWLID(NEWSTR_ALLOCA(pszTarget), &szNet, &szEmail, NULL);
+ parseWLID(NEWSTR_ALLOCA(pszTarget), &szNet, &szEmail, nullptr);
gce.bIsMe = !mir_strcmpi(szEmail, GetMyUsername(atoi(szNet)));
gce.ptszUID = mir_a2u(pszTarget);
MCONTACT hContTarget = MSN_HContactFromEmail(pszTarget);
@@ -294,7 +294,7 @@ static void ChatInviteUser(ThreadData *thread, GCThreadData* info, const char* w static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto *ppro)
{
- if (hItem == NULL)
+ if (hItem == nullptr)
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
while (hItem) {
@@ -415,13 +415,13 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDOK:
char tEmail[MSN_MAX_EMAIL_LEN]; tEmail[0] = 0;
- GCThreadData *info = NULL;
+ GCThreadData *info = nullptr;
if (param->id)
info = param->ppro->MSN_GetThreadByChatId(param->id);
HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST);
STRLIST *cont = new STRLIST;
- ChatInviteSend(NULL, hwndList, *cont, param->ppro);
+ ChatInviteSend(nullptr, hwndList, *cont, param->ppro);
if (info) {
for (int i = 0; i < cont->getCount(); ++i)
@@ -460,7 +460,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) case GC_SESSION_TERMINATE:
{
GCThreadData* thread = MSN_GetThreadByChatId(gch->ptszID);
- if (thread != NULL) {
+ if (thread != nullptr) {
m_arGCThreads.remove(thread);
for (int i = 0; i < thread->mJoinedContacts.getCount(); i++)
delete thread->mJoinedContacts[i];
@@ -484,7 +484,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(NULL);
+ gce.time = time(nullptr);
gce.ptszText = gch->ptszText;
gce.bIsMe = TRUE;
Chat_Event(&gce);
@@ -497,7 +497,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) break;
case GC_USER_CHANMGR:
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
+ DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
LPARAM(new InviteChatParam(gch->ptszID, NULL, this)));
break;
@@ -508,7 +508,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) case GC_USER_LOGMENU:
switch (gch->dwData) {
case 10:
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
+ DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
LPARAM(new InviteChatParam(gch->ptszID, NULL, this)));
break;
@@ -551,7 +551,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) {
GCMENUITEMS *gcmi = (GCMENUITEMS*)lParam;
- if (gcmi == NULL || _stricmp(gcmi->pszModule, m_szModuleName)) return 0;
+ if (gcmi == nullptr || _stricmp(gcmi->pszModule, m_szModuleName)) return 0;
if (gcmi->Type == MENU_ON_LOG) {
static const struct gc_item Items[] =
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 9388116cc4..82b77b6f03 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -75,8 +75,8 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para }
int msgBytes;
- char *nick = NULL, *email = NULL;
- wchar_t *mChatID = NULL;
+ char *nick = nullptr, *email = nullptr;
+ wchar_t *mChatID = nullptr;
bool ubmMsg = strncmp(cmdString, "UBM", 3) == 0;
bool sdgMsg = strncmp(cmdString, "SDG", 3) == 0;
bool nfyMsg = strncmp(cmdString, "NFY", 3) == 0;
@@ -112,7 +112,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para HReadBuffer buf(info, 0);
BYTE* msgb = buf.surelyRead(msgBytes);
- if (msgb == NULL) return;
+ if (msgb == nullptr) return;
memcpy(msg, msgb, msgBytes);
msg[msgBytes] = 0;
@@ -150,7 +150,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para if (tMsgId) lastMsgId=_atoi64(tMsgId);
// Chunked message
- char* newbody = NULL;
+ char* newbody = nullptr;
if (!sdgMsg && tMsgId) {
int idx;
const char* tChunks = tHeader["Chunks"];
@@ -165,11 +165,11 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para }
// message from the server (probably)
- if (!ubmMsg && !sdgMsg && !nfyMsg && strchr(email, '@') == NULL && _stricmp(email, "Hotmail"))
+ if (!ubmMsg && !sdgMsg && !nfyMsg && strchr(email, '@') == nullptr && _stricmp(email, "Hotmail"))
return;
const char* tContentType = tHeader["Content-Type"];
- if (tContentType == NULL)
+ if (tContentType == nullptr)
return;
if (nfyMsg)
@@ -182,7 +182,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para MCONTACT hContact = MSN_HContactFromEmail(email);
const char* mirver = tFileInfo["Client-Name"];
- if (hContact != NULL && mirver != NULL) {
+ if (hContact != NULL && mirver != nullptr) {
setString(hContact, "MirVer", mirver);
delSetting(hContact, "StdMirVer");
}
@@ -233,7 +233,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para }
if (cnt) {
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(NULL);
+ pre.timestamp = (DWORD)time(nullptr);
pre.szMessage = (char *)psr;
pre.lParam = cnt;
ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
@@ -254,13 +254,13 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para CallService(MS_PROTO_CONTACTISTYPING, hContact, 0);
else {
const char* p = tHeader["X-MMS-IM-Format"];
- bool isRtl = p != NULL && strstr(p, "RL=1") != NULL;
+ bool isRtl = p != nullptr && strstr(p, "RL=1") != nullptr;
/*if (info->mJoinedContactsWLID.getCount() > 1)
MSN_ChatStart(info);
else */{
char *szNet, *szEmail;
- parseWLID(NEWSTR_ALLOCA(email), &szNet, &szEmail, NULL);
+ parseWLID(NEWSTR_ALLOCA(email), &szNet, &szEmail, nullptr);
sentMsg = _stricmp(szEmail, GetMyUsername(atoi(szNet))) == 0;
if (sentMsg)
hContact = ubmMsg ? MSN_HContactFromEmail(datau.toEmail, nick) : info->getContactHandle();
@@ -283,7 +283,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para ezxml_free(xmli);
}
}
- else MSN_GCAddMessage(mChatID, hContact, email, time(NULL), sentMsg, msgBody);
+ else MSN_GCAddMessage(mChatID, hContact, email, time(nullptr), 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(NULL);
+ pre.timestamp = (DWORD)time(nullptr);
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(NULL);
+ dbei.timestamp = time(nullptr);
dbei.cbBlob = (unsigned)mir_strlen(msgBody) + 1;
dbei.pBlob = (PBYTE)msgBody;
db_event_add(hContact, &dbei);
@@ -318,7 +318,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para emailEnabled = atol(tHeader["EmailEnabled"]) != 0;
if (!MSN_RefreshContactList()) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NOSERVER);
info->sendTerminate();
}
else {
@@ -330,7 +330,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para (sdgMsg && !_strnicmp(tContentType, "Application/Message", 19))) {
const char* tTypingUser = sdgMsg?email:tHeader["TypingUser"];
- if (tTypingUser != NULL && info->mChatID[0] == 0 && _stricmp(email, MyOptions.szEmail)) {
+ if (tTypingUser != nullptr && info->mChatID[0] == 0 && _stricmp(email, MyOptions.szEmail)) {
MCONTACT hContact = MSN_HContactFromEmail(tTypingUser, tTypingUser);
CallService(MS_PROTO_CONTACTISTYPING, hContact,
sdgMsg && !_stricmp(tHeader["Message-Type"], "Control/ClearTyping")?0:7);
@@ -389,7 +389,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) if (uri) {
// First get HTTP header of file to get content length
unsigned __int64 fileSize = 0;
- NETLIBHTTPHEADER nlbhHeaders[2] = { 0 };
+ NETLIBHTTPHEADER nlbhHeaders[2] = {};
nlbhHeaders[0].szName = "User-Agent"; nlbhHeaders[0].szValue = (LPSTR)MSN_USER_AGENT;
nlbhHeaders[1].szName = "Authorization"; nlbhHeaders[1].szValue = (char*)pszSkypeToken;
@@ -419,7 +419,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) }
Netlib_FreeHttpRequest(nlhrReply);
- } else hHttpsConnection = NULL;
+ } else hHttpsConnection = nullptr;
if (fileSize) {
filetransfer* ft = new filetransfer(this);
@@ -455,16 +455,16 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeW(desc->txt):tComment;
pre.files.w = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
if (desc) mir_free(pre.descr.w);
- } else uri=NULL;
+ } else uri=nullptr;
}
- if (uri == NULL) {
+ if (uri == nullptr) {
// Fallback: Just filter out the link and post it as a message
CallService(MS_PROTO_CONTACTISTYPING, WPARAM(hContact), 0);
@@ -473,7 +473,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(NULL);
+ pre.timestamp = (DWORD)time(nullptr);
ProtoChainRecvMsg(hContact, &pre);
}
}
@@ -484,7 +484,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) void CMsnProto::MSN_ProcessYFind(char* buf, size_t len)
{
- if (buf == NULL) return;
+ if (buf == nullptr) return;
ezxml_t xmli = ezxml_parse_str(buf, len);
ezxml_t dom = ezxml_child(xmli, "d");
@@ -497,8 +497,8 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len) mir_snprintf(szEmail, "%s@%s", szCont, szDom);
const char *szNetId = ezxml_attr(cont, "t");
- if (msnSearchId != NULL) {
- if (szNetId != NULL) {
+ if (msnSearchId != nullptr) {
+ if (szNetId != nullptr) {
ptrW szEmailT(mir_utf8decodeW(szEmail));
PROTOSEARCHRESULT psr = { 0 };
@@ -511,10 +511,10 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len) }
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, msnSearchId, 0);
- msnSearchId = NULL;
+ msnSearchId = nullptr;
}
else {
- if (szNetId != NULL) {
+ if (szNetId != nullptr) {
int netId = atol(szNetId);
MCONTACT hContact = MSN_HContactFromEmail(szEmail, szEmail, true, false);
if (MSN_AddUser(hContact, szEmail, netId, LIST_FL)) {
@@ -575,14 +575,14 @@ 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(NULL));
+ setDword(hContact, "IdleTS", newStatus != ID_STATUS_IDLE ? 0 : time(nullptr));
}
if (cont) {
if (objid) {
- char* end = NULL;
+ char* end = nullptr;
cont->cap1 = strtoul(objid, &end, 10);
- cont->cap2 = end && *end == ':' ? strtoul(end + 1, NULL, 10) : 0;
+ cont->cap2 = end && *end == ':' ? strtoul(end + 1, nullptr, 10) : 0;
}
if (szInst) MSN_SetMirVer(hContact, cont->places.find((MsnPlace*)&szInst));
@@ -621,7 +621,7 @@ void CMsnProto::MSN_ProcessNLN(const char *userStatus, const char *wlid, char *u delSetting(hContact, "PictContext");
delSetting(hContact, "PictSavedContext");
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
}
else if (lastStatus == ID_STATUS_OFFLINE)
@@ -637,7 +637,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) parseWLID(NEWSTR_ALLOCA(wlid), &szNetId, &szEmail, &szInst);
bool bHasPSM=false;
- char* szStatMsg = NULL;
+ char* szStatMsg = nullptr;
for (ezxml_t s = ezxml_child(xmli, "s"); s; s = s->next) {
const char *n = ezxml_attr(s, "n");
@@ -663,9 +663,9 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) if (!mir_strcmp(n, "IM")) {
const char *id = ezxml_attr(endp, "epid");
const char *caps = ezxml_txt(ezxml_child(endp, "Capabilities"));
- char* end = NULL;
+ char* end = nullptr;
unsigned cap1 = caps ? strtoul(caps, &end, 10) : 0;
- unsigned cap2 = end && *end == ':' ? strtoul(end + 1, NULL, 10) : 0;
+ unsigned cap2 = end && *end == ':' ? strtoul(end + 1, nullptr, 10) : 0;
Lists_AddPlace(szEmail, id, cap1, cap2);
}
@@ -685,12 +685,12 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) if (cont->places.getCount() > 0)
MSN_SetMirVer(hContact, &cont->places[0]);
}
- ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, ptrW(mir_utf8decodeW(szStatMsg)));
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, nullptr, ptrW(mir_utf8decodeW(szStatMsg)));
}
void CMsnProto::MSN_ProcessNotificationMessage(char* buf, size_t len)
{
- if (buf == NULL) return;
+ if (buf == nullptr) return;
ezxml_t xmlnot = ezxml_parse_str(buf, len);
if (mir_strcmp(ezxml_attr(xmlnot, "siteid"), "0") == 0) {
@@ -703,12 +703,12 @@ void CMsnProto::MSN_ProcessNotificationMessage(char* buf, size_t len) ezxml_t xmlbdy = ezxml_child(xmlmsg, "BODY");
ezxml_t xmltxt = ezxml_child(xmlbdy, "TEXT");
- if (xmltxt != NULL) {
+ if (xmltxt != nullptr) {
char fullurl[1024];
size_t sz = 0;
const char* acturl = ezxml_attr(xmlact, "url");
- if (acturl == NULL || strstr(acturl, "://") == NULL)
+ if (acturl == nullptr || strstr(acturl, "://") == nullptr)
sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "%s", ezxml_attr(xmlnot, "siteurl"));
sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "%s", acturl);
@@ -728,7 +728,7 @@ void CMsnProto::MSN_ProcessNotificationMessage(char* buf, size_t len) const char *txt = ezxml_txt(xmlbdy);
if (strstr(txt, "ABCHInternal")) {
MSN_SharingFindMembership(true);
- MSN_ABFind("ABFindContactsPaged", NULL, true);
+ MSN_ABFind("ABFindContactsPaged", nullptr, true);
MSN_StoreGetProfile();
}
}
@@ -796,7 +796,7 @@ LBL_InvalidCommand: MSN_SetServerStatus(m_iDesiredStatus);
MSN_EnableMenuItems(true);
// Fork refreshing and populating contact list to the background
- ForkThread(&CMsnProto::msn_loginThread, NULL);
+ ForkThread(&CMsnProto::msn_loginThread, nullptr);
}
} else bIgnoreATH = false;
}
@@ -874,7 +874,7 @@ LBL_InvalidCommand: bSentBND = false;
if (!hKeepAliveThreadEvt)
- ForkThread(&CMsnProto::msn_keepAliveThread, NULL);
+ ForkThread(&CMsnProto::msn_keepAliveThread, nullptr);
}
break;
@@ -900,7 +900,7 @@ LBL_InvalidCommand: {
if (!mir_strcmp(xmli->name, "recentconversations-response"))
{
- for (ezxml_t conv = ezxml_get(xmli, "conversations", 0, "conversation", -1); conv != NULL; conv = ezxml_next(conv)) {
+ for (ezxml_t conv = ezxml_get(xmli, "conversations", 0, "conversation", -1); conv != nullptr; conv = ezxml_next(conv)) {
ezxml_t id;
MCONTACT hContact;
MEVENT hDbEvent;
@@ -914,7 +914,7 @@ LBL_InvalidCommand: hContact = MSN_HContactFromChatID(id->txt);
msnNsThread->sendPacketPayload("GET", "MSGR\\THREADS",
"<threads><thread><id>%s</id></thread></threads>", id->txt);
- } else hContact = MSN_HContactFromEmail(id->txt, NULL, false, false);
+ } else hContact = MSN_HContactFromEmail(id->txt, nullptr, false, false);
if (hContact) {
// There are messages to be fetched
@@ -940,12 +940,12 @@ LBL_InvalidCommand: bool bIsChat = strncmp(id->txt, "19:", 3)==0;
bool bHasMore = mir_strcmpi(ezxml_txt(ezxml_child(xmli, "hasmore")), "true") == 0;
ezxml_t syncstate;
- hContact = MSN_HContactFromEmail(id->txt, NULL, false, false);
+ hContact = MSN_HContactFromEmail(id->txt, nullptr, false, false);
if (!bHasMore && hContact) db_unset(hContact, m_szModuleName, "syncTS");
/* We have to traverse the list in reverse order as newest events are on top (which is the opposite direction of Groupchat) */
LIST<ezxml> msgs(10,PtrKeySortT);
- for (ezxml_t msg = ezxml_get(xmli, "messages", 0, "message", -1); msg != NULL; msg = ezxml_next(msg)) msgs.insert(msg, 0);
+ for (ezxml_t msg = ezxml_get(xmli, "messages", 0, "message", -1); msg != nullptr; msg = ezxml_next(msg)) msgs.insert(msg, 0);
for (int i=0; i<msgs.getCount(); i++) {
ezxml_t msg = msgs[i];
ezxml_t arrtime = ezxml_child(msg, "originalarrivaltime"), from = ezxml_child(msg, "from"),
@@ -956,7 +956,7 @@ LBL_InvalidCommand: if (!arrtime || !from || !content) continue;
ts=IsoToUnixTime(arrtime->txt);
- parseWLID(NEWSTR_ALLOCA(from->txt), &netId, &email, NULL);
+ parseWLID(NEWSTR_ALLOCA(from->txt), &netId, &email, nullptr);
message=content->txt;
sentMsg = mir_strcmpi(email, GetMyUsername(atoi(netId)))==0;
if (msgtype) {
@@ -980,7 +980,7 @@ LBL_InvalidCommand: }
if (bIsChat) {
- hContact = MSN_HContactFromEmail(from->txt, NULL, false, false);
+ hContact = MSN_HContactFromEmail(from->txt, nullptr, false, false);
if (hContact)
db_unset(hContact, m_szModuleName, "syncTS");
MSN_GCAddMessage(_A2T(id->txt), hContact, email, ts, sentMsg, message);
@@ -1035,7 +1035,7 @@ LBL_InvalidCommand: }
}
else if (!mir_strcmp(xmli->name, "threads-response")) {
- for (ezxml_t thread = ezxml_get(xmli, "threads", 0, "thread", -1); thread != NULL; thread = ezxml_next(thread))
+ for (ezxml_t thread = ezxml_get(xmli, "threads", 0, "thread", -1); thread != nullptr; thread = ezxml_next(thread))
MSN_ChatStart(thread);
}
ezxml_free(xmli);
@@ -1056,7 +1056,7 @@ LBL_InvalidCommand: HReadBuffer buf(info, 0);
char* msgBody = (char*)buf.surelyRead(atol(data.strMsgBytes));
- if (msgBody == NULL) break;
+ if (msgBody == nullptr) break;
if (!mir_strcmp(data.typeId, "MSGR\\HOTMAIL")) {
char szParam[128];
mir_snprintf(szParam, sizeof(szParam), "%s %s", data.typeId, data.strMsgBytes);
@@ -1074,8 +1074,8 @@ LBL_InvalidCommand: int i;
for (i=0; i<2; i++) msgBody = tHeader.readFromBuffer(msgBody);
- char *pszTo = NULL, *pszToNet;
- if (tHeader["To"]) parseWLID(NEWSTR_ALLOCA(tHeader["To"]), &pszToNet, &pszTo, NULL);
+ char *pszTo = nullptr, *pszToNet;
+ if (tHeader["To"]) parseWLID(NEWSTR_ALLOCA(tHeader["To"]), &pszToNet, &pszTo, nullptr);
const char *pszFrom = tHeader["From"];
for (i=0; i<2; i++) msgBody = tHeader.readFromBuffer(msgBody);
@@ -1094,7 +1094,7 @@ LBL_InvalidCommand: // These capabilities seem to be something different than in previous MSNP versions?
//ezxml_t xmlcaps = ezxml_get(xmli, "sep", 0, "Capabilities", -1);
ezxml_t usertile = ezxml_get(xmli, "s", 1, "UserTileLocation", -1);
- MSN_ProcessNLN(ezxml_txt(xmlstatus), pszFrom, NULL, NULL, usertile?usertile->txt:NULL);
+ MSN_ProcessNLN(ezxml_txt(xmlstatus), pszFrom, nullptr, nullptr, usertile?usertile->txt:nullptr);
}
MSN_ProcessStatusMessage(xmli, pszFrom);
}
@@ -1136,7 +1136,7 @@ LBL_InvalidCommand: if (ezxml_t xmli = ezxml_parse_str(msgBody, mir_strlen(msgBody))) {
if (ezxml_t wait = ezxml_child(xmli, "wait")) {
msnPingTimeout = atoi(ezxml_txt(wait));
- if (msnPingTimeout && hKeepAliveThreadEvt != NULL)
+ if (msnPingTimeout && hKeepAliveThreadEvt != nullptr)
SetEvent(hKeepAliveThreadEvt);
}
ezxml_free(xmli);
@@ -1149,7 +1149,7 @@ LBL_InvalidCommand: if ((user = ezxml_child(xmli, "user")) && (from = ezxml_child(xmli, "from"))) {
if (ezxml_t xmlstatus = ezxml_get(user, "s", 0, "Status", -1)) {
ezxml_t usertile = ezxml_get(user, "s", 1, "UserTileLocation", -1);
- MSN_ProcessNLN(ezxml_txt(xmlstatus), from->txt, NULL, NULL, usertile?usertile->txt:NULL);
+ MSN_ProcessNLN(ezxml_txt(xmlstatus), from->txt, nullptr, nullptr, usertile?usertile->txt:nullptr);
} else {
int oldMode = m_iStatus;
m_iStatus = m_iDesiredStatus;
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index eb78154bef..94c2fa498b 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.cpp @@ -27,8 +27,8 @@ MCONTACT CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, {
MCONTACT hContact = NULL;
- char *szEmail, *szNet = NULL;
- parseWLID(NEWSTR_ALLOCA(wlid), &szNet, &szEmail, NULL);
+ char *szEmail, *szNet = nullptr;
+ parseWLID(NEWSTR_ALLOCA(wlid), &szNet, &szEmail, nullptr);
MsnContact *msc = Lists_Get(szEmail);
if (msc && msc->hContact)
@@ -76,7 +76,7 @@ MCONTACT CMsnProto::MSN_HContactFromChatID(const char* wlid) void CMsnProto::MSN_SetContactDb(MCONTACT hContact, const char *szEmail)
{
MsnContact *cont = Lists_Get(szEmail);
- if (cont == NULL)
+ if (cont == nullptr)
return;
const int listId = cont->list;
@@ -155,7 +155,7 @@ bool CMsnProto::MSN_AddUser(MCONTACT hContact, const char* email, int netId, int if (leaveHotmail)
res = MSN_ABAddRemoveContact(id, netId2, false);
else
- res = MSN_ABAddDelContactGroup(id, NULL, "ABContactDelete");
+ res = MSN_ABAddDelContactGroup(id, nullptr, "ABContactDelete");
if (res)
AddDelUserContList(email, flags, netId2, true);
diff --git a/protocols/MSN/src/msn_errors.cpp b/protocols/MSN/src/msn_errors.cpp index b53d66e323..68de79ad4f 100644 --- a/protocols/MSN/src/msn_errors.cpp +++ b/protocols/MSN/src/msn_errors.cpp @@ -63,14 +63,14 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString) switch (errorCode) {
case ERR_INTERNAL_SERVER:
MSN_ShowError("MSN Services are temporarily unavailable, please try to connect later");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NOSERVER);
return 1;
case ERR_SERVER_BUSY:
case ERR_SERVER_UNAVAILABLE:
case ERR_TIMEDOUT:
MSN_ShowError("MSN Services are too busy, please try to connect later");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NOSERVER);
return 1;
case ERR_NOT_ALLOWED_WHEN_OFFLINE:
@@ -108,7 +108,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString) case ERR_AUTHENTICATION_FAILED:
MSN_ShowError("Your username or password is incorrect");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPASSWORD);
return 1;
case 999:
diff --git a/protocols/MSN/src/msn_http.cpp b/protocols/MSN/src/msn_http.cpp index 243b7b6967..d97d6497da 100644 --- a/protocols/MSN/src/msn_http.cpp +++ b/protocols/MSN/src/msn_http.cpp @@ -25,8 +25,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static ThreadData* FindThreadConn(HNETLIBCONN hConn)
{
- ThreadData *res = NULL;
- for (int i = 0; i < g_Instances.getCount() && res == NULL; ++i)
+ ThreadData *res = nullptr;
+ for (int i = 0; i < g_Instances.getCount() && res == nullptr; ++i)
res = g_Instances[i].MSN_GetThreadByConnection(hConn);
return res;
@@ -39,7 +39,7 @@ static ThreadData* FindThreadConn(HNETLIBCONN hConn) int msn_httpGatewayInit(HNETLIBCONN hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST*)
{
NETLIBHTTPPROXYINFO nlhpi = {};
- nlhpi.szHttpGetUrl = NULL;
+ nlhpi.szHttpGetUrl = nullptr;
nlhpi.szHttpPostUrl = "messenger.hotmail.com";
nlhpi.flags = NLHPIF_HTTP11;
nlhpi.combinePackets = MSN_PACKETS_COMBINE;
@@ -54,7 +54,7 @@ int msn_httpGatewayInit(HNETLIBCONN hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQU int msn_httpGatewayWrapSend(HNETLIBCONN hConn, PBYTE buf, int len, int flags)
{
ThreadData *T = FindThreadConn(hConn);
- if (T != NULL) {
+ if (T != nullptr) {
if (T->sessionClosed)
return SOCKET_ERROR;
@@ -74,14 +74,14 @@ PBYTE msn_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST* nlhr, PBYTE buf, int len, int *outBufLen = len;
ThreadData *T = FindThreadConn(nlhr->nlc);
- if (T == NULL)
+ if (T == nullptr)
return buf;
bool isSessionClosed = true;
bool isMsnPacket = false;
if (nlhr->resultCode == 200) {
- char *xMsgr = NULL, *xHost = NULL;
+ char *xMsgr = nullptr, *xHost = nullptr;
for (int i = 0; i < nlhr->headersCount; i++) {
NETLIBHTTPHEADER& tHeader = nlhr->headers[i];
@@ -95,7 +95,7 @@ PBYTE msn_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST* nlhr, PBYTE buf, int len, int if (xMsgr) {
isMsnPacket = true;
- if (strstr(xMsgr, "Session=close") == 0)
+ if (strstr(xMsgr, "Session=close") == nullptr)
isSessionClosed = false;
T->processSessionData(xMsgr, xHost);
@@ -104,12 +104,12 @@ PBYTE msn_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST* nlhr, PBYTE buf, int len, int }
T->sessionClosed |= isSessionClosed;
- if (isSessionClosed && buf == NULL) {
+ if (isSessionClosed && buf == nullptr) {
*outBufLen = 0;
buf = (PBYTE)mir_alloc(1);
*buf = 0;
}
- else if (buf == NULL && len == 0) {
+ else if (buf == nullptr && len == 0) {
*outBufLen = 1;
buf = (PBYTE)mir_alloc(1);
*buf = 0;
diff --git a/protocols/MSN/src/msn_ieembed.cpp b/protocols/MSN/src/msn_ieembed.cpp index be46a8f475..dcbb150409 100644 --- a/protocols/MSN/src/msn_ieembed.cpp +++ b/protocols/MSN/src/msn_ieembed.cpp @@ -32,7 +32,7 @@ IEEmbedSink::~IEEmbedSink() {} STDMETHODIMP IEEmbedSink::QueryInterface(REFIID riid, PVOID *ppv)
{
- *ppv = NULL;
+ *ppv = nullptr;
if (IID_IUnknown == riid)
*ppv = (IUnknown *)this;
@@ -42,7 +42,7 @@ STDMETHODIMP IEEmbedSink::QueryInterface(REFIID riid, PVOID *ppv) if (DIID_DWebBrowserEvents2 == riid)
*ppv = (DWebBrowserEvents2*)this;
- if (NULL != *ppv) {
+ if (nullptr != *ppv) {
((LPUNKNOWN)*ppv)->AddRef();
return NOERROR;
}
@@ -184,19 +184,19 @@ IEEmbed::IEEmbed(HWND _parent) MSG msg;
parent = _parent;
GetClientRect(_parent, &rcClient);
- if (SUCCEEDED(pWebBrowser.CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC))) {
+ if (SUCCEEDED(pWebBrowser.CoCreateInstance(CLSID_WebBrowser, nullptr, CLSCTX_INPROC))) {
CComPtr<IOleObject> pOleObject;
if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleObject))) {
pOleObject->SetClientSite(this);
pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, this->parent, &rcClient);
}
- else MessageBox(NULL, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
+ else MessageBox(nullptr, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
CComPtr<IOleInPlaceObject> pOleInPlace;
if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleInPlace)))
pOleInPlace->GetWindow(&hwnd);
else
- MessageBox(NULL, TranslateT("IID_IOleInPlaceObject failed."), TranslateT("RESULT"), MB_OK);
+ MessageBox(nullptr, TranslateT("IID_IOleInPlaceObject failed."), TranslateT("RESULT"), MB_OK);
//setBorder();
CComPtr<IConnectionPointContainer> pCPContainer;
@@ -209,7 +209,7 @@ IEEmbed::IEEmbed(HWND _parent) // want to sink its events.
sink = new IEEmbedSink(this);
if (FAILED(m_pConnectionPoint->Advise(sink, &m_dwCookie)))
- MessageBox(NULL, TranslateT("Failed to Advise"), TranslateT("C++ Event Sink"), MB_OK);
+ MessageBox(nullptr, TranslateT("Failed to Advise"), TranslateT("C++ Event Sink"), MB_OK);
}
}
setMainWndProc((WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)IEEmbedWindowProcedure));
@@ -223,14 +223,14 @@ IEEmbed::~IEEmbed() {
CComPtr<IOleObject> pOleObject;
if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleObject)))
- pOleObject->SetClientSite(NULL);
+ pOleObject->SetClientSite(nullptr);
else
- MessageBox(NULL, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
+ MessageBox(nullptr, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
- if (m_pConnectionPoint != NULL)
+ if (m_pConnectionPoint != nullptr)
m_pConnectionPoint->Unadvise(m_dwCookie);
- if (sink != NULL)
+ if (sink != nullptr)
delete sink;
DestroyWindow(hwnd);
}
@@ -248,7 +248,7 @@ void IEEmbed::ResizeBrowser() // IUnknown
STDMETHODIMP IEEmbed::QueryInterface(REFIID riid, PVOID *ppv)
{
- *ppv = NULL;
+ *ppv = nullptr;
if (IID_IUnknown == riid)
*ppv = this;
if (IID_IOleClientSite == riid)
@@ -256,7 +256,7 @@ STDMETHODIMP IEEmbed::QueryInterface(REFIID riid, PVOID *ppv) if (IID_IOleWindow == riid || IID_IOleInPlaceSite == riid)
*ppv = (IOleInPlaceSite*)this;//m_pIOleIPSite;
- if (NULL != *ppv) {
+ if (nullptr != *ppv) {
((LPUNKNOWN)*ppv)->AddRef();
return NOERROR;
}
@@ -356,7 +356,7 @@ void IEEmbed::write(const wchar_t *text) if (!document) return;
SAFEARRAY *safe_array = ::SafeArrayCreateVector(VT_VARIANT, 0, 1);
- if (safe_array != NULL) {
+ if (safe_array != nullptr) {
VARIANT *variant;
::SafeArrayAccessData(safe_array, (LPVOID *)&variant);
variant->vt = VT_BSTR;
@@ -383,9 +383,9 @@ void IEEmbed::addCookie(const wchar_t *cookieString) BSTR IEEmbed::getCookies()
{
CComPtr<IHTMLDocument2> document = getDocument();
- BSTR cookie = NULL;
+ BSTR cookie = nullptr;
- if (!document) return NULL;
+ if (!document) return nullptr;
document->get_cookie(&cookie);
return cookie;
}
@@ -393,18 +393,18 @@ BSTR IEEmbed::getCookies() IHTMLDocument2* IEEmbed::getDocument()
{
CComPtr<IDispatch> dispatch;
- if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != NULL) {
+ if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != nullptr) {
CComPtr<IHTMLDocument2> document;
dispatch.QueryInterface(&document);
return document.Detach();
}
- return NULL;
+ return nullptr;
}
void IEEmbed::navigate(const wchar_t *url)
{
- pWebBrowser->Navigate((WCHAR *)url, NULL, NULL, NULL, NULL);
+ pWebBrowser->Navigate((WCHAR *)url, nullptr, nullptr, nullptr, nullptr);
}
void IEEmbed::navigate(char *url)
@@ -432,7 +432,7 @@ void IEEmbed::navigate(NETLIBHTTPREQUEST *nlhr) SafeArrayUnaccessData(psa);
V_VT(&vPostData) = VT_ARRAY | VT_UI1;
V_ARRAY(&vPostData) = psa;
- pWebBrowser->Navigate(szUrl, NULL, NULL, &vPostData, &vHeaders);
+ pWebBrowser->Navigate(szUrl, nullptr, nullptr, &vPostData, &vHeaders);
SysFreeString(bstrHeaders);
VariantClear(&vPostData);
mir_free(szUrl);
@@ -440,7 +440,7 @@ void IEEmbed::navigate(NETLIBHTTPREQUEST *nlhr) char *IEEmbed::GetHTMLDoc() {
CComPtr<IDispatch> spDispDoc;
- char *pszRet = NULL;
+ char *pszRet = nullptr;
if (SUCCEEDED(pWebBrowser->get_Document(&spDispDoc))) {
CComPtr<IHTMLDocument3> spDoc;
diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index 7f543bc1b7..b5303150ba 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -24,8 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static wchar_t* a2tf(const wchar_t* str, bool unicode)
{
- if (str == NULL)
- return NULL;
+ if (str == nullptr)
+ return nullptr;
return unicode ? mir_wstrdup(str) : mir_a2u((char*)str);
}
@@ -33,11 +33,11 @@ static wchar_t* a2tf(const wchar_t* str, bool unicode) void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t* def)
{
mir_free(dest);
- dest = NULL;
+ dest = nullptr;
- if (src != NULL)
+ if (src != nullptr)
dest = a2tf(src, unicode);
- else if (def != NULL)
+ else if (def != nullptr)
dest = mir_wstrdup(def);
}
@@ -53,22 +53,22 @@ bool txtParseParam(const char* szData, const char* presearch, const char* start, const char *cp, *cp1;
int len;
- if (szData == NULL) return false;
+ if (szData == nullptr) return false;
- if (presearch != NULL) {
+ if (presearch != nullptr) {
cp1 = strstr(szData, presearch);
- if (cp1 == NULL) return false;
+ if (cp1 == nullptr) return false;
}
else cp1 = szData;
cp = strstr(cp1, start);
- if (cp == NULL) return false;
+ if (cp == nullptr) return false;
cp += mir_strlen(start);
while (*cp == ' ') ++cp;
if (finish) {
cp1 = strstr(cp, finish);
- if (cp1 == NULL) return FALSE;
+ if (cp1 == nullptr) return FALSE;
while (*(cp1 - 1) == ' ' && cp1 > cp) --cp1;
}
else cp1 = strchr(cp, '\0');
@@ -91,7 +91,7 @@ void parseWLID(char* wlid, char** net, char** email, char** inst) wlid=col;
}
else {
- if (net) *net = NULL;
+ if (net) *net = nullptr;
if (email) *email = wlid;
}
@@ -104,7 +104,7 @@ void parseWLID(char* wlid, char** net, char** email, char** inst) }
}
else if (inst)
- *inst = NULL;
+ *inst = nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -145,7 +145,7 @@ template <class chartype> void UrlDecode(chartype* str) void HtmlDecode(char *str)
{
- if (str == NULL)
+ if (str == nullptr)
return;
char* p, *q;
@@ -168,8 +168,8 @@ char* HtmlEncode(const char *str) char* s, *p, *q;
int c;
- if (str == NULL)
- return NULL;
+ if (str == nullptr)
+ return nullptr;
for (c = 0, p = (char*)str; *p != '\0'; p++) {
switch (*p) {
@@ -182,7 +182,7 @@ char* HtmlEncode(const char *str) }
}
- if ((s = (char*)mir_alloc(c + 1)) != NULL) {
+ if ((s = (char*)mir_alloc(c + 1)) != nullptr) {
for (p = (char*)str, q = s; *p != '\0'; p++) {
switch (*p) {
case '&': mir_strcpy(q, "&"); q += 5; break;
@@ -301,14 +301,14 @@ void stripHTML(char* str) wchar_t* EscapeChatTags(const wchar_t* pszText)
{
int nChars = 0;
- for (const wchar_t* p = pszText; (p = wcschr(p, '%')) != NULL; p++)
+ for (const wchar_t* p = pszText; (p = wcschr(p, '%')) != nullptr; p++)
nChars++;
if (nChars == 0)
return mir_wstrdup(pszText);
wchar_t *pszNewText = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_wstrlen(pszText) + 1 + nChars));
- if (pszNewText == NULL)
+ if (pszNewText == nullptr)
return mir_wstrdup(pszText);
const wchar_t *s = pszText;
@@ -344,7 +344,7 @@ time_t IsoToUnixTime(const char *stamp) char date[9];
int i, y;
- if (stamp == NULL)
+ if (stamp == nullptr)
return 0;
char *p = NEWSTR_ALLOCA(stamp);
@@ -403,7 +403,7 @@ time_t MsnTSToUnixtime(const char *pszTS) {
char szTS[16];
- if (!*pszTS) return time(NULL);
+ if (!*pszTS) return time(nullptr);
strncpy(szTS, pszTS, 10);
return (time_t)atoi(szTS);
}
diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp index 590be7fe48..e6bf5641b8 100644 --- a/protocols/MSN/src/msn_links.cpp +++ b/protocols/MSN/src/msn_links.cpp @@ -27,10 +27,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static MCONTACT GetContact(wchar_t *arg, wchar_t **pemail, CMsnProto *proto)
{
- wchar_t* email = NULL;
+ wchar_t* email = nullptr;
do {
wchar_t *tok = wcschr(arg, '&'); /* next token */
- if (tok != NULL) *tok++ = '\0';
+ if (tok != nullptr) *tok++ = '\0';
if (wcsnicmp(arg, L"contact=", 8) == 0) {
arg += 8;
@@ -38,14 +38,14 @@ static MCONTACT GetContact(wchar_t *arg, wchar_t **pemail, CMsnProto *proto) email = arg;
}
arg = tok;
- } while (arg != NULL);
+ } while (arg != nullptr);
- if (email == NULL || email[0] == '\0') {
- if (pemail) *pemail = NULL;
+ if (email == nullptr || email[0] == '\0') {
+ if (pemail) *pemail = nullptr;
return NULL;
}
if (pemail) *pemail = email;
- MCONTACT hContact = proto->MSN_HContactFromEmail(UTF8(email), NULL, true, true);
+ MCONTACT hContact = proto->MSN_HContactFromEmail(UTF8(email), nullptr, true, true);
return hContact;
}
@@ -64,7 +64,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) /* skip leading prefix */
arg = wcschr(arg, ':');
- if (arg == NULL) return 1; /* parse failed */
+ if (arg == nullptr) return 1; /* parse failed */
for (++arg; *arg == '/'; ++arg) {}
@@ -79,7 +79,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) break;
}
}
- if (proto == NULL) return 1;
+ if (proto == nullptr) return 1;
/* add a contact to the list */
@@ -88,7 +88,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) wchar_t *email;
MCONTACT hContact = GetContact(arg, &email, proto);
- if (email == NULL) return 1;
+ if (email == nullptr) return 1;
/* does not yet check if email is current user */
if (hContact == NULL) {
@@ -110,7 +110,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) else if (wcsnicmp(arg, L"chat?", 5) == 0) {
arg += 5;
- MCONTACT hContact = GetContact(arg, NULL, proto);
+ MCONTACT hContact = GetContact(arg, nullptr, proto);
if (hContact != NULL) {
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
return 0;
@@ -119,7 +119,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) else if (wcsnicmp(arg, L"voice?", 6) == 0) {
arg += 6;
- MCONTACT hContact = GetContact(arg, NULL, proto);
+ MCONTACT hContact = GetContact(arg, nullptr, proto);
if (hContact != NULL) {
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
return 0;
@@ -128,7 +128,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) else if (wcsnicmp(arg, L"video?", 6) == 0) {
arg += 6;
- MCONTACT hContact = GetContact(arg, NULL, proto);
+ MCONTACT hContact = GetContact(arg, nullptr, proto);
if (hContact != NULL) {
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
return 0;
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index b59df57808..78a7a59e42 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -42,7 +42,7 @@ bool CMsnProto::Lists_IsInList(int list, const char* email) mir_cslock lck(m_csLists);
MsnContact *p = m_arContacts.find((MsnContact*)&email);
- if (p == NULL)
+ if (p == nullptr)
return false;
if (list == -1)
return true;
@@ -63,13 +63,13 @@ MsnContact* CMsnProto::Lists_Get(MCONTACT hContact) if (m_arContacts[i].hContact == hContact)
return &m_arContacts[i];
- return NULL;
+ return nullptr;
}
MsnPlace* CMsnProto::Lists_GetPlace(const char* wlid)
{
char *szEmail, *szInst;
- parseWLID(NEWSTR_ALLOCA(wlid), NULL, &szEmail, &szInst);
+ parseWLID(NEWSTR_ALLOCA(wlid), nullptr, &szEmail, &szInst);
return Lists_GetPlace(szEmail, szInst);
}
@@ -78,12 +78,12 @@ MsnPlace* CMsnProto::Lists_GetPlace(const char* szEmail, const char *szInst) {
mir_cslock lck(m_csLists);
- if (szInst == NULL)
+ if (szInst == nullptr)
szInst = (char*)sttVoidUid;
MsnContact* p = m_arContacts.find((MsnContact*)&szEmail);
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return nullptr;
return p->places.find((MsnPlace*)&szInst);
}
@@ -93,11 +93,11 @@ MsnPlace* CMsnProto::Lists_AddPlace(const char* email, const char* id, unsigned mir_cslock lck(m_csLists);
MsnContact *p = m_arContacts.find((MsnContact*)&email);
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return nullptr;
MsnPlace *pl = p->places.find((MsnPlace*)&id);
- if (pl == NULL) {
+ if (pl == nullptr) {
pl = new MsnPlace;
pl->id = mir_strdup(id);
pl->cap1 = cap1;
@@ -116,8 +116,8 @@ MsnContact* CMsnProto::Lists_GetNext(int &i) {
mir_cslock lck(m_csLists);
- MsnContact *p = NULL;
- while (p == NULL && ++i < m_arContacts.getCount())
+ MsnContact *p = nullptr;
+ while (p == nullptr && ++i < m_arContacts.getCount())
if (m_arContacts[i].hContact)
p = &m_arContacts[i];
@@ -147,7 +147,7 @@ int CMsnProto::Lists_Add(int list, int netId, const char* email, MCONTACT hConta mir_cslock lck(m_csLists);
MsnContact* p = m_arContacts.find((MsnContact*)&email);
- if (p == NULL) {
+ if (p == nullptr) {
p = new MsnContact;
p->list = list;
p->netId = netId;
@@ -177,7 +177,7 @@ void CMsnProto::Lists_Remove(int list, const char* email) if (i != -1) {
MsnContact &p = m_arContacts[i];
p.list &= ~list;
- if (list & LIST_PL) { mir_free(p.invite); p.invite = NULL; }
+ if (list & LIST_PL) { mir_free(p.invite); p.invite = nullptr; }
if (p.list == 0 && p.hContact == NULL)
m_arContacts.remove(i);
}
@@ -232,7 +232,7 @@ void CMsnProto::MSN_CleanupLists(void) wchar_t title[128];
mir_snwprintf(title, TranslateT("%s protocol"), m_tszUserName);
- if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES) {
+ if (MessageBox(nullptr, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES) {
MSN_AddUser(p.hContact, p.email, 0, LIST_LL);
setByte(p.hContact, "LocalList", 1);
continue;
@@ -287,7 +287,7 @@ void CMsnProto::MSN_CreateContList(void) }
const char *dom = strchr(C.email, '@');
- if (dom == NULL && lastds == NULL) {
+ if (dom == nullptr && lastds == nullptr) {
if (newdom) {
cxml.Append("<skp>");
newdom = false;
@@ -411,7 +411,7 @@ static void SaveListItem(MCONTACT hContact, const char* szEmail, int list, int i if (iNewValue == 0) {
if (list & LIST_FL) {
DeleteParam param = { proto, hContact };
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), NULL, DlgDeleteContactUI, (LPARAM)¶m);
+ DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), nullptr, DlgDeleteContactUI, (LPARAM)¶m);
return;
}
@@ -443,7 +443,7 @@ static void SaveSettings(MCONTACT hItem, HWND hwndList, CMsnProto* proto) else if (IsHContactInfo(hItem)) {
wchar_t buf[MSN_MAX_EMAIL_LEN];
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
- WideCharToMultiByte(CP_ACP, 0, buf, -1, szEmail, sizeof(szEmail), 0, 0);
+ WideCharToMultiByte(CP_ACP, 0, buf, -1, szEmail, sizeof(szEmail), nullptr, nullptr);
}
@@ -556,7 +556,7 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // Find clicked item
DWORD hitFlags;
HANDLE hItem = (HANDLE)SendMessage(nmc->hdr.hwndFrom, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y));
- if (hItem == NULL || !(IsHContactContact(hItem) || IsHContactInfo(hItem)))
+ if (hItem == nullptr || !(IsHContactContact(hItem) || IsHContactInfo(hItem)))
break;
// It was not our extended icon
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 7bc2b7fb33..a2924d90c8 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -57,7 +57,7 @@ ezxml_t CMsnProto::oimRecvHdr(const char* service, ezxml_t& tbdy, char*& httphdr void CMsnProto::getOIMs(ezxml_t xmli)
{
ezxml_t toki = ezxml_child(xmli, "M");
- if (toki == NULL) return;
+ if (toki == nullptr) return;
char* getReqHdr;
ezxml_t reqmsg;
@@ -72,7 +72,7 @@ void CMsnProto::getOIMs(ezxml_t xmli) ezxml_t xmldel = oimRecvHdr("DeleteMessages", delmsg, delReqHdr);
ezxml_t delmids = ezxml_add_child(delmsg, "messageIds", 0);
- while (toki != NULL) {
+ while (toki != nullptr) {
const char* szId = ezxml_txt(ezxml_child(toki, "I"));
const char* szEmail = ezxml_txt(ezxml_child(toki, "E"));
@@ -87,16 +87,16 @@ void CMsnProto::getOIMs(ezxml_t xmli) free(szData);
mir_free(url);
- if (tResult != NULL && status == 200) {
+ if (tResult != nullptr && status == 200) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
ezxml_t body = getSoapResponse(xmlm, "GetMessage");
MimeHeaders mailInfo;
const char* mailbody = mailInfo.readFromBuffer((char*)ezxml_txt(body));
- time_t evtm = time(NULL);
+ time_t evtm = time(nullptr);
const char* arrTime = mailInfo["X-OriginalArrivalTime"];
- if (arrTime != NULL) {
+ if (arrTime != nullptr) {
char szTime[32], *p;
txtParseParam(arrTime, "FILETIME", "[", "]", szTime, sizeof(szTime));
@@ -132,7 +132,7 @@ void CMsnProto::getOIMs(ezxml_t xmli) ezxml_free(xmlreq);
mir_free(getReqHdr);
- if (ezxml_child(delmids, "messageId") != NULL) {
+ if (ezxml_child(delmids, "messageId") != nullptr) {
char* szData = ezxml_toxml(xmldel, true);
unsigned status;
@@ -167,7 +167,7 @@ void CMsnProto::getMetaData(void) free(szData);
mir_free(getReqHdr);
- if (tResult != NULL && status == 200) {
+ if (tResult != nullptr && status == 200) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
ezxml_t xmli = ezxml_get(xmlm, "s:Body", 0, "GetMetadataResponse", 0, "MD", -1);
if (!xmli)
@@ -225,12 +225,12 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) const char* InboxUnread = tFileInfo["Inbox-Unread"];
const char* FoldersUnread = tFileInfo["Folders-Unread"];
- if (InboxUnread != NULL)
+ if (InboxUnread != nullptr)
mUnreadMessages = atol(InboxUnread);
- if (FoldersUnread != NULL)
+ if (FoldersUnread != nullptr)
mUnreadJunkEmails = atol(FoldersUnread);
- if (MsgDelta != NULL) {
+ if (MsgDelta != nullptr) {
int iDelta = atol(MsgDelta);
if (SrcFolder && mir_strcmp(SrcFolder, "ACTIVE") == 0)
mUnreadMessages -= iDelta;
@@ -245,8 +245,8 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) if (mUnreadMessages < 0) mUnreadMessages = 0;
}
- if (From != NULL && Subject != NULL && Fromaddr != NULL) {
- if (DestFolder != NULL && SrcFolder == NULL) {
+ if (From != nullptr && Subject != nullptr && Fromaddr != nullptr) {
+ if (DestFolder != nullptr && SrcFolder == nullptr) {
mUnreadMessages += mir_strcmp(DestFolder, "ACTIVE") == 0;
mUnreadJunkEmails += mir_strcmp(DestFolder, "HM_BuLkMail_") == 0;
}
@@ -269,7 +269,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) }
else {
const char* MailData = tFileInfo["Mail-Data"];
- if (MailData != NULL) processMailData((char*)MailData);
+ if (MailData != nullptr) processMailData((char*)MailData);
mir_snwprintf(tBuffer, m_tszUserName);
mir_snwprintf(tBuffer2, TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
@@ -300,7 +300,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) }
}
- ProtoBroadcastAck(NULL, ACKTYPE_EMAIL, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(NULL, ACKTYPE_EMAIL, ACKRESULT_STATUS, nullptr, 0);
// Disable to notify receiving hotmail
if (ShowPopup && !getByte("DisableHotmail", 0)) {
@@ -328,19 +328,19 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) char mailerpath[MAX_PATH];
if (!db_get_static(NULL, m_szModuleName, "MailerPath", mailerpath, sizeof(mailerpath))) {
if (mailerpath[0]) {
- char* tParams = NULL;
+ char* tParams = nullptr;
char* tCmd = mailerpath;
if (*tCmd == '\"') {
++tCmd;
char* tEndPtr = strchr(tCmd, '\"');
- if (tEndPtr != NULL) {
+ if (tEndPtr != nullptr) {
*tEndPtr = 0;
tParams = tEndPtr + 1;
}
}
- if (tParams == NULL) {
+ if (tParams == nullptr) {
tParams = strchr(tCmd, ' ');
tParams = tParams ? tParams + 1 : strchr(tCmd, '\0');
}
@@ -348,7 +348,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) while (*tParams == ' ') ++tParams;
debugLogA("Running mailer \"%s\" with params \"%s\"", tCmd, tParams);
- ShellExecuteA(NULL, "open", tCmd, tParams, NULL, TRUE);
+ ShellExecuteA(nullptr, "open", tCmd, tParams, nullptr, TRUE);
}
}
}
@@ -378,7 +378,7 @@ void CMsnProto::displayEmailCount(MCONTACT hContact) if (!emailEnabled || getByte("DisableHotmailCL", 0)) return;
wchar_t* name = GetContactNameT(hContact);
- if (name == NULL) return;
+ if (name == nullptr) return;
wchar_t* ch = name - 1;
do {
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index f11e6726eb..a8729e5437 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -100,8 +100,8 @@ INT_PTR CMsnProto::MsnEditProfile(WPARAM, LPARAM) // MsnInviteCommand - invite command callback function
INT_PTR CMsnProto::MsnInviteCommand(WPARAM, LPARAM)
{
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
- LPARAM(new InviteChatParam(NULL, NULL, this)));
+ DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
+ LPARAM(new InviteChatParam(nullptr, NULL, this)));
return 0;
}
@@ -178,7 +178,7 @@ void CMsnProto::MsnInitMainMenu(void) void CMsnProto::MSN_EnableMenuItems(bool bEnable)
{
for (int i = 0; i < _countof(menuItemsMain); i++)
- Menu_ModifyItem(menuItemsMain[i], NULL, INVALID_HANDLE_VALUE, bEnable ? 0 : CMIF_GRAYED);
+ Menu_ModifyItem(menuItemsMain[i], nullptr, INVALID_HANDLE_VALUE, bEnable ? 0 : CMIF_GRAYED);
if (bEnable)
Menu_ShowItem(menuItemsMain[1], emailEnabled);
@@ -189,14 +189,14 @@ void CMsnProto::MSN_EnableMenuItems(bool bEnable) static CMsnProto* GetProtoInstanceByHContact(MCONTACT hContact)
{
char* szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
for (int i = 0; i < g_Instances.getCount(); i++)
if (!mir_strcmp(szProto, g_Instances[i].m_szModuleName))
return &g_Instances[i];
- return NULL;
+ return nullptr;
}
static INT_PTR MsnMenuBlockCommand(WPARAM wParam, LPARAM lParam)
diff --git a/protocols/MSN/src/msn_mime.cpp b/protocols/MSN/src/msn_mime.cpp index ad7c5c5240..d8da556bec 100644 --- a/protocols/MSN/src/msn_mime.cpp +++ b/protocols/MSN/src/msn_mime.cpp @@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. MimeHeaders::MimeHeaders() :
mCount(0),
mAllocCount(0),
- mVals(NULL)
+ mVals(nullptr)
{
}
@@ -71,7 +71,7 @@ unsigned MimeHeaders::allocSlot(void) void MimeHeaders::addString(const char* name, const char* szValue, unsigned flags)
{
- if (szValue == NULL) return;
+ if (szValue == nullptr) return;
MimeHeader& H = mVals[allocSlot()];
H.name = name;
@@ -184,7 +184,7 @@ char* MimeHeaders::readFromBuffer(char* src) while (*src) {
char* peol = strchr(src, '\n');
- if (peol == NULL)
+ if (peol == nullptr)
return strchr(src, 0);
else if (peol == src)
return src + 1;
@@ -232,7 +232,7 @@ const char* MimeHeaders::find(const char* szFieldName) }
}
- return NULL;
+ return nullptr;
}
static const struct _tag_cpltbl
@@ -391,7 +391,7 @@ static void PQDecode(char* str) static size_t utf8toutf16(char* str, wchar_t* res)
{
wchar_t *dec = mir_utf8decodeW(str);
- if (dec == NULL) dec = mir_a2u(str);
+ if (dec == nullptr) dec = mir_a2u(str);
mir_wstrcpy(res, dec);
mir_free(dec);
return mir_wstrlen(res);
@@ -410,7 +410,7 @@ wchar_t* MimeHeaders::decode(const char* val) char *p = tbuf;
while (*p) {
char *cp = strstr(p, "=?");
- if (cp == NULL) break;
+ if (cp == nullptr) break;
*cp = 0;
size_t sz = utf8toutf16(p, resp);
@@ -418,21 +418,21 @@ wchar_t* MimeHeaders::decode(const char* val) cp += 2;
char *enc = strchr(cp, '?');
- if (enc == NULL) break;
+ if (enc == nullptr) break;
*(enc++) = 0;
char *fld = strchr(enc, '?');
- if (fld == NULL) break;
+ if (fld == nullptr) break;
*(fld++) = 0;
char *pe = strstr(fld, "?=");
- if (pe == NULL) break;
+ if (pe == nullptr) break;
*pe = 0;
switch (*enc) {
case 'b':
case 'B':
- mir_strcpy(fld, ptrA((char*)mir_base64_decode(fld, 0)));
+ mir_strcpy(fld, ptrA((char*)mir_base64_decode(fld, nullptr)));
break;
case 'q':
@@ -469,7 +469,7 @@ char* MimeHeaders::decodeMailBody(char* msgBody) else *(dst++) = *(src++);
}
*dst = 0;
- res = (char*)mir_base64_decode(msgBody, 0);
+ res = (char*)mir_base64_decode(msgBody, nullptr);
}
else {
res = mir_strdup(msgBody);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 044877456d..5bf2bb2aa3 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -75,7 +75,7 @@ char** CMsnProto::GetStatusMsgLoc(int status) for (int i = 0; i < MSN_NUM_MODES; i++)
if (modes[i] == status) return &msnModeMsgs[i];
- return NULL;
+ return nullptr;
}
// MSN_AddAuthRequest - adds the authorization event to the database
@@ -83,10 +83,10 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const ch {
MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true);
- DB_AUTH_BLOB blob(hContact, nick, 0, 0, email, reason);
+ DB_AUTH_BLOB blob(hContact, nick, nullptr, nullptr, email, reason);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(NULL);
+ pre.timestamp = (DWORD)time(nullptr);
pre.lParam = blob.size();
pre.szMessage = blob;
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
@@ -109,16 +109,16 @@ void CMsnProto::InitCustomFolders(void) char* MSN_GetAvatarHash(char* szContext, char** pszUrl)
{
if (pszUrl)
- *pszUrl = NULL;
+ *pszUrl = nullptr;
- if (szContext == NULL)
- return NULL;
+ if (szContext == nullptr)
+ return nullptr;
- char *res = NULL;
+ char *res = nullptr;
ezxml_t xmli = ezxml_parse_str(NEWSTR_ALLOCA(szContext), mir_strlen(szContext));
const char *szAvatarHash = ezxml_attr(xmli, "SHA1D");
- if (szAvatarHash != NULL) {
+ if (szAvatarHash != nullptr) {
unsigned hashLen;
mir_ptr<BYTE> hash((BYTE*)mir_base64_decode(szAvatarHash, &hashLen));
if (hash)
@@ -133,7 +133,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) else
mir_snprintf(szSetting, "Url%d", i);
pszUrlAttr = ezxml_attr(xmli, szSetting);
- if (pszUrlAttr == NULL)
+ if (pszUrlAttr == nullptr)
break;
if (pszUrlAttr[0] != 0) {
@@ -161,7 +161,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_ DBVARIANT dbv;
if (getString(hContact, "PictContext", &dbv) == 0) {
char* szAvatarHash = MSN_GetAvatarHash(dbv.pszVal);
- if (szAvatarHash != NULL) {
+ if (szAvatarHash != nullptr) {
wchar_t *sztAvatarHash = mir_a2u(szAvatarHash);
tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.", sztAvatarHash);
mir_free(sztAvatarHash);
@@ -182,7 +182,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_ mir_free(sztModuleName);
}
- if (ext == NULL) {
+ if (ext == nullptr) {
mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"*");
bool found = false;
@@ -265,7 +265,7 @@ int CMsnProto::MSN_SetMyAvatar(const wchar_t* sztFname, void* pData, size_t cbLe return fmt;
wchar_t szFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL);
+ MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), nullptr);
_wremove(szFileName);
MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), szExt);
@@ -298,7 +298,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, InitCustomFolders();
wchar_t* path = (wchar_t*)alloca(cbLen * sizeof(wchar_t));
- if (hCustomSmileyFolder == NULL || FoldersGetCustomPathT(hCustomSmileyFolder, path, (int)cbLen, L"")) {
+ if (hCustomSmileyFolder == nullptr || FoldersGetCustomPathT(hCustomSmileyFolder, path, (int)cbLen, L"")) {
wchar_t *tmpPath = Utils_ReplaceVarsW(L"%miranda_userdata%");
wchar_t *tszModuleName = mir_a2u(m_szModuleName);
tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s\\CustomSmiley", tmpPath, tszModuleName);
@@ -351,11 +351,11 @@ void CMsnProto::MSN_GoOffline(void) msnLoggedIn = false;
if (mStatusMsgTS)
- ForkThread(&CMsnProto::msn_storeProfileThread, NULL);
+ ForkThread(&CMsnProto::msn_storeProfileThread, nullptr);
mir_free(msnPreviousUUX);
- msnPreviousUUX = NULL;
- msnSearchId = NULL;
+ msnPreviousUUX = nullptr;
+ msnSearchId = nullptr;
if (!g_bTerminated)
MSN_EnableMenuItems(false);
@@ -495,7 +495,7 @@ void ThreadData::sendTerminate(void) // MSN_SendRawPacket - sends a packet accordingly to the MSN protocol
int ThreadData::sendRawMessage(int msgType, const char* data, int datLen)
{
- if (data == NULL)
+ if (data == nullptr)
data = "";
if (datLen == -1)
@@ -535,7 +535,7 @@ void CMsnProto::MSN_StartStopTyping(GCThreadData* info, bool start) // Helper to process texts
static char * HtmlEncodeUTF8T(const wchar_t *src)
{
- if (src == NULL)
+ if (src == nullptr)
return mir_strdup("");
return HtmlEncode(UTF8(src));
@@ -553,12 +553,12 @@ void CMsnProto::MSN_SendStatusMessage(const char*) // MSN_SendPacket - sends a packet accordingly to the MSN protocol
int ThreadData::sendPacket(const char* cmd, const char* fmt, ...)
{
- if (this == NULL) return 0;
+ if (this == nullptr) return 0;
CMStringA str;
int thisTrid = 0;
- if (fmt == NULL)
+ if (fmt == nullptr)
str = cmd;
else {
thisTrid = InterlockedIncrement(&mTrid);
@@ -573,7 +573,7 @@ int ThreadData::sendPacket(const char* cmd, const char* fmt, ...) }
}
- if (strchr(str, '\r') == NULL)
+ if (strchr(str, '\r') == nullptr)
str += "\r\n";
int result = send(str, str.GetLength());
@@ -582,7 +582,7 @@ int ThreadData::sendPacket(const char* cmd, const char* fmt, ...) int ThreadData::sendPacketPayload(const char* cmd, const char *param, const char* fmt, ...)
{
- if (this == NULL) return 0;
+ if (this == nullptr) return 0;
va_list vararg;
va_start(vararg, fmt);
@@ -730,7 +730,7 @@ void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url) if (p)
*p = 0;
- CMStringA post = HotmailLogin(CMStringA().Format(postdata, (unsigned)time(NULL), ptrA(mir_urlEncode(url))));
+ CMStringA post = HotmailLogin(CMStringA().Format(postdata, (unsigned)time(nullptr), 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)));
@@ -754,26 +754,26 @@ void CMsnProto::MSN_ShowError(const char* msgtext, ...) mir_free(buf);
- MSN_ShowPopup(m_tszUserName, tBuffer, MSN_ALLOW_MSGBOX | MSN_SHOW_ERROR, NULL);
+ MSN_ShowPopup(m_tszUserName, tBuffer, MSN_ALLOW_MSGBOX | MSN_SHOW_ERROR, nullptr);
}
void HandlePopupData(PopupData *tData) {
- if (tData != NULL) {
+ if (tData != nullptr) {
if (tData->flags & MSN_HOTMAIL_POPUP) {
- MCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL);
+ MCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, nullptr);
if (hContact)
pcli->pfnRemoveEvent(hContact, 1);
if (tData->flags & MSN_ALLOW_ENTER)
tData->proto->MsnInvokeMyURL(true, tData->url);
}
- else if (tData->url != NULL)
+ else if (tData->url != nullptr)
Utils_OpenUrl(tData->url);
}
}
void RemovePopupData(PopupData *tData) {
- if (tData != NULL && (tData->flags & MSN_HOTMAIL_POPUP)) {
- MCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL);
+ if (tData != nullptr && (tData->flags & MSN_HOTMAIL_POPUP)) {
+ MCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, nullptr);
if (hContact)
pcli->pfnRemoveEvent(hContact, 1);
}
@@ -796,7 +796,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara break;
case UM_FREEPLUGINDATA:
- if (tData != NULL && tData != (PopupData*)CALLSERVICE_NOTFOUND) {
+ if (tData != nullptr && tData != (PopupData*)CALLSERVICE_NOTFOUND) {
mir_free(tData->title);
mir_free(tData->text);
mir_free(tData->url);
@@ -835,7 +835,7 @@ void CMsnProto::InitPopups(void) mir_snprintf(name, "%s_%s", m_szModuleName, "Notify");
hPopupNotify = Popup_RegisterClass(&ppc);
- ppc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
+ ppc.hIcon = (HICON)LoadImage(nullptr, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
ppc.colorBack = RGB(191, 0, 0); //Red
ppc.colorText = RGB(255, 245, 225); //Yellow
ppc.iSeconds = 60;
@@ -855,7 +855,7 @@ void CALLBACK sttMainThreadCallback(void *param) if (pud->flags & MSN_ALLOW_MSGBOX) {
wchar_t szMsg[MAX_SECONDLINE + MAX_CONTACTNAME];
mir_snwprintf(szMsg, L"%s:\n%s", pud->title, pud->text);
- int ret = MessageBox(NULL, szMsg, TranslateT("MSN Protocol"),
+ int ret = MessageBox(nullptr, szMsg, TranslateT("MSN Protocol"),
MB_YESNO | (iserr ? MB_ICONERROR : MB_ICONINFORMATION));
if (ret == IDYES)
HandlePopupData(pud);
@@ -904,7 +904,7 @@ void CMsnProto::MSN_ShowPopup(const wchar_t* nickname, const wchar_t* msg, int f void CMsnProto::MSN_ShowPopup(const MCONTACT hContact, const wchar_t* msg, int flags)
{
- MSN_ShowPopup(GetContactNameT(hContact), msg, flags, NULL);
+ MSN_ShowPopup(GetContactNameT(hContact), msg, flags, nullptr);
}
@@ -918,8 +918,8 @@ filetransfer::filetransfer(CMsnProto* prt) std.flags = PFTS_UNICODE;
proto = prt;
- hLockHandle = CreateMutex(NULL, FALSE, NULL);
- hResumeEvt = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hLockHandle = CreateMutex(nullptr, FALSE, nullptr);
+ hResumeEvt = CreateEvent(nullptr, FALSE, FALSE, nullptr);
}
filetransfer::~filetransfer(void)
@@ -935,7 +935,7 @@ filetransfer::~filetransfer(void) _close(fileId);
if (!bCompleted && p2p_appID == MSN_APPID_FILE) {
- std.ptszFiles = NULL;
+ std.ptszFiles = nullptr;
std.totalFiles = 0;
proto->ProtoBroadcastAck(std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, this, 0);
}
@@ -947,7 +947,7 @@ filetransfer::~filetransfer(void) mir_free(std.tszCurrentFile);
mir_free(std.tszWorkingDir);
- if (std.ptszFiles != NULL) {
+ if (std.ptszFiles != nullptr) {
for (int i = 0; std.ptszFiles[i]; i++)
mir_free(std.ptszFiles[i]);
mir_free(std.ptszFiles);
@@ -1014,8 +1014,8 @@ int filetransfer::openNext(void) tType = SERVER_NOTIFICATION;
bAccepted = false;
- mir_free(p2p_branch); p2p_branch = NULL;
- mir_free(p2p_callID); p2p_callID = NULL;
+ mir_free(p2p_branch); p2p_branch = nullptr;
+ mir_free(p2p_callID); p2p_callID = nullptr;
}
else
proto->MSN_ShowError("Unable to open file '%s' for the file transfer, error %d", std.tszCurrentFile, errno);
@@ -1027,7 +1027,7 @@ int filetransfer::openNext(void) /////////////////////////////////////////////////////////////////////////////////////////
// TWinErrorCode class
-TWinErrorCode::TWinErrorCode() : mErrorText(NULL)
+TWinErrorCode::TWinErrorCode() : mErrorText(nullptr)
{
mErrorCode = ::GetLastError();
}
@@ -1039,16 +1039,16 @@ TWinErrorCode::~TWinErrorCode() char* TWinErrorCode::getText()
{
- if (mErrorText == NULL)
- return NULL;
+ if (mErrorText == nullptr)
+ return nullptr;
int tBytes = 0;
mErrorText = (char*)mir_alloc(256);
if (tBytes == 0)
tBytes = FormatMessageA(
- FORMAT_MESSAGE_FROM_SYSTEM, NULL,
- mErrorCode, LANG_NEUTRAL, mErrorText, 256, NULL);
+ FORMAT_MESSAGE_FROM_SYSTEM, nullptr,
+ mErrorCode, LANG_NEUTRAL, mErrorText, 256, nullptr);
if (tBytes == 0)
tBytes = mir_snprintf(mErrorText, 256, "unknown Windows error code %d", mErrorCode);
@@ -1068,7 +1068,7 @@ char* TWinErrorCode::getText() bool CMsnProto::MSN_IsMyContact(MCONTACT hContact)
{
const char* szProto = GetContactProto(hContact);
- return szProto != NULL && mir_strcmp(m_szModuleName, szProto) == 0;
+ return szProto != nullptr && mir_strcmp(m_szModuleName, szProto) == 0;
}
bool CMsnProto::MSN_IsMeByContact(MCONTACT hContact, char* szEmail)
@@ -1093,7 +1093,7 @@ bool MSN_MsgWndExist(MCONTACT hContact) hContact = db_mc_getMeta(hContact);
if (hContact != 0) {
res = Srmm_GetWindowData(hContact, msgWinData) != 0;
- res |= (msgWinData.hwndWindow == NULL);
+ res |= (msgWinData.hwndWindow == nullptr);
}
}
return res;
@@ -1157,5 +1157,5 @@ char* GetGlobalIp(void) return mir_strdup(ihaddr->szIp[i]);
mir_free(ihaddr);
- return NULL;
+ return nullptr;
}
diff --git a/protocols/MSN/src/msn_msgsplit.cpp b/protocols/MSN/src/msn_msgsplit.cpp index 3668065c50..2e61ffbd11 100644 --- a/protocols/MSN/src/msn_msgsplit.cpp +++ b/protocols/MSN/src/msn_msgsplit.cpp @@ -25,7 +25,7 @@ chunkedmsg::chunkedmsg(const char* tid, const size_t totsz, const bool tbychunk) : size(totsz), recvsz(0), bychunk(tbychunk)
{
id = mir_strdup(tid);
- msg = tbychunk ? NULL : (char*)mir_alloc(totsz + 1);
+ msg = tbychunk ? nullptr : (char*)mir_alloc(totsz + 1);
}
chunkedmsg::~chunkedmsg()
@@ -61,7 +61,7 @@ bool chunkedmsg::get(char*& tmsg, size_t& tsize) msg[recvsz] = 0;
tmsg = msg;
tsize = recvsz;
- msg = NULL;
+ msg = nullptr;
}
return alldata;
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index a78ba0f48d..d14771eaca 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -63,7 +63,7 @@ HANDLE GetIconHandle(int iconId) if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
void ReleaseIconEx(const char* name, bool big)
@@ -155,7 +155,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP TranslateT("Server groups import may change your contact list layout after next login. Do you want to upload your groups to the server?"),
TranslateT("MSN Protocol"), MB_YESNOCANCEL)) {
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- proto->MSN_UploadServerGroups(NULL);
+ proto->MSN_UploadServerGroups(nullptr);
}
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -181,7 +181,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (szFile[0] == '\"') {
char* p = strchr(szFile + 1, '\"');
- if (p != NULL) {
+ if (p != nullptr) {
*p = '\0';
memmove(szFile, szFile + 1, mir_strlen(szFile));
tSelectLen += 2;
@@ -190,7 +190,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
char* p = strchr(szFile, ' ');
- if (p != NULL) *p = '\0';
+ if (p != nullptr) *p = '\0';
LBL_Continue:
tSelectLen += mir_strlen(szFile);
@@ -203,7 +203,7 @@ LBL_Continue: if (GetOpenFileNameA(&ofn) != TRUE)
break;
- if (strchr(szFile, ' ') != NULL) {
+ if (strchr(szFile, ' ') != nullptr) {
char tmpBuf[MAX_PATH + 2];
mir_snprintf(tmpBuf, "\"%s\"", szFile);
mir_strcpy(szFile, tmpBuf);
@@ -375,7 +375,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam if (proto->getByte("SlowSend", FALSE)) {
if (db_get_dw(NULL, "SRMsg", "MessageTimeout", 60000) < 60000 ||
db_get_dw(NULL, "SRMM", "MessageTimeout", 60000) < 60000) {
- MessageBox(NULL, TranslateT("MSN Protocol requires message timeout to be not less then 60 sec. Correct the timeout value."),
+ MessageBox(nullptr, TranslateT("MSN Protocol requires message timeout to be not less then 60 sec. Correct the timeout value."),
TranslateT("MSN Protocol"), MB_OK | MB_ICONINFORMATION);
}
}
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index ac9a861cf7..b5cff2b7f4 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -146,7 +146,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : mir_snwprintf(szBuffer, TranslateT("%s plugin connections"), m_tszUserName);
m_hNetlibUser = Netlib_RegisterUser(&nlu);
- m_DisplayNameCache = NULL;
+ m_DisplayNameCache = nullptr;
}
CMsnProto::~CMsnProto()
@@ -200,7 +200,7 @@ int CMsnProto::OnModulesLoaded(WPARAM, LPARAM) int CMsnProto::OnPreShutdown(WPARAM, LPARAM)
{
g_bTerminated = true;
- ReleaseSemaphore(hevAvatarQueue, 1, NULL);
+ ReleaseSemaphore(hevAvatarQueue, 1, nullptr);
Popup_UnregisterClass(hPopupError);
Popup_UnregisterClass(hPopupHotmail);
@@ -344,7 +344,7 @@ int CMsnProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) DB_AUTH_BLOB blob(dbei.pBlob);
MsnContact* msc = Lists_Get(blob.get_email());
- if (msc == NULL) return 0;
+ if (msc == nullptr) return 0;
MSN_AddUser(NULL, blob.get_email(), msc->netId, LIST_PL + LIST_REMOVE);
MSN_AddUser(NULL, blob.get_email(), msc->netId, LIST_BL);
@@ -367,7 +367,7 @@ void __cdecl CMsnProto::MsnSearchAckThread(void* arg) T2Utf email(emailT);
if (Lists_IsInList(LIST_FL, email)) {
- MSN_ShowPopup(emailT, TranslateT("Contact already in your contact list"), MSN_ALLOW_MSGBOX, NULL);
+ MSN_ShowPopup(emailT, TranslateT("Contact already in your contact list"), MSN_ALLOW_MSGBOX, nullptr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
mir_free(arg);
return;
@@ -375,7 +375,7 @@ void __cdecl CMsnProto::MsnSearchAckThread(void* arg) if (MyOptions.netId == NETID_SKYPE) MSN_SKYABSearch(email, arg);
else {
- unsigned res = MSN_ABContactAdd(email, NULL, NETID_MSN, NULL, 1, true);
+ unsigned res = MSN_ABContactAdd(email, nullptr, NETID_MSN, nullptr, 1, true);
switch (res) {
case 0:
case 2:
@@ -394,7 +394,7 @@ void __cdecl CMsnProto::MsnSearchAckThread(void* arg) break;
case 1:
- if (strstr(email, "@yahoo.com") == NULL)
+ if (strstr(email, "@yahoo.com") == nullptr)
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
break;
@@ -409,7 +409,7 @@ void __cdecl CMsnProto::MsnSearchAckThread(void* arg) HANDLE __cdecl CMsnProto::SearchBasic(const wchar_t* id)
{
- if (!msnLoggedIn) return 0;
+ if (!msnLoggedIn) return nullptr;
wchar_t* email = mir_wstrdup(id);
ForkThread(&CMsnProto::MsnSearchAckThread, email);
@@ -440,7 +440,7 @@ static void MyNetlibConnFromUrl(const char* szUrl, NETLIBOPENCONNECTION &nloc) char* pcolon = strrchr(szHost, ':');
if (pcolon) {
*pcolon = '\0';
- nloc.wPort = (WORD)strtol(pcolon+1, NULL, 10);
+ nloc.wPort = (WORD)strtol(pcolon+1, nullptr, 10);
}
else nloc.wPort = secur ? 443 : 80;
nloc.flags = (secur ? NLOCF_SSL : 0);
@@ -467,7 +467,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) const char *pszSkypeToken;
if (ft->fileId != -1 && (pszSkypeToken=authSkypeToken.Token())) {
- NETLIBHTTPHEADER nlbhHeaders[3] = { 0 };
+ NETLIBHTTPHEADER nlbhHeaders[3] = {};
NETLIBHTTPREQUEST nlhr = { 0 }, *nlhrReply;
char szRange[32];
@@ -527,7 +527,7 @@ HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* s {
filetransfer* ft = (filetransfer*)hTransfer;
- if ((ft->std.tszWorkingDir = mir_wstrdup(szPath)) == NULL) {
+ if ((ft->std.tszWorkingDir = mir_wstrdup(szPath)) == nullptr) {
wchar_t szCurrDir[MAX_PATH];
GetCurrentDirectory(_countof(szCurrDir), szCurrDir);
ft->std.tszWorkingDir = mir_wstrdup(szCurrDir);
@@ -750,7 +750,7 @@ void CMsnProto::MsnFakeAck(void* arg) // MsnSendMessage - sends the message to a server
int __cdecl CMsnProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc)
{
- const char *errMsg = NULL;
+ const char *errMsg = nullptr;
if (!msnLoggedIn) {
errMsg = Translate("Protocol is offline");
@@ -766,7 +766,7 @@ int __cdecl CMsnProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc) }
char *msg = (char*)pszSrc;
- if (msg == NULL)
+ if (msg == nullptr)
return 0;
int rtlFlag = (flags & PREF_RTL) ? MSG_RTL : 0;
@@ -781,7 +781,7 @@ int __cdecl CMsnProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc) seq = 999997;
}
else {
- errMsg = NULL;
+ errMsg = nullptr;
seq = msnNsThread->sendMessage('1', tEmail, netId, msg, rtlFlag);
}
ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, errMsg, this));
@@ -795,7 +795,7 @@ int __cdecl CMsnProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc) }
else {
seq = msnNsThread->sendMessage('1', tEmail, netId, msg, rtlFlag);
- ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, NULL, this));
+ ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, nullptr, this));
}
break;
@@ -808,13 +808,13 @@ int __cdecl CMsnProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc) else {
// MSNP24 doesn't have a switchboard anymore
bool isOffline = true;
- ThreadData *thread = NULL;
+ ThreadData *thread = nullptr;
- if (thread == NULL) {
+ if (thread == nullptr) {
if (isOffline) {
if (netId != NETID_LCS) {
seq = msnNsThread->sendMessage('1', tEmail, netId, msg, rtlFlag | MSG_OFFLINE);
- ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, NULL, this));
+ ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, nullptr, this));
}
else {
seq = 999993;
@@ -850,7 +850,7 @@ int __cdecl CMsnProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT }
msg.Append("</contacts>");
seq = msnNsThread->sendMessage('1', tEmail, netId, msg, MSG_CONTACT);
- ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, NULL, this, ACKTYPE_CONTACTS));
+ ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, nullptr, this, ACKTYPE_CONTACTS));
return seq;
}
@@ -859,7 +859,7 @@ int __cdecl CMsnProto::SetAwayMsg(int status, const wchar_t* msg) {
char** msgptr = GetStatusMsgLoc(status);
- if (msgptr == NULL)
+ if (msgptr == nullptr)
return 1;
mir_free(*msgptr);
@@ -899,13 +899,13 @@ int __cdecl CMsnProto::SetStatus(int iNewStatus) char szPassword[100];
int ps = db_get_static(NULL, m_szModuleName, "Password", szPassword, sizeof(szPassword));
if (ps != 0 || *szPassword == 0) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPASSWORD);
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
return 0;
}
if (*MyOptions.szEmail == 0) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_BADUSERID);
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
return 0;
}
diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index 3f09287e92..35f6b0e829 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -46,11 +46,11 @@ static wchar_t* get_json_str(JSONNode *item, const char *pszValue) wchar_t *ret = json_as_string(node);
if (!mir_wstrcmp(ret, L"null")) {
mir_free(ret);
- return NULL;
+ return nullptr;
}
return ret;
}
- return NULL;
+ return nullptr;
}
bool CMsnProto::MSN_SKYABRefreshClist(void)
@@ -73,7 +73,7 @@ bool CMsnProto::MSN_SKYABRefreshClist(void) hHttpsConnection = nlhrReply->nlc;
if (nlhrReply->resultCode == 200 && nlhrReply->pData) {
JSONROOT root(nlhrReply->pData);
- if (root == NULL)
+ if (root == nullptr)
return false;
JSONNode *items = json_as_array(root), *item;
@@ -82,7 +82,7 @@ bool CMsnProto::MSN_SKYABRefreshClist(void) ptrW nick;
item = json_at(items, i);
- if (item == NULL)
+ if (item == nullptr)
break;
ptrA skypename(mir_u2a(ptrW(json_as_string(json_get(item, "skypename")))));
@@ -93,7 +93,7 @@ bool CMsnProto::MSN_SKYABRefreshClist(void) if (hContact) {
if (!json_as_bool(json_get(item, "authorized"))) lstId = LIST_PL;
if (!json_as_bool(json_get(item, "blocked"))) lstId = LIST_BL;
- Lists_Add(lstId, NETID_SKYPE, skypename, NULL, pszNick, NULL);
+ Lists_Add(lstId, NETID_SKYPE, skypename, NULL, pszNick, nullptr);
post.AppendFormat("contacts[]=%s&", skypename);
}
}
@@ -103,7 +103,7 @@ bool CMsnProto::MSN_SKYABRefreshClist(void) }
Netlib_FreeHttpRequest(nlhrReply);
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
return bRet;
}
@@ -128,12 +128,12 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST) hHttpsConnection = nlhrReply->nlc;
if (nlhrReply->resultCode == 200 && nlhrReply->pData) {
JSONROOT root(nlhrReply->pData);
- if (root == NULL) return false;
+ if (root == nullptr) return false;
JSONNode *items = json_as_array(root), *item, *node;
for (size_t i = 0; i < json_size(items); i++) {
item = json_at(items, i);
- if (item == NULL)
+ if (item == nullptr)
break;
node = json_get(item, "username");
@@ -157,7 +157,7 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST) }
Netlib_FreeHttpRequest(nlhrReply);
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
return bRet;
}
@@ -181,7 +181,7 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) hHttpsConnection = nlhrReply->nlc;
if (nlhrReply->resultCode == 200 && nlhrReply->pData) {
JSONROOT item(nlhrReply->pData);
- if (item == NULL)
+ if (item == nullptr)
return false;
ptrA skypename(mir_u2a(ptrW(json_as_string(json_get(item, "username")))));
@@ -229,7 +229,7 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) }
Netlib_FreeHttpRequest(nlhrReply);
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
return bRet;
}
@@ -260,7 +260,7 @@ bool CMsnProto::MSN_SKYABBlockContact(const char *wlid, const char *pszAction) Netlib_FreeHttpRequest(nlhrReply);
bRet = true;
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
return bRet;
}
@@ -288,7 +288,7 @@ bool CMsnProto::MSN_SKYABDeleteContact(const char *wlid) Netlib_FreeHttpRequest(nlhrReply);
bRet = true;
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
return bRet;
}
@@ -314,7 +314,7 @@ bool CMsnProto::MSN_SKYABAuthRsp(const char *wlid, const char *pszAction) Netlib_FreeHttpRequest(nlhrReply);
bRet = true;
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
return bRet;
}
@@ -346,7 +346,7 @@ bool CMsnProto::MSN_SKYABAuthRq(const char *wlid, const char *pszGreeting) Netlib_FreeHttpRequest(nlhrReply);
bRet = true;
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
return bRet;
}
@@ -376,7 +376,7 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch) hHttpsConnection = nlhrReply->nlc;
if (nlhrReply->resultCode == 200 && nlhrReply->pData) {
JSONROOT root(nlhrReply->pData);
- if (root == NULL) {
+ if (root == nullptr) {
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, hSearch, 0);
return false;
}
@@ -402,7 +402,7 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch) }
Netlib_FreeHttpRequest(nlhrReply);
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
return bRet;
}
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index 108cb0cb77..2f82ab7a1c 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -78,7 +78,7 @@ ezxml_t CMsnProto::getSoapResponse(ezxml_t bdy, const char* service) mir_snprintf(resp2, "%sResult", service);
ezxml_t res = ezxml_get(bdy, "soap:Body", 0, resp1, 0, resp2, -1);
- if (res == NULL)
+ if (res == nullptr)
res = ezxml_get(bdy, "s:Body", 0, resp1, 0, resp2, -1);
return res;
@@ -142,7 +142,7 @@ bool CMsnProto::MSN_ABAdd(bool allowRecurse) ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
@@ -150,13 +150,13 @@ bool CMsnProto::MSN_ABAdd(bool allowRecurse) tResult = getSslResult(&abUrl, szData, reqHdr, status);
if (tResult)
break;
- UpdateABHost("ABAdd", NULL);
+ UpdateABHost("ABAdd", nullptr);
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateABHost("ABAdd", abUrl);
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
@@ -206,29 +206,29 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse) ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost("FindMembership", true);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost("FindMembership", NULL);
+ if (tResult == nullptr) UpdateABHost("FindMembership", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
if (status == 200) {
UpdateABCacheKey(xmlm, true);
ezxml_t body = getSoapResponse(xmlm, "FindMembership");
ezxml_t svcs = ezxml_get(body, "Services", 0, "Service", -1);
- UpdateABHost("FindMembership", body ? abUrl : NULL);
+ UpdateABHost("FindMembership", body ? abUrl : nullptr);
- while (svcs != NULL) {
+ while (svcs != nullptr) {
const char* szType = ezxml_txt(ezxml_get(svcs, "Info", 0, "Handle", 0, "Type", -1));
if (_stricmp(szType, "Messenger") == 0) break;
svcs = ezxml_next(svcs);
@@ -238,25 +238,25 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse) if (pszLastChange[0])
setString("SharingLastChange", pszLastChange);
- for (ezxml_t mems = ezxml_get(svcs, "Memberships", 0, "Membership", -1); mems != NULL; mems = ezxml_next(mems)) {
+ for (ezxml_t mems = ezxml_get(svcs, "Memberships", 0, "Membership", -1); mems != nullptr; mems = ezxml_next(mems)) {
const char* szRole = ezxml_txt(ezxml_child(mems, "MemberRole"));
int lstId = ((mir_strcmp(szRole, "Allow") == 0) ? LIST_AL : ((mir_strcmp(szRole, "Block") == 0) ? LIST_BL :
((mir_strcmp(szRole, "Reverse") == 0) ? LIST_RL : ((mir_strcmp(szRole, "Pending") == 0) ? LIST_PL : 0))));
- for (ezxml_t memb = ezxml_get(mems, "Members", 0, "Member", -1); memb != NULL; memb = ezxml_next(memb)) {
+ for (ezxml_t memb = ezxml_get(mems, "Members", 0, "Member", -1); memb != nullptr; memb = ezxml_next(memb)) {
bool deleted = mir_strcmp(ezxml_txt(ezxml_child(memb, "Deleted")), "true") == 0;
const char *szType = ezxml_txt(ezxml_child(memb, "Type"));
- const char *szInvite = NULL, *szEmail = NULL, *szNick = NULL;
+ const char *szInvite = nullptr, *szEmail = nullptr, *szNick = nullptr;
char email[128];
int netId;
if (mir_strcmp(szType, "Passport") == 0) {
netId = NETID_MSN;
szEmail = ezxml_txt(ezxml_child(memb, "PassportName"));
- szNick = ezxml_txt(ezxml_child(memb, "DisplayName")); if (!szNick[0]) szNick = NULL;
+ szNick = ezxml_txt(ezxml_child(memb, "DisplayName")); if (!szNick[0]) szNick = nullptr;
ezxml_t anot = ezxml_get(memb, "Annotations", 0, "Annotation", -1);
- while (anot != NULL) {
+ while (anot != nullptr) {
if (mir_strcmp(ezxml_txt(ezxml_child(anot, "Name")), "MSN.IM.InviteMessage") == 0)
szInvite = ezxml_txt(ezxml_child(anot, "Value"));
@@ -270,10 +270,10 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse) }
else if (mir_strcmp(szType, "Email") == 0) {
szEmail = ezxml_txt(ezxml_child(memb, "Email"));
- szNick = ezxml_txt(ezxml_child(memb, "DisplayName")); if (!szNick[0]) szNick = NULL;
+ szNick = ezxml_txt(ezxml_child(memb, "DisplayName")); if (!szNick[0]) szNick = nullptr;
netId = strstr(szEmail, "@yahoo.com") ? NETID_YAHOO : NETID_LCS;
ezxml_t anot = ezxml_get(memb, "Annotations", 0, "Annotation", -1);
- while (anot != NULL) {
+ while (anot != nullptr) {
if (mir_strcmp(ezxml_txt(ezxml_child(anot, "Name")), "MSN.IM.BuddyType") == 0)
netId = atol(ezxml_txt(ezxml_child(anot, "Value")));
else if (mir_strcmp(ezxml_txt(ezxml_child(anot, "Name")), "MSN.IM.InviteMessage") == 0)
@@ -302,7 +302,7 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse) status = MSN_SharingFindMembership(deltas, false) ? 200 : 500;
}
}
- else UpdateABHost("FindMembership", NULL);
+ else UpdateABHost("FindMembership", nullptr);
ezxml_free(xmlm);
}
@@ -391,20 +391,20 @@ bool CMsnProto::MSN_SharingAddDelMember(const char* szEmail, const int listId, c ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost(szMethod, true);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost(szMethod, NULL);
+ if (tResult == nullptr) UpdateABHost(szMethod, nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateABHost(szMethod, abUrl);
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateABCacheKey(xmlm, true);
@@ -471,13 +471,13 @@ bool CMsnProto::MSN_SharingMyProfile(bool allowRecurse) ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost("AddMember", true);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost("AddMember", NULL);
+ if (tResult == nullptr) UpdateABHost("AddMember", nullptr);
else break;
}
@@ -573,26 +573,26 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost(szMethod, false);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost(szMethod, NULL);
+ if (tResult == nullptr) UpdateABHost(szMethod, nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateABCacheKey(xmlm, false);
if (status == 200) {
ezxml_t body = getSoapResponse(xmlm, szMethod);
- UpdateABHost(szMethod, body ? abUrl : NULL);
+ UpdateABHost(szMethod, body ? abUrl : nullptr);
ezxml_t ab = ezxml_child(body, "Ab");
if (mir_strcmp(szMethod, "ABFindByContacts")) {
@@ -610,7 +610,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas if (MyOptions.ManageServer) {
ezxml_t grp = ezxml_get(body, szGroups, 0, "Group", -1);
- while (grp != NULL) {
+ while (grp != nullptr) {
const char* szGrpId = ezxml_txt(ezxml_child(grp, "groupId"));
const char* szGrpName = ezxml_txt(ezxml_get(grp, "groupInfo", 0, "name", -1));
MSN_AddGroup(szGrpName, szGrpId, true);
@@ -619,7 +619,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas }
}
- for (ezxml_t cont = ezxml_get(body, szContacts, 0, "Contact", -1); cont != NULL; cont = ezxml_next(cont)) {
+ for (ezxml_t cont = ezxml_get(body, szContacts, 0, "Contact", -1); cont != nullptr; cont = ezxml_next(cont)) {
const char* szContId = ezxml_txt(ezxml_child(cont, "contactId"));
ezxml_t contInf = ezxml_child(cont, "contactInfo");
@@ -636,7 +636,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas if (szEmail[0] == '\0') {
ezxml_t eml = ezxml_get(contInf, "emails", 0, "ContactEmail", -1);
- while (eml != NULL) {
+ while (eml != nullptr) {
szMsgUsr = ezxml_txt(ezxml_child(eml, "isMessengerEnabled"));
if (mir_strcmp(szMsgUsr, "true") == 0) {
szEmail = ezxml_txt(ezxml_child(eml, "email"));
@@ -652,7 +652,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas if (netId == NETID_UNKNOWN) {
ezxml_t phn = ezxml_get(contInf, "phones", 0, "ContactPhone", -1);
- while (phn != NULL) {
+ while (phn != nullptr) {
szMsgUsr = ezxml_txt(ezxml_child(phn, "isMessengerEnabled"));
if (mir_strcmp(szMsgUsr, "true") == 0) {
szEmail = ezxml_txt(ezxml_child(phn, "number"));
@@ -681,9 +681,9 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas }
}
- const char* szNick = NULL;
+ const char* szNick = nullptr;
ezxml_t anot = ezxml_get(contInf, "annotations", 0, "Annotation", -1);
- while (anot != NULL) {
+ while (anot != nullptr) {
if (mir_strcmp(ezxml_txt(ezxml_child(anot, "Name")), "AB.NickName") == 0) {
szNick = ezxml_txt(ezxml_child(anot, "Value"));
db_set_utf(hContact, m_szModuleName, "Nick", szNick);
@@ -694,7 +694,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas }
anot = ezxml_next(anot);
}
- if (szNick == NULL)
+ if (szNick == nullptr)
delSetting(hContact,"Nick");
setString(hContact, "ID", szContId);
@@ -740,7 +740,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas db_set_s(hContact, "UserInfo", "MyNotes", szTmp);
ezxml_t loc = ezxml_get(contInf, "locations", 0, "ContactLocation", -1);
- while (loc != NULL) {
+ while (loc != nullptr) {
const char* szCntType = ezxml_txt(ezxml_child(loc, "contactLocationType"));
int locid = -1;
@@ -767,7 +767,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas }
ezxml_t web = ezxml_get(contInf, "webSites", 0, "ContactWebSite", -1);
- while (web != NULL) {
+ while (web != nullptr) {
const char* szCntType = ezxml_txt(ezxml_child(web, "contactWebSiteType"));
if (mir_strcmp(szCntType, "ContactWebSiteBusiness") == 0) {
szTmp = ezxml_txt(ezxml_child(web, "webURL"));
@@ -792,7 +792,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas setStringUtf(NULL, "LastName", szTmp);
ezxml_t anot = ezxml_get(contInf, "annotations", 0, "Annotation", -1);
- while (anot != NULL) {
+ while (anot != nullptr) {
if (mir_strcmp(ezxml_txt(ezxml_child(anot, "Name")), "MSN.IM.BLP") == 0)
msnOtherContactsBlocked = !atol(ezxml_txt(ezxml_child(anot, "Value")));
@@ -800,7 +800,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas }
ezxml_t nil = ezxml_get(contInf, "NetworkInfoList", 0, "NetworkInfo", -1);
- while (nil != NULL) {
+ while (nil != nullptr) {
if (mir_strcmp(ezxml_txt(ezxml_child(nil, "SourceId")), "SKYPE") == 0) {
const char *pszPartner = ezxml_txt(ezxml_child(nil, "DomainTag"));
if (*pszPartner) setString("SkypePartner", pszPartner);
@@ -829,7 +829,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas }
}
else
- UpdateABHost(szMethod, NULL);
+ UpdateABHost(szMethod, nullptr);
ezxml_free(xmlm);
}
@@ -873,11 +873,11 @@ bool CMsnProto::MSN_ABRefreshClist(unsigned int nTry) bRet = true;
ezxml_t abinf = ezxml_child(xmlm, "ab");
- for (ezxml_t pers = ezxml_get(abinf, "persons", 0, "Person", -1); pers != NULL; pers = ezxml_next(pers)) {
+ for (ezxml_t pers = ezxml_get(abinf, "persons", 0, "Person", -1); pers != nullptr; pers = ezxml_next(pers)) {
const char *cid = ezxml_txt(ezxml_child(pers, "cid"));
if (!mir_strcmp(cid, mycid)) continue;
- for (ezxml_t cont = ezxml_get(pers, "contacts", 0, "Contact", -1); cont != NULL; cont = ezxml_next(cont)) {
+ for (ezxml_t cont = ezxml_get(pers, "contacts", 0, "Contact", -1); cont != nullptr; cont = ezxml_next(cont)) {
int netId;
const char* szEmail;
@@ -899,7 +899,7 @@ bool CMsnProto::MSN_ABRefreshClist(unsigned int nTry) if (!*szEmail) continue;
ezxml_t xmlnick = ezxml_child(pers, "nickname");
- const char *pszNickname = xmlnick?xmlnick->txt:NULL;
+ const char *pszNickname = xmlnick?xmlnick->txt:nullptr;
int lstId = LIST_FL;
if (mir_strcmpi(ezxml_txt(ezxml_child(cont, "isBlocked")), "true") == 0) lstId = LIST_BL;
else if (mir_strcmp(ezxml_txt(ezxml_child(cont, "contactState")), "2") == 0) lstId = LIST_PL;
@@ -949,7 +949,7 @@ bool CMsnProto::MSN_ABRefreshClist(unsigned int nTry) }
Netlib_FreeHttpRequest(nlhrReply);
}
- else hHttpsConnection = NULL;
+ else hHttpsConnection = nullptr;
return bRet;
}
@@ -967,14 +967,14 @@ bool CMsnProto::MSN_ABAddDelContactGroup(const char* szCntId, const char* szGrpI ezxml_t tbdy, node;
ezxml_t xmlp = abSoapHdr(szMethod, "Timer", tbdy, reqHdr);
- if (szGrpId != NULL) {
+ if (szGrpId != nullptr) {
node = ezxml_add_child(tbdy, "groupFilter", 0);
node = ezxml_add_child(node, "groupIds", 0);
node = ezxml_add_child(node, "guid", 0);
ezxml_set_txt(node, szGrpId);
}
- if (szCntId != NULL) {
+ if (szCntId != nullptr) {
node = ezxml_add_child(tbdy, "contacts", 0);
node = ezxml_add_child(node, "Contact", 0);
node = ezxml_add_child(node, "contactId", 0);
@@ -985,20 +985,20 @@ bool CMsnProto::MSN_ABAddDelContactGroup(const char* szCntId, const char* szGrpI ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost(szMethod, false);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost(szMethod, NULL);
+ if (tResult == nullptr) UpdateABHost(szMethod, nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateABHost(szMethod, abUrl);
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateABCacheKey(xmlm, false);
@@ -1046,20 +1046,20 @@ void CMsnProto::MSN_ABAddGroup(const char* szGrpName, bool allowRecurse) ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost("ABGroupAdd", false);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost("ABGroupAdd", NULL);
+ if (tResult == nullptr) UpdateABHost("ABGroupAdd", nullptr);
else break;
}
free(szData);
mir_free(reqHdr);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateABHost("ABGroupAdd", abUrl);
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateABCacheKey(xmlm, false);
@@ -1103,20 +1103,20 @@ void CMsnProto::MSN_ABRenameGroup(const char* szGrpName, const char* szGrpId, bo ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost("ABGroupUpdate", false);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost("ABGroupUpdate", NULL);
+ if (tResult == nullptr) UpdateABHost("ABGroupUpdate", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateABHost("ABGroupUpdate", abUrl);
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateABCacheKey(xmlm, false);
@@ -1188,20 +1188,20 @@ bool CMsnProto::MSN_ABAddRemoveContact(const char* szCntId, int netId, bool add, ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost("ABContactUpdate", false);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost("ABContactUpdate", NULL);
+ if (tResult == nullptr) UpdateABHost("ABContactUpdate", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateABHost("ABContactUpdate", abUrl);
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateABCacheKey(xmlm, false);
@@ -1233,7 +1233,7 @@ bool CMsnProto::MSN_ABUpdateProperty(const char* szCntId, const char* propName, ezxml_set_attr(cont, "xmlns", "http://www.msn.com/webservices/AddressBook");
ezxml_t conti = ezxml_add_child(cont, "contactInfo", 0);
- if (szCntId == NULL) {
+ if (szCntId == nullptr) {
node = ezxml_add_child(conti, "contactType", 0);
ezxml_set_txt(node, "Me");
}
@@ -1254,20 +1254,20 @@ bool CMsnProto::MSN_ABUpdateProperty(const char* szCntId, const char* propName, mir_free(szPrpChg);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost("ABContactUpdate", false);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost("ABContactUpdate", NULL);
+ if (tResult == nullptr) UpdateABHost("ABContactUpdate", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateABHost("ABContactUpdate", abUrl);
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateABCacheKey(xmlm, false);
@@ -1297,7 +1297,7 @@ void CMsnProto::MSN_ABUpdateAttr(const char* szCntId, const char* szAttr, const ezxml_t cont = ezxml_add_child(node, "Contact", 0);
ezxml_set_attr(cont, "xmlns", "http://www.msn.com/webservices/AddressBook");
ezxml_t conti = ezxml_add_child(cont, "contactInfo", 0);
- if (szCntId == NULL) {
+ if (szCntId == nullptr) {
node = ezxml_add_child(conti, "contactType", 0);
ezxml_set_txt(node, "Me");
}
@@ -1310,7 +1310,7 @@ void CMsnProto::MSN_ABUpdateAttr(const char* szCntId, const char* szAttr, const node = ezxml_add_child(anot, "Name", 0);
ezxml_set_txt(node, szAttr);
node = ezxml_add_child(anot, "Value", 0);
- if (szValue != NULL) ezxml_set_txt(node, szValue);
+ if (szValue != nullptr) ezxml_set_txt(node, szValue);
node = ezxml_add_child(cont, "propertiesChanged", 0);
ezxml_set_txt(node, "Annotation");
@@ -1319,20 +1319,20 @@ void CMsnProto::MSN_ABUpdateAttr(const char* szCntId, const char* szAttr, const ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost("ABContactUpdate", false);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost("ABContactUpdate", NULL);
+ if (tResult == nullptr) UpdateABHost("ABContactUpdate", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateABHost("ABContactUpdate", abUrl);
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateABCacheKey(xmlm, false);
@@ -1352,7 +1352,7 @@ void CMsnProto::MSN_ABUpdateAttr(const char* szCntId, const char* szAttr, const void CMsnProto::MSN_ABUpdateNick(const char* szNick, const char* szCntId)
{
- if (szCntId != NULL)
+ if (szCntId != nullptr)
MSN_ABUpdateAttr(szCntId, "AB.NickName", szNick);
else
MSN_ABUpdateProperty(szCntId, "displayName", szNick);
@@ -1372,7 +1372,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in ezxml_t contp;
const char* szEmailNP = strchr(szEmail, ':');
- if (szEmailNP != NULL) netId = NETID_MOB;
+ if (szEmailNP != nullptr) netId = NETID_MOB;
switch (netId) {
case NETID_MSN:
@@ -1396,7 +1396,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in case NETID_MOB:
++szEmailNP;
- if (szNick == NULL) szNick = szEmailNP;
+ if (szNick == nullptr) szNick = szEmailNP;
node = ezxml_add_child(conti, "phones", 0);
contp = ezxml_add_child(node, "ContactPhone", 0);
node = ezxml_add_child(contp, "contactPhoneType", 0);
@@ -1426,7 +1426,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in break;
}
- if (szNick != NULL) {
+ if (szNick != nullptr) {
node = ezxml_add_child(conti, "annotations", 0);
ezxml_t annt = ezxml_add_child(node, "Annotation", 0);
node = ezxml_add_child(annt, "Name", 0);
@@ -1443,20 +1443,20 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost("ABContactAdd", false);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost("ABContactAdd", NULL);
+ if (tResult == nullptr) UpdateABHost("ABContactAdd", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateABCacheKey(xmlm, false);
if (status == 200) {
@@ -1465,7 +1465,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in const char *szContId = ezxml_txt(ezxml_child(body, "guid"));
if (search)
- MSN_ABAddDelContactGroup(szContId, NULL, "ABContactDelete");
+ MSN_ABAddDelContactGroup(szContId, nullptr, "ABContactDelete");
else {
MSN_ABAddRemoveContact(szContId, NETID_MSN, true);
MCONTACT hContact = MSN_HContactFromEmail(szEmail, szNick ? szNick : szEmail, true, false);
@@ -1490,7 +1490,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in const char *szContId = ezxml_txt(ezxml_get(getSoapFault(xmlm, false), "detail", 0, "additionalDetails", 0, "conflictObjectId", -1));
if (search) {
if (retry) {
- MSN_ABAddDelContactGroup(szContId, NULL, "ABContactDelete");
+ MSN_ABAddDelContactGroup(szContId, nullptr, "ABContactDelete");
status = 0;
}
}
@@ -1501,9 +1501,9 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in }
else if (mir_strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse) {
MSN_GetPassportAuth();
- status = MSN_ABContactAdd(szEmail, szNick, netId, NULL, search, retry, false);
+ status = MSN_ABContactAdd(szEmail, szNick, netId, nullptr, search, retry, false);
}
- else status = MSN_ABContactAdd(szEmail, szNick, netId, NULL, search, false);
+ else status = MSN_ABContactAdd(szEmail, szNick, netId, nullptr, search, false);
}
ezxml_free(xmlm);
}
@@ -1578,20 +1578,20 @@ void CMsnProto::MSN_ABUpdateDynamicItem(bool allowRecurse) ezxml_free(xmlp);
unsigned status = 0;
- char *abUrl = NULL, *tResult = NULL;
+ char *abUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(abUrl);
abUrl = GetABHost("UpdateDynamicItem", false);
tResult = getSslResult(&abUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateABHost("UpdateDynamicItem", NULL);
+ if (tResult == nullptr) UpdateABHost("UpdateDynamicItem", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateABHost("UpdateDynamicItem", abUrl);
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateABCacheKey(xmlm, false);
diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp index 28b59d614f..813d47820b 100644 --- a/protocols/MSN/src/msn_soapstore.cpp +++ b/protocols/MSN/src/msn_soapstore.cpp @@ -113,7 +113,7 @@ bool CMsnProto::MSN_StoreCreateProfile(bool allowRecurse) ezxml_free(xmlp);
unsigned status = 0;
- char *storeUrl, *tResult = NULL;
+ char *storeUrl, *tResult = nullptr;
storeUrl = mir_strdup("https://storage.msn.com/storageservice/SchematizedStore.asmx");
tResult = getSslResult(&storeUrl, szData, reqHdr, status);
@@ -121,7 +121,7 @@ bool CMsnProto::MSN_StoreCreateProfile(bool allowRecurse) mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
if (status == 200) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
UpdateStoreCacheKey(xmlm);
@@ -172,7 +172,7 @@ bool CMsnProto::MSN_StoreShareItem(const char* id, bool allowRecurse) mir_free(reqHdr);
free(szData);
- if (tResult != NULL && status == 500) {
+ if (tResult != nullptr && status == 500) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
if (mir_strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse) {
@@ -236,14 +236,14 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse) ezxml_free(xmlp);
unsigned status = 0;
- char *storeUrl = NULL, *tResult = NULL;
+ char *storeUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(storeUrl);
storeUrl = GetStoreHost("GetProfile");
tResult = getSslResult(&storeUrl, szData, reqHdr, status);
- if (tResult == NULL)
- UpdateStoreHost("GetProfile", NULL);
+ if (tResult == nullptr)
+ UpdateStoreHost("GetProfile", nullptr);
else
break;
}
@@ -251,17 +251,17 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse) mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
if (status == 200) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
ezxml_t body = getSoapResponse(xmlm, "GetProfile");
- UpdateStoreHost("GetProfile", body ? storeUrl : NULL);
+ UpdateStoreHost("GetProfile", body ? storeUrl : nullptr);
strncpy_s(proresid, ezxml_txt(ezxml_child(body, "ResourceID")), _TRUNCATE);
ezxml_t expr = ezxml_child(body, "ExpressionProfile");
- if (expr == NULL) {
+ if (expr == nullptr) {
MSN_StoreShareItem(proresid);
MSN_SharingMyProfile();
if (allowRecurse) MSN_StoreGetProfile(false);
@@ -304,7 +304,7 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse) ezxml_free(xmlm);
}
else
- UpdateStoreHost("GetProfile", NULL);
+ UpdateStoreHost("GetProfile", nullptr);
}
mir_free(tResult);
@@ -342,20 +342,20 @@ bool CMsnProto::MSN_StoreUpdateProfile(const char* szNick, const char* szStatus, ezxml_free(xmlp);
unsigned status = 0;
- char *storeUrl = NULL, *tResult = NULL;
+ char *storeUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(storeUrl);
storeUrl = GetStoreHost("UpdateProfile");
tResult = getSslResult(&storeUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateStoreHost("UpdateProfile", NULL);
+ if (tResult == nullptr) UpdateStoreHost("UpdateProfile", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateStoreHost("UpdateProfile", storeUrl);
if (status == 200) {
replaceStr(msnLastStatusMsg, szStatus);
@@ -403,20 +403,20 @@ bool CMsnProto::MSN_StoreCreateRelationships(bool allowRecurse) ezxml_free(xmlp);
unsigned status = 0;
- char *storeUrl = NULL, *tResult = NULL;
+ char *storeUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(storeUrl);
storeUrl = GetStoreHost("CreateRelationships");
tResult = getSslResult(&storeUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateStoreHost("CreateRelationships", NULL);
+ if (tResult == nullptr) UpdateStoreHost("CreateRelationships", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateStoreHost("CreateRelationships", storeUrl);
if (status == 500) {
@@ -471,20 +471,20 @@ bool CMsnProto::MSN_StoreDeleteRelationships(bool tile, bool allowRecurse) ezxml_free(xmlp);
unsigned status = 0;
- char *storeUrl = NULL, *tResult = NULL;
+ char *storeUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(storeUrl);
storeUrl = GetStoreHost("DeleteRelationships");
tResult = getSslResult(&storeUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateStoreHost("DeleteRelationships", NULL);
+ if (tResult == nullptr) UpdateStoreHost("DeleteRelationships", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateStoreHost("DeleteRelationships", storeUrl);
if (status == 500) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
@@ -547,20 +547,20 @@ bool CMsnProto::MSN_StoreCreateDocument(const wchar_t *sztName, const char *szMi ezxml_free(xmlp);
unsigned status = 0;
- char *storeUrl = NULL, *tResult = NULL;
+ char *storeUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(storeUrl);
storeUrl = GetStoreHost("CreateDocument");
tResult = getSslResult(&storeUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateStoreHost("CreateDocument", NULL);
+ if (tResult == nullptr) UpdateStoreHost("CreateDocument", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateStoreHost("CreateDocument", storeUrl);
if (status == 200) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
@@ -618,20 +618,20 @@ bool CMsnProto::MSN_StoreUpdateDocument(const wchar_t *sztName, const char *szMi ezxml_free(xmlp);
unsigned status = 0;
- char *storeUrl = NULL, *tResult = NULL;
+ char *storeUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(storeUrl);
storeUrl = GetStoreHost("UpdateDocument");
tResult = getSslResult(&storeUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateStoreHost("UpdateDocument", NULL);
+ if (tResult == nullptr) UpdateStoreHost("UpdateDocument", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateStoreHost("UpdateDocument", storeUrl);
if (status == 500 && allowRecurse) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
@@ -698,20 +698,20 @@ bool CMsnProto::MSN_StoreFindDocuments(bool allowRecurse) ezxml_free(xmlp);
unsigned status = 0;
- char *storeUrl = NULL, *tResult = NULL;
+ char *storeUrl = nullptr, *tResult = nullptr;
for (int k = 4; --k;) {
mir_free(storeUrl);
storeUrl = GetStoreHost("FindDocuments");
tResult = getSslResult(&storeUrl, szData, reqHdr, status);
- if (tResult == NULL) UpdateStoreHost("FindDocuments", NULL);
+ if (tResult == nullptr) UpdateStoreHost("FindDocuments", nullptr);
else break;
}
mir_free(reqHdr);
free(szData);
- if (tResult != NULL) {
+ if (tResult != nullptr) {
UpdateStoreHost("FindDocuments", storeUrl);
if (status == 500) {
ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index db92c812bb..35401b533a 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.cpp @@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CMsnProto::MSN_AddGroup(const char* grpName, const char *grpId, bool init)
{
ServerGroupItem* p = m_arGroups.find((ServerGroupItem*)&grpId);
- if (p != NULL) return;
+ if (p != nullptr) return;
p = (ServerGroupItem*)mir_alloc(sizeof(ServerGroupItem));
p->id = mir_strdup(grpId);
@@ -63,12 +63,12 @@ void CMsnProto::MSN_DeleteServerGroup(LPCSTR szId) {
if (!MyOptions.ManageServer) return;
- MSN_ABAddDelContactGroup(NULL, szId, "ABGroupDelete");
+ MSN_ABAddDelContactGroup(nullptr, szId, "ABGroupDelete");
int count = -1;
for (;;) {
MsnContact *msc = Lists_GetNext(count);
- if (msc == NULL) break;
+ if (msc == nullptr) break;
char szGroupID[100];
if (!db_get_static(msc->hContact, m_szModuleName, "GroupID", szGroupID, sizeof(szGroupID))) {
@@ -99,7 +99,7 @@ void CMsnProto::MSN_FreeGroups(void) LPCSTR CMsnProto::MSN_GetGroupById(const char* pId)
{
ServerGroupItem* p = m_arGroups.find((ServerGroupItem*)&pId);
- return p ? p->name : NULL;
+ return p ? p->name : nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -113,7 +113,7 @@ LPCSTR CMsnProto::MSN_GetGroupByName(const char* pName) return p->id;
}
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -122,7 +122,7 @@ LPCSTR CMsnProto::MSN_GetGroupByName(const char* pName) void CMsnProto::MSN_SetGroupName(const char* pId, const char* pNewName)
{
ServerGroupItem* p = m_arGroups.find((ServerGroupItem*)&pId);
- if (p != NULL)
+ if (p != nullptr)
replaceStr(p->name, pNewName);
}
@@ -133,7 +133,7 @@ void CMsnProto::MSN_MoveContactToGroup(MCONTACT hContact, const char* grpName) {
if (!MyOptions.ManageServer) return;
- LPCSTR szId = NULL;
+ LPCSTR szId = nullptr;
char szContactID[100], szGroupID[100];
if (db_get_static(hContact, m_szModuleName, "ID", szContactID, sizeof(szContactID)))
return;
@@ -143,13 +143,13 @@ void CMsnProto::MSN_MoveContactToGroup(MCONTACT hContact, const char* grpName) bool bInsert = false, bDelete = szGroupID[0] != 0;
- if (grpName != NULL) {
+ if (grpName != nullptr) {
szId = MSN_GetGroupByName(grpName);
- if (szId == NULL) {
+ if (szId == nullptr) {
MSN_ABAddGroup(grpName);
szId = MSN_GetGroupByName(grpName);
}
- if (szId == NULL) return;
+ if (szId == nullptr) return;
if (_stricmp(szGroupID, szId) == 0) bDelete = false;
else bInsert = true;
}
@@ -180,7 +180,7 @@ void CMsnProto::MSN_RemoveEmptyGroups(void) int count = -1;
for (;;) {
MsnContact *msc = Lists_GetNext(count);
- if (msc == NULL) break;
+ if (msc == nullptr) break;
char szGroupID[100];
if (!db_get_static(msc->hContact, m_szModuleName, "GroupID", szGroupID, sizeof(szGroupID))) {
@@ -216,12 +216,12 @@ void CMsnProto::MSN_UploadServerGroups(char* group) int count = -1;
for (;;) {
MsnContact *msc = Lists_GetNext(count);
- if (msc == NULL) break;
+ if (msc == nullptr) break;
DBVARIANT dbv;
if (!db_get_utf(msc->hContact, "CList", "Group", &dbv)) {
char szGroupID[100];
- if (group == NULL || (mir_strcmp(group, dbv.pszVal) == 0 &&
+ if (group == nullptr || (mir_strcmp(group, dbv.pszVal) == 0 &&
db_get_static(msc->hContact, m_szModuleName, "GroupID", szGroupID, sizeof(szGroupID)) != 0)) {
MSN_MoveContactToGroup(msc->hContact, dbv.pszVal);
}
@@ -247,21 +247,21 @@ void CMsnProto::MSN_SyncContactToServerGroup(MCONTACT hContact, const char* szCo db_free(&dbv);
}
- const char* szGrpIdF = NULL;
- while (cgrp != NULL) {
+ const char* szGrpIdF = nullptr;
+ while (cgrp != nullptr) {
const char* szGrpId = ezxml_txt(cgrp);
cgrp = ezxml_next(cgrp);
const char* szGrpNameById = MSN_GetGroupById(szGrpId);
if (szGrpNameById && (mir_strcmp(szGrpNameById, szGrpName) == 0 ||
- (cgrp == NULL && szGrpIdF == NULL)))
+ (cgrp == nullptr && szGrpIdF == nullptr)))
szGrpIdF = szGrpId;
else
MSN_ABAddDelContactGroup(szContId, szGrpId, "ABGroupContactDelete");
}
- if (szGrpIdF != NULL) {
+ if (szGrpIdF != nullptr) {
setString(hContact, "GroupID", szGrpIdF);
const char* szGrpNameById = MSN_GetGroupById(szGrpIdF);
if (mir_strcmp(szGrpNameById, szGrpName))
@@ -301,7 +301,7 @@ void CMsnProto::msn_storeAvatarThread(void* arg) if (photoid[0] && dat)
MSN_StoreUpdateDocument(dat->szName, dat->szMimeType, szEncBuf);
else {
- MSN_StoreUpdateProfile(NULL, NULL, 1);
+ MSN_StoreUpdateProfile(nullptr, nullptr, 1);
if (photoid[0]) {
MSN_StoreDeleteRelationships(true);
@@ -314,7 +314,7 @@ void CMsnProto::msn_storeAvatarThread(void* arg) MSN_StoreCreateRelationships();
}
- MSN_StoreUpdateProfile(NULL, NULL, 0);
+ MSN_StoreUpdateProfile(nullptr, nullptr, 0);
}
MSN_ABUpdateDynamicItem();
@@ -332,15 +332,15 @@ void CMsnProto::msn_storeAvatarThread(void* arg) void CMsnProto::msn_storeProfileThread(void* param)
{
DBVARIANT dbv;
- char *szNick = NULL;
+ char *szNick = nullptr;
bool needFree = false;
if (!getStringUtf("Nick", &dbv)) {
- szNick = dbv.pszVal[0] ? dbv.pszVal : NULL;
+ szNick = dbv.pszVal[0] ? dbv.pszVal : nullptr;
needFree = true;
}
char** msgptr = GetStatusMsgLoc(m_iStatus);
- char *szStatus = msgptr ? *msgptr : NULL;
+ char *szStatus = msgptr ? *msgptr : nullptr;
if (param || (msnLastStatusMsg != szStatus && (msnLastStatusMsg && szStatus && mir_strcmp(msnLastStatusMsg, szStatus))))
if (MSN_StoreUpdateProfile(szNick, szStatus, false))
diff --git a/protocols/MSN/src/msn_ssl.cpp b/protocols/MSN/src/msn_ssl.cpp index 7e8541ab7c..d1c72c8a46 100644 --- a/protocols/MSN/src/msn_ssl.cpp +++ b/protocols/MSN/src/msn_ssl.cpp @@ -27,7 +27,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char {
mHttpsTS = clock();
- char* result = NULL;
+ char* result = nullptr;
NETLIBHTTPREQUEST nlhr = { 0 };
// initialize the netlib request
@@ -59,7 +59,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char char* hdrprs = NEWSTR_ALLOCA(hdrs);
for (;;) {
char* fnd = strchr(hdrprs, ':');
- if (fnd == NULL) break;
+ if (fnd == nullptr) break;
*fnd = 0;
fnd += 2;
@@ -67,7 +67,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char nlhr.headers[nlhr.headersCount].szValue = fnd;
fnd = strchr(fnd, '\r');
- if (fnd == NULL) break;
+ if (fnd == nullptr) break;
*fnd = 0;
hdrprs = fnd + 2;
++nlhr.headersCount;
@@ -85,18 +85,18 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char if (nlhrReply->szUrl) {
mir_free(*parUrl);
*parUrl = nlhrReply->szUrl;
- nlhrReply->szUrl = NULL;
+ nlhrReply->szUrl = nullptr;
}
result = nlhrReply->pData;
nlhrReply->dataLength = 0;
- nlhrReply->pData = NULL;
+ nlhrReply->pData = nullptr;
Netlib_FreeHttpRequest(nlhrReply);
}
else
- hHttpsConnection = NULL;
+ hHttpsConnection = nullptr;
mHttpsTS = clock();
diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp index 388050a1ab..c7e417319f 100644 --- a/protocols/MSN/src/msn_std.cpp +++ b/protocols/MSN/src/msn_std.cpp @@ -49,7 +49,7 @@ wchar_t* CMsnProto::GetContactNameT(MCONTACT hContact) return (wchar_t*)pcli->pfnGetContactDisplayName(hContact, 0);
wchar_t *str = Contact_GetInfo(CNF_DISPLAY, NULL, m_szModuleName);
- if (str != NULL) {
+ if (str != nullptr) {
mir_free(m_DisplayNameCache);
return m_DisplayNameCache = str;
}
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index aa745fa24a..3a27b3c2a9 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -31,7 +31,7 @@ extern int avsPresent; INT_PTR CMsnProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam)
{
char** msgptr = GetStatusMsgLoc(wParam ? wParam : m_iStatus);
- if (msgptr == NULL) return 0;
+ if (msgptr == nullptr) return 0;
return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_utf8decodeW(*msgptr) : (INT_PTR)mir_utf8decodeA(*msgptr);
}
@@ -44,10 +44,10 @@ INT_PTR CMsnProto::GetAvatar(WPARAM wParam, LPARAM lParam) wchar_t* buf = (wchar_t*)wParam;
int size = (int)lParam;
- if (buf == NULL || size <= 0)
+ if (buf == nullptr || size <= 0)
return -1;
- MSN_GetAvatarFileName(NULL, buf, size, NULL);
+ MSN_GetAvatarFileName(NULL, buf, size, nullptr);
return _waccess(buf, 0);
}
@@ -65,11 +65,11 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
wchar_t filename[MAX_PATH];
- MsnContact *cont = NULL;
+ MsnContact *cont = nullptr;
if (pai->hContact) {
cont = Lists_Get(pai->hContact);
- if (cont == NULL) return GAIR_NOAVATAR;
+ if (cont == nullptr) return GAIR_NOAVATAR;
/*
if ((cont->cap1 & 0xf0000000) == 0)
@@ -78,7 +78,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) }
if (pai->hContact == NULL || _stricmp(cont->email, MyOptions.szEmail) == 0) {
- MSN_GetAvatarFileName(NULL, filename, _countof(filename), NULL);
+ MSN_GetAvatarFileName(NULL, filename, _countof(filename), nullptr);
pai->format = ProtoGetAvatarFormat(filename);
if (pai->format != PA_FORMAT_UNKNOWN)
mir_wstrcpy(pai->filename, filename);
@@ -93,7 +93,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) }
else return GAIR_NOAVATAR;
- MSN_GetAvatarFileName(pai->hContact, filename, _countof(filename), NULL);
+ MSN_GetAvatarFileName(pai->hContact, filename, _countof(filename), nullptr);
pai->format = ProtoGetAvatarFormat(filename);
if (pai->format != PA_FORMAT_UNKNOWN) {
@@ -108,7 +108,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) // Store also avatar hash
char* szAvatarHash = MSN_GetAvatarHash(szContext);
- if (szAvatarHash != NULL) {
+ if (szAvatarHash != nullptr) {
setString(pai->hContact, "AvatarSavedHash", szAvatarHash);
mir_free(szAvatarHash);
}
@@ -175,13 +175,13 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam) wchar_t* szFileName = (wchar_t*)lParam;
wchar_t tFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, tFileName, _countof(tFileName), NULL);
+ MSN_GetAvatarFileName(NULL, tFileName, _countof(tFileName), nullptr);
_wremove(tFileName);
- if (szFileName == NULL) {
+ if (szFileName == nullptr) {
delSetting("PictObject");
delSetting("AvatarHash");
- ForkThread(&CMsnProto::msn_storeAvatarThread, NULL);
+ ForkThread(&CMsnProto::msn_storeAvatarThread, nullptr);
}
else {
int fileId = _wopen(szFileName, _O_RDONLY | _O_BINARY, _S_IREAD);
@@ -189,7 +189,7 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam) size_t dwPngSize = _filelengthi64(fileId);
unsigned char* pData = (unsigned char*)mir_alloc(dwPngSize);
- if (pData == NULL) {
+ if (pData == nullptr) {
_close(fileId);
return 2;
}
@@ -267,7 +267,7 @@ int CMsnProto::OnContactDeleted(WPARAM hContact, LPARAM) if (Lists_IsInList(LIST_FL, szEmail)) {
DeleteParam param = { this, MCONTACT(hContact) };
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), NULL, DlgDeleteContactUI, (LPARAM)¶m);
+ DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), nullptr, DlgDeleteContactUI, (LPARAM)¶m);
MsnContact *msc = Lists_Get(szEmail);
if (msc)
@@ -290,14 +290,14 @@ int CMsnProto::OnGroupChange(WPARAM hContact, LPARAM lParam) const CLISTGROUPCHANGE* grpchg = (CLISTGROUPCHANGE*)lParam;
if (hContact == NULL) {
- if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL) {
+ if (grpchg->pszNewName == nullptr && grpchg->pszOldName != nullptr) {
LPCSTR szId = MSN_GetGroupByName(UTF8(grpchg->pszOldName));
- if (szId != NULL)
+ if (szId != nullptr)
MSN_DeleteServerGroup(szId);
}
- else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL) {
+ else if (grpchg->pszNewName != nullptr && grpchg->pszOldName != nullptr) {
LPCSTR szId = MSN_GetGroupByName(UTF8(grpchg->pszOldName));
- if (szId != NULL)
+ if (szId != nullptr)
MSN_RenameServerGroup(szId, UTF8(grpchg->pszNewName));
}
}
@@ -323,7 +323,7 @@ int CMsnProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) if (MyOptions.SlowSend && strcmp(cws->szSetting, "MessageTimeout") == 0 &&
(strcmp(cws->szModule, "SRMM") == 0 || strcmp(cws->szModule, "SRMsg") == 0)) {
if (cws->value.dVal < 60000)
- MessageBox(NULL, TranslateT("MSN requires message send timeout in your Message window plugin to be not less then 60 sec. Please correct the timeout value."),
+ MessageBox(nullptr, TranslateT("MSN requires message send timeout in your Message window plugin to be not less then 60 sec. Please correct the timeout value."),
TranslateT("MSN Protocol"), MB_OK | MB_ICONINFORMATION);
}
return 0;
@@ -357,7 +357,7 @@ int CMsnProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) else
MSN_ABUpdateNick(UTF8(cws->value.pszVal), szContactID);
}
- else MSN_ABUpdateNick(NULL, szContactID);
+ else MSN_ABUpdateNick(nullptr, szContactID);
}
if (isMe)
@@ -406,7 +406,7 @@ int CMsnProto::OnWindowPopup(WPARAM, LPARAM lParam) case MSG_WINDOWPOPUP_SELECTED:
if (mwpd->selection == 13465)
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat, LPARAM(new InviteChatParam(NULL, mwpd->hContact, this)));
+ DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat, LPARAM(new InviteChatParam(nullptr, mwpd->hContact, this)));
break;
}
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index 27a6a4d64a..213e03b1a4 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -30,14 +30,14 @@ void __cdecl CMsnProto::msn_keepAliveThread(void*) {
bool keepFlag = true;
- hKeepAliveThreadEvt = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hKeepAliveThreadEvt = CreateEvent(nullptr, FALSE, FALSE, nullptr);
msnPingTimeout = 45;
while (keepFlag) {
switch (WaitForSingleObject(hKeepAliveThreadEvt, msnPingTimeout * 1000)) {
case WAIT_TIMEOUT:
- keepFlag = msnNsThread != NULL;
+ keepFlag = msnNsThread != nullptr;
if (usingGateway)
msnPingTimeout = 45;
else {
@@ -55,13 +55,13 @@ void __cdecl CMsnProto::msn_keepAliveThread(void*) if (hHttpsConnection && (clock() - mHttpsTS) > 60 * CLOCKS_PER_SEC) {
HNETLIBCONN hConn = hHttpsConnection;
- hHttpsConnection = NULL;
+ hHttpsConnection = nullptr;
Netlib_Shutdown(hConn);
}
if (mStatusMsgTS && (clock() - mStatusMsgTS) > 60 * CLOCKS_PER_SEC) {
mStatusMsgTS = 0;
- ForkThread(&CMsnProto::msn_storeProfileThread, NULL);
+ ForkThread(&CMsnProto::msn_storeProfileThread, nullptr);
}
if (keepFlag && MyOptions.netId != NETID_SKYPE && MSN_RefreshOAuthTokens(true))
ForkThread(&CMsnProto::msn_refreshOAuthThread, msnNsThread);
@@ -77,7 +77,7 @@ void __cdecl CMsnProto::msn_keepAliveThread(void*) }
}
- CloseHandle(hKeepAliveThreadEvt); hKeepAliveThreadEvt = NULL;
+ CloseHandle(hKeepAliveThreadEvt); hKeepAliveThreadEvt = nullptr;
debugLogA("Closing keep-alive thread");
}
@@ -100,7 +100,7 @@ void __cdecl CMsnProto::msn_refreshOAuthThread(void *param) static bool ReallocInfoBuffer(ThreadData *info, size_t mDataSize)
{
char *mData = (char*)mir_realloc(info->mData, mDataSize + 1);
- if (mData == NULL)
+ if (mData == nullptr)
return false;
info->mData = mData;
@@ -118,7 +118,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) int tPortNumber = -1;
{
char* tPortDelim = strrchr(info->mServer, ':');
- if (tPortDelim != NULL) {
+ if (tPortDelim != nullptr) {
*tPortDelim = '\0';
if ((tPortNumber = atoi(tPortDelim + 1)) == 0)
tPortNumber = -1;
@@ -166,7 +166,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) debugLogA("Thread started: server='%s:%d', type=%d", tConn.szHost, tConn.wPort, info->mType);
info->s = Netlib_OpenConnection(m_hNetlibUser, &tConn);
- if (info->s == NULL) {
+ if (info->s == nullptr) {
debugLogA("Connection Failed (%d) server='%s:%d'", WSAGetLastError(), tConn.szHost, tConn.wPort);
switch (info->mType) {
@@ -207,7 +207,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) for (;;) {
char* peol = strchr(info->mData, '\r');
- if (peol == NULL)
+ if (peol == nullptr)
break;
int msgLen = (int)(peol - info->mData);
@@ -270,18 +270,18 @@ LBL_Exit: SetEvent(hKeepAliveThreadEvt);
}
- if (info->s == NULL)
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
+ if (info->s == nullptr)
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NONETWORK);
else
MSN_CloseConnections();
if (hHttpsConnection) {
Netlib_CloseHandle(hHttpsConnection);
- hHttpsConnection = NULL;
+ hHttpsConnection = nullptr;
}
MSN_GoOffline();
- msnNsThread = NULL;
+ msnNsThread = nullptr;
}
}
@@ -299,7 +299,7 @@ void CMsnProto::MSN_CloseConnections(void) switch (T.mType) {
case SERVER_NOTIFICATION:
- if (T.s != NULL && !T.sessionClosed && !T.termPending) {
+ if (T.s != nullptr && !T.sessionClosed && !T.termPending) {
nls.hReadConns[0] = T.s;
int res = Netlib_SelectEx(&nls);
if (res >= 0 || nls.hReadStatus[0] == 0)
@@ -324,7 +324,7 @@ void CMsnProto::Threads_Uninit(void) GCThreadData* CMsnProto::MSN_GetThreadByChatId(const wchar_t* chatId)
{
if (mir_wstrlen(chatId) == 0)
- return NULL;
+ return nullptr;
mir_cslock lck(m_csThreads);
for (int i = 0; i < m_arGCThreads.getCount(); i++) {
@@ -333,7 +333,7 @@ GCThreadData* CMsnProto::MSN_GetThreadByChatId(const wchar_t* chatId) return T;
}
- return NULL;
+ return nullptr;
}
ThreadData* CMsnProto::MSN_GetThreadByConnection(HANDLE s)
@@ -346,7 +346,7 @@ ThreadData* CMsnProto::MSN_GetThreadByConnection(HANDLE s) return &T;
}
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -357,36 +357,36 @@ ThreadData::ThreadData() memset(&mInitialContactWLID, 0, sizeof(ThreadData) - 2 * sizeof(STRLIST));
mGatewayTimeout = 2;
resetTimeout();
- hWaitEvent = CreateSemaphore(NULL, 0, MSN_PACKETS_COMBINE, NULL);
+ hWaitEvent = CreateSemaphore(nullptr, 0, MSN_PACKETS_COMBINE, nullptr);
mData = (char*)mir_calloc((mDataSize = 8192) + 1);
}
ThreadData::~ThreadData()
{
- if (s != NULL) {
+ if (s != nullptr) {
proto->debugLogA("Closing connection handle %08X", s);
Netlib_CloseHandle(s);
}
- if (mIncomingBoundPort != NULL) {
+ if (mIncomingBoundPort != nullptr) {
Netlib_CloseHandle(mIncomingBoundPort);
}
- if (mMsnFtp != NULL) {
+ if (mMsnFtp != nullptr) {
delete mMsnFtp;
- mMsnFtp = NULL;
+ mMsnFtp = nullptr;
}
if (hWaitEvent != INVALID_HANDLE_VALUE)
CloseHandle(hWaitEvent);
if (mTimerId != 0)
- KillTimer(NULL, mTimerId);
+ KillTimer(nullptr, mTimerId);
mJoinedContactsWLID.destroy();
mJoinedIdentContactsWLID.destroy();
- mir_free(mInitialContactWLID); mInitialContactWLID = NULL;
+ mir_free(mInitialContactWLID); mInitialContactWLID = nullptr;
mir_free(mData);
}
@@ -399,7 +399,7 @@ void ThreadData::applyGatewayData(HNETLIBCONN hConn, bool isPoll) NETLIBHTTPPROXYINFO nlhpi = {};
nlhpi.flags = NLHPIF_HTTP11;
- nlhpi.szHttpGetUrl = NULL;
+ nlhpi.szHttpGetUrl = nullptr;
nlhpi.szHttpPostUrl = szHttpPostUrl;
nlhpi.combinePackets = 5;
Netlib_SetHttpProxyInfo(hConn, &nlhpi);
@@ -423,7 +423,7 @@ void ThreadData::processSessionData(const char* xMsgr, const char* xHost) char tSessionID[40], tGateIP[80];
char* tDelim = (char*)strchr(xMsgr, ';');
- if (tDelim == NULL)
+ if (tDelim == nullptr)
return;
*tDelim = 0; tDelim += 2;
@@ -432,7 +432,7 @@ void ThreadData::processSessionData(const char* xMsgr, const char* xHost) return;
char* tDelim2 = strchr(tDelim, ';');
- if (tDelim2 != NULL)
+ if (tDelim2 != nullptr)
*tDelim2 = '\0';
if (xHost)
mir_strcpy(tGateIP, xHost);
@@ -512,7 +512,7 @@ BYTE* HReadBuffer::surelyRead(size_t parBytes) while (parBytes > mDataSize) mDataSize *= 2;
if (!ReallocInfoBuffer(owner, mDataSize)) {
owner->proto->debugLogA("HReadBuffer::surelyRead: not enough memory, %d %d %d", parBytes, owner->mDataSize, startOffset);
- return NULL;
+ return nullptr;
}
buffer = (BYTE*)owner->mData;
}
@@ -522,7 +522,7 @@ BYTE* HReadBuffer::surelyRead(size_t parBytes) int recvResult = owner->recv((char*)buffer + totalDataSize, owner->mDataSize - totalDataSize);
if (recvResult <= 0)
- return NULL;
+ return nullptr;
totalDataSize += recvResult;
}
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp index cbaf735acf..044261e740 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(0)); + gce.time = DWORD(time(nullptr)); 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(0)); + gce.time = DWORD(time(nullptr)); 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(NULL); + gce.time = ::time(nullptr); gce.ptszText = ttopic; Chat_Event( &gce); diff --git a/protocols/MinecraftDynmap/src/communication.cpp b/protocols/MinecraftDynmap/src/communication.cpp index 9962317773..620b3f17a1 100644 --- a/protocols/MinecraftDynmap/src/communication.cpp +++ b/protocols/MinecraftDynmap/src/communication.cpp @@ -38,7 +38,7 @@ http::response MinecraftDynmapProto::sendRequest(const int request_type, std::st nlhr.timeout = 1000 * ((request_type == MINECRAFTDYNMAP_REQUEST_EVENTS) ? 65 : 20); // Set request type (GET/POST) and eventually also POST data - if (post_data != NULL) { + if (post_data != nullptr) { nlhr.requestType = REQUEST_POST; nlhr.pData = (char*)(*post_data).c_str(); nlhr.dataLength = (int)post_data->length(); @@ -63,7 +63,7 @@ http::response MinecraftDynmapProto::sendRequest(const int request_type, std::st switch (request_type) { case MINECRAFTDYNMAP_REQUEST_HOME: - nlhr.nlc = NULL; + nlhr.nlc = nullptr; break; case MINECRAFTDYNMAP_REQUEST_EVENTS: @@ -92,17 +92,17 @@ http::response MinecraftDynmapProto::sendRequest(const int request_type, std::st break; case MINECRAFTDYNMAP_REQUEST_EVENTS: - hEventsConnection = pnlhr ? pnlhr->nlc : NULL; + hEventsConnection = pnlhr ? pnlhr->nlc : nullptr; break; default: ReleaseMutex(connection_lock_); - hConnection = pnlhr ? pnlhr->nlc : NULL; + hConnection = pnlhr ? pnlhr->nlc : nullptr; break; } // Check and copy response data - if (pnlhr != NULL) + if (pnlhr != nullptr) { debugLogA("@@@@@ Got response with code %d", pnlhr->resultCode); store_headers(&resp, pnlhr->headers, pnlhr->headersCount); @@ -318,7 +318,7 @@ bool MinecraftDynmapProto::doSendMessage(const std::string &message_text) return handleSuccess(__FUNCTION__); } else if (error == "not-allowed") { - UpdateChat(NULL, Translate("Message was not sent. Probably you are sending them too fast or chat is disabled completely.")); + UpdateChat(nullptr, Translate("Message was not sent. Probably you are sending them too fast or chat is disabled completely.")); } } } @@ -355,7 +355,7 @@ void MinecraftDynmapProto::SignOnWorker(void*) // Load server from database ptrA str(db_get_sa(NULL, m_szModuleName, MINECRAFTDYNMAP_KEY_SERVER)); if (!str || !str[0]) { - MessageBox(NULL, TranslateT("Set server address to connect."), m_tszUserName, MB_OK); + MessageBox(nullptr, TranslateT("Set server address to connect."), m_tszUserName, MB_OK); SetStatus(ID_STATUS_OFFLINE); return; } @@ -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(NULL)); + setDword("LogonTS", (DWORD)time(nullptr)); ClearChat(); OnJoinChat(0, false); @@ -414,18 +414,18 @@ void MinecraftDynmapProto::SignOffWorker(void*) if (hConnection) Netlib_CloseHandle(hConnection); - hConnection = NULL; + hConnection = nullptr; if (hEventsConnection) Netlib_CloseHandle(hEventsConnection); - hEventsConnection = NULL; + hEventsConnection = nullptr; } void MinecraftDynmapProto::EventsLoop(void *) { ScopedLock s(events_loop_lock_); - time_t tim = ::time(NULL); + time_t tim = ::time(nullptr); debugLogA(">>>>> Entering %s[%d]", __FUNCTION__, tim); while (doEvents()) @@ -446,7 +446,7 @@ void MinecraftDynmapProto::EventsLoop(void *) void MinecraftDynmapProto::SendMsgWorker(void *p) { - if (p == NULL) + if (p == nullptr) return; ScopedLock s(send_message_lock_); diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp index 48c8c19eeb..69bad0db70 100644 --- a/protocols/MinecraftDynmap/src/dialogs.cpp +++ b/protocols/MinecraftDynmap/src/dialogs.cpp @@ -42,7 +42,7 @@ HANDLE GetIconHandle(const char* name) { return hIconLibItem[i]; } } - return 0; + return nullptr; } diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index 83a05652d2..3aaa6ab022 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -23,14 +23,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const wchar_t* username) : - PROTO<MinecraftDynmapProto>(proto_name, username), m_interval(0), hConnection(0), hEventsConnection(0), + PROTO<MinecraftDynmapProto>(proto_name, username), m_interval(0), hConnection(nullptr), hEventsConnection(nullptr), m_updateRate(5000), m_nick("") { - this->signon_lock_ = CreateMutex(NULL, FALSE, NULL); - this->send_message_lock_ = CreateMutex(NULL, FALSE, NULL); - this->connection_lock_ = CreateMutex(NULL, FALSE, NULL); - this->events_loop_lock_ = CreateMutex(NULL, FALSE, NULL); - this->events_loop_event_ = CreateEvent(NULL, FALSE, FALSE, NULL); + this->signon_lock_ = CreateMutex(nullptr, FALSE, nullptr); + this->send_message_lock_ = CreateMutex(nullptr, FALSE, nullptr); + this->connection_lock_ = CreateMutex(nullptr, FALSE, nullptr); + this->events_loop_lock_ = CreateMutex(nullptr, FALSE, nullptr); + this->events_loop_event_ = CreateEvent(nullptr, FALSE, FALSE, nullptr); // Group chats CreateProtoService(PS_JOINCHAT, &MinecraftDynmapProto::OnJoinChat); @@ -50,15 +50,15 @@ MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const wchar_t nlu.szSettingsModule = m_szModuleName; nlu.szDescriptiveName.w = descr; m_hNetlibUser = Netlib_RegisterUser(&nlu); - if (m_hNetlibUser == NULL) { + if (m_hNetlibUser == nullptr) { wchar_t error[200]; mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); - MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); + MessageBox(nullptr, error, L"Miranda NG", MB_OK | MB_ICONERROR); } // Client instantiation this->error_count_ = 0; - this->chatHandle_ = NULL; + this->chatHandle_ = nullptr; } MinecraftDynmapProto::~MinecraftDynmapProto() diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 2914daeb59..6281d90e11 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -28,10 +28,10 @@ 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(NULL);
+ gce.time = ::time(nullptr);
gce.ptszText = smessage.c_str();
- if (name == NULL) {
+ if (name == nullptr) {
gce.iType = GC_EVENT_INFORMATION;
name = TranslateT("Server");
gce.bIsMe = false;
@@ -85,12 +85,12 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) facy.spy_mode_ = false;
facy.question_.clear();
- ForkThread(&OmegleProto::NewChatWorker, NULL);
+ ForkThread(&OmegleProto::NewChatWorker, nullptr);
break;
}
else if (!mir_strcmpi(command.c_str(), "quit"))
{
- ForkThread(&OmegleProto::StopChatWorker, NULL);
+ ForkThread(&OmegleProto::StopChatWorker, nullptr);
break;
}
else if (!mir_strcmpi(command.c_str(), "spy"))
@@ -98,7 +98,7 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) facy.spy_mode_ = true;
facy.question_.clear();
- ForkThread(&OmegleProto::NewChatWorker, NULL);
+ ForkThread(&OmegleProto::NewChatWorker, nullptr);
break;
}
else if (!mir_strcmpi(command.c_str(), "ask"))
@@ -112,7 +112,7 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) }
if (params.empty()) {
- UpdateChat(NULL, TranslateT("Last question is empty."), false);
+ UpdateChat(nullptr, TranslateT("Last question is empty."), false);
break;
}
}
@@ -126,13 +126,13 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) if (params.length() < OMEGLE_QUESTION_MIN_LENGTH)
{
- UpdateChat(NULL, TranslateT("Your question is too short."), false);
+ UpdateChat(nullptr, TranslateT("Your question is too short."), false);
break;
}
facy.spy_mode_ = true;
facy.question_ = params;
- ForkThread(&OmegleProto::NewChatWorker, NULL);
+ ForkThread(&OmegleProto::NewChatWorker, nullptr);
break;
}
else if (!mir_strcmpi(command.c_str(), "asl"))
@@ -145,13 +145,13 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) SendChatMessage(text);
}
else {
- UpdateChat(NULL, TranslateT("Your '/asl' setting is empty."), false);
+ UpdateChat(nullptr, TranslateT("Your '/asl' setting is empty."), false);
break;
}
}
else if (!mir_strcmpi(command.c_str(), "help"))
{
- UpdateChat(NULL, TranslateT("There are three different modes of chatting:\
+ UpdateChat(nullptr, TranslateT("There are three different modes of chatting:\
\n1) Standard mode\t - You chat with random stranger privately\
\n2) Question mode\t - You ask two strangers a question and see how they discuss it (you can't join their conversation, only watch)\
\n3) Spy mode\t - You and stranger got a question to discuss from third stranger (he can't join your conversation, only watch)\
@@ -159,7 +159,7 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) }
else if (!mir_strcmpi(command.c_str(), "commands"))
{
- UpdateChat(NULL, TranslateT("You can use different commands:\
+ UpdateChat(nullptr, TranslateT("You can use different commands:\
\n/help\t - show info about chat modes\
\n/new\t - start standard mode\
\n/ask <question> - start question mode with your question\
@@ -172,7 +172,7 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) }
else
{
- UpdateChat(NULL, TranslateT("Unknown command. Send '/commands' for list."), false);
+ UpdateChat(nullptr, TranslateT("Unknown command. Send '/commands' for list."), false);
break;
}
@@ -187,8 +187,8 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) case GC_USER_LEAVE:
case GC_SESSION_TERMINATE:
- facy.nick_ = NULL;
- ForkThread(&OmegleProto::StopChatWorker, NULL);
+ facy.nick_ = nullptr;
+ ForkThread(&OmegleProto::StopChatWorker, nullptr);
break;
}
@@ -204,11 +204,11 @@ void OmegleProto::SendChatMessage(std::string text) break;
case STATE_INACTIVE:
- UpdateChat(NULL, TranslateT("You aren't connected to any stranger. Send '/help' or '/commands' for help."), false);
+ UpdateChat(nullptr, TranslateT("You aren't connected to any stranger. Send '/help' or '/commands' for help."), false);
break;
case STATE_SPY:
- UpdateChat(NULL, TranslateT("You can't send messages in question mode."), false);
+ UpdateChat(nullptr, TranslateT("You can't send messages in question mode."), false);
break;
//case STATE_WAITING:
@@ -227,12 +227,12 @@ 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(0));
+ gce.time = DWORD(time(nullptr));
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
- if (name == NULL)
+ if (name == nullptr)
gce.bIsMe = false;
else
gce.bIsMe = mir_wstrcmp(name, this->facy.nick_);
@@ -251,8 +251,8 @@ void OmegleProto::DeleteChatContact(const wchar_t *name) gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
- gce.time = DWORD(time(0));
- if (name == NULL)
+ gce.time = DWORD(time(nullptr));
+ if (name == nullptr)
gce.bIsMe = false;
else
gce.bIsMe = mir_wstrcmp(name, this->facy.nick_);
@@ -284,9 +284,9 @@ 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(NULL);
+ gce.time = ::time(nullptr);
- if (topic == NULL)
+ if (topic == nullptr)
gce.ptszText = TranslateT("Omegle is a great way of meeting new friends!");
else
gce.ptszText = topic;
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index 8e8f69e2cf..42664f2a97 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -36,7 +36,7 @@ http::response Omegle_client::flap(const int request_type, std::string *post_dat nlhr.timeout = 1000 * ((request_type == OMEGLE_REQUEST_EVENTS) ? 65 : 20); // Set request type (GET/POST) and eventually also POST data - if (post_data != NULL) { + if (post_data != nullptr) { nlhr.requestType = REQUEST_POST; nlhr.pData = (char*)(*post_data).c_str(); nlhr.dataLength = (int)post_data->length(); @@ -61,7 +61,7 @@ http::response Omegle_client::flap(const int request_type, std::string *post_dat switch (request_type) { case OMEGLE_REQUEST_HOME: - nlhr.nlc = NULL; + nlhr.nlc = nullptr; break; case OMEGLE_REQUEST_EVENTS: @@ -90,17 +90,17 @@ http::response Omegle_client::flap(const int request_type, std::string *post_dat break; case OMEGLE_REQUEST_EVENTS: - hEventsConnection = pnlhr ? pnlhr->nlc : NULL; + hEventsConnection = pnlhr ? pnlhr->nlc : nullptr; break; default: ReleaseMutex(connection_lock_); - hConnection = pnlhr ? pnlhr->nlc : NULL; + hConnection = pnlhr ? pnlhr->nlc : nullptr; break; } // Check and copy response data - if (pnlhr != NULL) + if (pnlhr != nullptr) { parent->debugLogA("@@@@@ Got response with code %d", pnlhr->resultCode); store_headers(&resp, pnlhr->headers, pnlhr->headersCount); @@ -154,7 +154,7 @@ bool Omegle_client::handle_error(const std::string &method, bool force_disconnec if (result == false) { reset_error(); - parent->UpdateChat(NULL, TranslateT("Connection error.")); + parent->UpdateChat(nullptr, TranslateT("Connection error.")); parent->StopChat(false); } @@ -172,7 +172,7 @@ std::string Omegle_client::get_server(bool not_last) server = 0; if (server == 0) { - srand(::time(NULL)); + srand(::time(nullptr)); server = (rand() % (_countof(servers) - 1 - q)) + 1; } @@ -218,7 +218,7 @@ std::string Omegle_client::choose_action(int request_type, std::string* get_data { std::string action = "/start?rcs=1&spid=&lang="; action += get_language(); - if (get_data != NULL) + if (get_data != nullptr) action += (*get_data); return action; @@ -371,7 +371,7 @@ bool Omegle_client::start() mir_snprintf(str, Translate("Connected to server %s. There are %s users online now."), server_.c_str(), count.c_str()); wchar_t *msg = mir_a2u(str); - parent->UpdateChat(NULL, msg); + parent->UpdateChat(nullptr, msg); mir_free(msg); } } @@ -380,12 +380,12 @@ bool Omegle_client::start() mir_snprintf(str, Translate("Connected to server %s."), server_.c_str()); wchar_t *msg = mir_a2u(str); - parent->UpdateChat(NULL, msg); + parent->UpdateChat(nullptr, msg); mir_free(msg); } // Send validation - http::response resp = flap(OMEGLE_REQUEST_START, NULL, &data); + http::response resp = flap(OMEGLE_REQUEST_START, nullptr, &data); switch (resp.code) { @@ -429,11 +429,11 @@ bool Omegle_client::stop() if (hConnection) Netlib_CloseHandle(hConnection); - hConnection = NULL; + hConnection = nullptr; if (hEventsConnection) Netlib_CloseHandle(hEventsConnection); - hEventsConnection = NULL; + hEventsConnection = nullptr; if (resp.data == "win") { return HANDLE_SUCCESS; @@ -477,7 +477,7 @@ bool Omegle_client::events() } JSONROOT root(resp.data.c_str()); - if (root == NULL) + if (root == nullptr) return HANDLE_ERROR(false); bool newStranger = false; @@ -485,7 +485,7 @@ bool Omegle_client::events() for (size_t i = 0; i < json_size(root); i++) { JSONNode *item = json_at(root, i); - if (item == NULL) + if (item == nullptr) continue; std::string name = _T2A(json_as_string(json_at(item, 0))); @@ -514,11 +514,11 @@ bool Omegle_client::events() wchar_t strT[255]; mir_snwprintf(strT, TranslateT("On whole Omegle are %s strangers online now."), count); - parent->UpdateChat(NULL, strT); + parent->UpdateChat(nullptr, strT); } else if (name == "serverMessage") { ptrW message(json_as_string(json_at(item, 1))); - parent->UpdateChat(NULL, TranslateW(message)); + parent->UpdateChat(nullptr, TranslateW(message)); } else if (name == "connected") { // Stranger connected @@ -613,7 +613,7 @@ bool Omegle_client::events() wchar_t strT[255]; mir_snwprintf(strT, TranslateT("%s disconnected."), TranslateW(stranger)); - parent->UpdateChat(NULL, strT); + parent->UpdateChat(nullptr, strT); // Stranger disconnected if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0)) @@ -626,7 +626,7 @@ bool Omegle_client::events() } else if (name == "recaptchaRequired") { // Nothing to do with recaptcha - parent->UpdateChat(NULL, TranslateT("Recaptcha is required.\nOpen http://omegle.com , solve Recaptcha and try again.")); + parent->UpdateChat(nullptr, TranslateT("Recaptcha is required.\nOpen http://omegle.com , solve Recaptcha and try again.")); parent->StopChat(false); } else if (name == "recaptchaRejected") { @@ -638,7 +638,7 @@ bool Omegle_client::events() wchar_t strT[255]; mir_snwprintf(strT, TranslateT("Error: %s"), TranslateW(error)); - parent->UpdateChat(NULL, strT); + parent->UpdateChat(nullptr, strT); } } @@ -663,7 +663,7 @@ bool Omegle_client::events() if (waiting) { // If we are only waiting in this event... - parent->UpdateChat(NULL, TranslateT("We are still waiting...")); + parent->UpdateChat(nullptr, TranslateT("We are still waiting...")); } return HANDLE_SUCCESS; diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp index 361820f2b5..db7d5f4403 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(NULL));
+ setDword("LogonTS", (DWORD)time(nullptr));
ClearChat();
OnJoinChat(0, false);
@@ -64,13 +64,13 @@ void OmegleProto::SignOff(void*) if (facy.hEventsConnection)
Netlib_CloseHandle(facy.hEventsConnection);
- facy.hEventsConnection = NULL;
+ facy.hEventsConnection = nullptr;
}
void OmegleProto::StopChat(bool disconnect)
{
if (facy.state_ == STATE_WAITING) {
- UpdateChat(NULL, TranslateT("Connecting canceled."), false);
+ UpdateChat(nullptr, TranslateT("Connecting canceled."), false);
}
else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY) {
bool spy = facy.state_ == STATE_SPY;
@@ -78,7 +78,7 @@ void OmegleProto::StopChat(bool disconnect) if (disconnect)
{
facy.state_ = STATE_DISCONNECTING;
- UpdateChat(NULL, TranslateT("Disconnecting..."), true);
+ UpdateChat(nullptr, TranslateT("Disconnecting..."), true);
if (facy.stop())
debugLogA("***** Disconnected from stranger %s", facy.chat_id_.c_str());
@@ -111,12 +111,12 @@ void OmegleProto::NewChat() {
if (facy.state_ == STATE_WAITING)
{
- UpdateChat(NULL, TranslateT("We are already waiting for new stranger..."), false);
+ UpdateChat(nullptr, TranslateT("We are already waiting for new stranger..."), false);
return;
}
else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY)
{
- UpdateChat(NULL, TranslateT("Disconnecting..."), true);
+ UpdateChat(nullptr, TranslateT("Disconnecting..."), true);
if (facy.stop())
debugLogA("***** Disconnected from stranger %s", facy.chat_id_.c_str());
@@ -135,13 +135,13 @@ void OmegleProto::NewChat() ClearChat();
- UpdateChat(NULL, TranslateT("Connecting..."), true);
+ UpdateChat(nullptr, TranslateT("Connecting..."), true);
facy.state_ = STATE_WAITING;
if (facy.start())
{
- UpdateChat(NULL, TranslateT("Waiting for Stranger..."), true);
+ UpdateChat(nullptr, TranslateT("Waiting for Stranger..."), true);
debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str());
}
}
@@ -153,13 +153,13 @@ void OmegleProto::NewChat() else
{
ClearChat();
- UpdateChat(NULL, TranslateT("Connecting..."), true);
+ UpdateChat(nullptr, TranslateT("Connecting..."), true);
facy.state_ = STATE_WAITING;
if (facy.start())
{
- UpdateChat(NULL, TranslateT("Waiting for Stranger..."), true);
+ UpdateChat(nullptr, TranslateT("Waiting for Stranger..."), true);
debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str());
ForkThread(&OmegleProto::EventsLoop, this);
@@ -172,7 +172,7 @@ void OmegleProto::EventsLoop(void *) {
ScopedLock s(events_loop_lock_);
- time_t tim = ::time(NULL);
+ time_t tim = ::time(nullptr);
debugLogA(">>>>> Entering Omegle::EventsLoop[%d]", tim);
while (facy.events())
diff --git a/protocols/Omegle/src/messages.cpp b/protocols/Omegle/src/messages.cpp index 8544b0464f..d1021c3597 100644 --- a/protocols/Omegle/src/messages.cpp +++ b/protocols/Omegle/src/messages.cpp @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void OmegleProto::SendMsgWorker(void *p) { - if (p == NULL) + if (p == nullptr) return; std::string data = *(std::string*)p; @@ -42,7 +42,7 @@ void OmegleProto::SendMsgWorker(void *p) void OmegleProto::SendTypingWorker(void *p) { - if (p == NULL) + if (p == nullptr) return; // Save typing info diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index aa46bbc601..3f98ad8845 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -27,10 +27,10 @@ PROTO<OmegleProto>(proto_name, username) {
this->facy.parent = this;
- this->signon_lock_ = CreateMutex(NULL, FALSE, NULL);
- this->log_lock_ = CreateMutex(NULL, FALSE, NULL);
- this->facy.connection_lock_ = CreateMutex(NULL, FALSE, NULL);
- this->events_loop_lock_ = CreateMutex(NULL, FALSE, NULL);
+ this->signon_lock_ = CreateMutex(nullptr, FALSE, nullptr);
+ this->log_lock_ = CreateMutex(nullptr, FALSE, nullptr);
+ this->facy.connection_lock_ = CreateMutex(nullptr, FALSE, nullptr);
+ this->events_loop_lock_ = CreateMutex(nullptr, FALSE, nullptr);
// Group chats
CreateProtoService(PS_JOINCHAT, &OmegleProto::OnJoinChat);
@@ -49,10 +49,10 @@ PROTO<OmegleProto>(proto_name, username) mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
nlu.szDescriptiveName.w = descr;
m_hNetlibUser = Netlib_RegisterUser(&nlu);
- if (m_hNetlibUser == NULL) {
+ if (m_hNetlibUser == nullptr) {
wchar_t error[200];
mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
- MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
facy.set_handle(m_hNetlibUser);
@@ -171,7 +171,7 @@ int OmegleProto::OnModulesLoaded(WPARAM, LPARAM) gcr.ptszDispName = m_tszUserName;
gcr.iMaxText = OMEGLE_MESSAGE_LIMIT;
gcr.nColors = 0;
- gcr.pColors = NULL;
+ gcr.pColors = nullptr;
Chat_Register(&gcr);
return 0;
diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp index a787f5e42c..7fd634c9a7 100644 --- a/protocols/Omegle/src/theme.cpp +++ b/protocols/Omegle/src/theme.cpp @@ -42,5 +42,5 @@ HANDLE GetIconHandle(const char* name) if (mir_strcmp(icons[i].szName, name) == 0)
return icons[i].hIcolib;
- return 0;
+ return nullptr;
}
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index 6a517c6a94..c79baf20cb 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -4,7 +4,7 @@ void CloseMyConference(CSametimeProto* proto)
{
mwConference_destroy(proto->my_conference, 0, Translate("I'm outa here."));
- proto->my_conference = 0;
+ proto->my_conference = nullptr;
}
CSametimeProto* getProtoFromMwConference(mwConference* conf)
@@ -45,7 +45,7 @@ void mwServiceConf_on_invited(mwConference* conf, mwLoginInfo* inviter, const ch wchar_t ws_invite[512];
MultiByteToWideChar(CP_UTF8, 0, (const char*)invite, -1, ws_invite, 128);
- if (MessageBoxW(0, ws_invite, ws_username, MB_OKCANCEL) == IDOK) {
+ if (MessageBoxW(nullptr, ws_invite, ws_username, MB_OKCANCEL) == IDOK) {
proto->debugLogW(L"mwServiceConf_on_invited() mwConference_accept");
mwConference_accept(conf);
}
@@ -64,7 +64,7 @@ void CSametimeProto::ClearInviteQueue() return;
mwIdBlock idb;
- idb.community = 0;
+ idb.community = nullptr;
while(invite_queue.size()) {
idb.user = (char *)invite_queue.front().c_str();
@@ -163,7 +163,7 @@ void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user) if (!hContact) {
mwIdBlock idb;
idb.user = ((mwLoginInfo *)user)->user_id;
- idb.community = 0;
+ idb.community = nullptr;
mwSametimeList* user_list = mwSametimeList_new();
mwSametimeGroup* stgroup = mwSametimeGroup_new(user_list, mwSametimeGroup_NORMAL, T2Utf(TranslateT("None")));
@@ -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(0);
+ gce.time = (DWORD)time(nullptr);
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(0);
+ gce.time = (DWORD)time(nullptr);
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(0);
+ gce.time = (DWORD)time(nullptr);
Chat_Event(&gce);
}
@@ -427,12 +427,12 @@ void CSametimeProto::DeinitConference() g_list_free(conferences);
}
- my_login_info = 0;
+ my_login_info = nullptr;
mwSession_removeService(session, mwService_CONFERENCE);
if (service_conference){
mwService_free((mwService*)service_conference);
- service_conference = 0;
+ service_conference = nullptr;
}
}
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index 0f30f5f06f..6d4813dbca 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -41,7 +41,7 @@ void mwFileTransfer_offered(mwFileTransfer* ft) PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = descriptionT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
@@ -58,7 +58,7 @@ int SendFileChunk(CSametimeProto* proto, mwFileTransfer* ft, FileTransferClientD if (!ftcd || !ftcd->buffer)
return 0;
- if (!ReadFile(ftcd->hFile, ftcd->buffer, FILE_BUFF_SIZE, &bytes_read, 0)) {
+ 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);
return 0;
@@ -89,7 +89,7 @@ void __cdecl SendThread(LPVOID param) { if (ftcd->sending == 1)
pfts.flags |= PFTS_SENDING;
- pfts.pszFiles = NULL;
+ pfts.pszFiles = nullptr;
pfts.totalFiles = ftcd->first->ft_count;
pfts.totalBytes = ftcd->first->totalSize;
@@ -220,7 +220,7 @@ void mwFileTransfer_recv(mwFileTransfer* ft, struct mwOpaque* data) proto->debugLogW(L"mwFileTransfer_recv() start");
DWORD bytes_written;
- if (!WriteFile(ftcd->hFile, data->data, data->len, &bytes_written, 0)) {
+ if (!WriteFile(ftcd->hFile, data->data, data->len, &bytes_written, nullptr)) {
proto->debugLogW(L"mwFileTransfer_recv() !WriteFile");
mwFileTransfer_cancel(ft);
proto->ProtoBroadcastAck(ftcd->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ftcd->hFt, 0);
@@ -236,7 +236,7 @@ void mwFileTransfer_recv(mwFileTransfer* ft, struct mwOpaque* data) if (ftcd->sending == 1) {
pfts.flags |= PFTS_SENDING;
}
- pfts.pszFiles = NULL;
+ pfts.pszFiles = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = mwFileTransfer_getFileSize(ft);
@@ -292,13 +292,13 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, wchar_t** files, const idb.user = id_block.user;
idb.community = id_block.community;
- FileTransferClientData *ftcd, *prev_ftcd = 0, *first_ftcd = 0;
- mwFileTransfer *ft, *first_ft = 0;
+ FileTransferClientData *ftcd, *prev_ftcd = nullptr, *first_ftcd = nullptr;
+ mwFileTransfer *ft, *first_ft = nullptr;
for (int i = 0; files[i]; i++) {
- HANDLE hFile = CreateFile(files[i], GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
+ HANDLE hFile = CreateFile(files[i], GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
- DWORD filesize = GetFileSize(hFile, 0);
+ DWORD filesize = GetFileSize(hFile, nullptr);
wchar_t *fn = wcsrchr(files[i], '\\');
if (fn)
@@ -314,7 +314,7 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, wchar_t** files, const ftcd->ft = ft;
ftcd->hContact = hContact;
- ftcd->next = 0;
+ ftcd->next = nullptr;
if (prev_ftcd) {
prev_ftcd->next = ftcd; // link into list
@@ -329,7 +329,7 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, wchar_t** files, const ftcd->hFile = hFile;
ftcd->hFt = (HANDLE)first_ft;
- ftcd->save_path = 0;
+ ftcd->save_path = nullptr;
ftcd->buffer = new char[FILE_BUFF_SIZE];
ftcd->ft_number = ftcd->first->ft_count;
@@ -337,7 +337,7 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, wchar_t** files, const ftcd->sizeToHere = ftcd->first->totalSize;
ftcd->first->totalSize += filesize;
- mwFileTransfer_setClientData(ft, (gpointer)ftcd, 0);
+ mwFileTransfer_setClientData(ft, (gpointer)ftcd, nullptr);
prev_ftcd = ftcd;
}
@@ -351,7 +351,7 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, wchar_t** files, const }
}
- return 0;
+ return nullptr;
}
HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* save_path)
@@ -370,9 +370,9 @@ HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* s if (save_path) // save path
ftcd->save_path = _strdup(save_path);
else
- ftcd->save_path = 0;
+ ftcd->save_path = nullptr;
- mwFileTransfer_setClientData(ft, (gpointer)ftcd, 0);
+ mwFileTransfer_setClientData(ft, (gpointer)ftcd, nullptr);
char fp[MAX_PATH];
char* fn = strrchr((char*)mwFileTransfer_getFileName(ft), '\\');
@@ -386,16 +386,16 @@ HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* s if (fn) mir_strcat(fp, fn);
else mir_strcat(fp, mwFileTransfer_getFileName(ft));
- ftcd->hFile = CreateFileA(fp, GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, 0, 0);
+ ftcd->hFile = CreateFileA(fp, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, 0, nullptr);
if (ftcd->hFile == INVALID_HANDLE_VALUE) {
debugLogW(L"CSametimeProto::AcceptFileTransfer() INVALID_HANDLE_VALUE");
mwFileTransfer_close(ft, mwFileTransfer_ERROR);
- return 0;
+ return nullptr;
}
ftcd->hContact = hContact;
- mwFileTransfer_setClientData(ft, (gpointer)ftcd, 0);
+ mwFileTransfer_setClientData(ft, (gpointer)ftcd, nullptr);
mwFileTransfer_accept(ft);
return hFt;
@@ -438,6 +438,6 @@ void CSametimeProto::DeinitFiles() debugLogW(L"CSametimeProto::DeinitFiles()");
mwSession_removeService(session, mwService_FILE_TRANSFER);
mwService_free((mwService*)service_files);
- service_files = 0;
+ service_files = nullptr;
}
diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp index 039aac3cb5..9b0fa0b9fb 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(NULL);
+ time_t t = time(nullptr);
pre.timestamp = t;
pre.szMessage = (char*)msg;
ProtoChainRecvMsg(hContact, &pre);
@@ -109,7 +109,7 @@ mwImHandler mwIm_handler = { mwIm_conversation_closed,
mwIm_conversation_recv,
mwIm_place_invite,
- NULL
+ nullptr
};
HANDLE CSametimeProto::SendMessageToUser(MCONTACT hContact, const char *szMsg)
@@ -142,7 +142,7 @@ HANDLE CSametimeProto::SendMessageToUser(MCONTACT hContact, const char *szMsg) free(id_block.user);
}
- return 0;
+ return nullptr;
}
void CSametimeProto::SendTyping(MCONTACT hContact, bool typing)
@@ -200,5 +200,5 @@ void CSametimeProto::DeinitMessaging() debugLogW(L"CSametimeProto::DeinitMessaging()");
mwSession_removeService(session, mwService_IM);
mwService_free((mwService*)service_im);
- service_im = 0;
+ service_im = nullptr;
}
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index 86a5491d55..188f0afd79 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -235,9 +235,9 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = L"All\0*.*\0";
ofn.nFilterIndex = 1;
- ofn.lpstrFileTitle = NULL;
+ ofn.lpstrFileTitle = nullptr;
ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
+ ofn.lpstrInitialDir = nullptr;
ofn.Flags = OFN_PATHMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE) {
@@ -402,7 +402,7 @@ void CSametimeProto::LoadOptions() if (options.err_method == ED_POP && !ServiceExists(MS_POPUP_SHOWMESSAGE))
options.err_method = ED_BAL;
- debugLogW(L"LoadOptions() loaded: ServerName:len=[%d], id:len=[%d], pword:len=[%d]", options.server_name == NULL ? -1 : mir_strlen(options.server_name), options.id == NULL ? -1 : mir_strlen(options.id), options.pword == NULL ? -1 : mir_strlen(options.pword));
+ debugLogW(L"LoadOptions() loaded: ServerName:len=[%d], id:len=[%d], pword:len=[%d]", options.server_name == nullptr ? -1 : mir_strlen(options.server_name), options.id == nullptr ? -1 : mir_strlen(options.id), options.pword == nullptr ? -1 : mir_strlen(options.pword));
debugLogW(L"LoadOptions() loaded: port=[%d], encrypt_session=[%d], ClientID=[%d], ClientVersionMajor=[%d], ClientVersionMinor=[%d]", options.port, options.encrypt_session, options.client_id, options.client_versionMajor, options.client_versionMinor);
debugLogW(L"LoadOptions() loaded: get_server_contacts=[%d], add_contacts=[%d], idle_as_away=[%d], err_method=[%d]", options.get_server_contacts, options.add_contacts, options.idle_as_away, options.err_method);
diff --git a/protocols/Sametime/src/places.cpp b/protocols/Sametime/src/places.cpp index 3a45fa6f67..8b3a030ed1 100644 --- a/protocols/Sametime/src/places.cpp +++ b/protocols/Sametime/src/places.cpp @@ -63,5 +63,5 @@ void CSametimeProto::DeinitPlaces(mwSession* session) debugLogW(L"CSametimeProto::DeinitPlaces()");
mwSession_removeService(session, mwService_PLACE);
mwService_free((mwService*)service_places);
- service_places = 0;
+ service_places = nullptr;
}
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 0b78ced3f5..0987008bec 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -101,7 +101,7 @@ HANDLE GetIconHandle(int iconId) for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
HICON LoadIconEx(const char* name, bool big)
@@ -152,7 +152,7 @@ void __cdecl sttFakeAckMessageFailedThread(void *param) proto->debugLogW(L"sttFakeAckMessageFailedThread() start");
Sleep(100);
- proto->ProtoBroadcastAck(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, tParam->lParam); ///TODO tParam->lParam: add error message
+ proto->ProtoBroadcastAck(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, tParam->lParam); ///TODO tParam->lParam: add error message
proto->debugLogW(L"sttFakeAckMessageFailedThread() end");
mir_free(tParam);
@@ -175,7 +175,7 @@ int CSametimeProto::OnWindowEvent(WPARAM, LPARAM lParam) {
MessageWindowEventData *mwed = (MessageWindowEventData*)lParam;
- if ((mwed == NULL) || db_get_b(mwed->hContact, m_szModuleName, "ChatRoom", 0))
+ if ((mwed == nullptr) || db_get_b(mwed->hContact, m_szModuleName, "ChatRoom", 0))
return 0;
if ((mwed->uType == MSG_WINDOW_EVT_CLOSING) || (mwed->uType == MSG_WINDOW_EVT_CLOSE))
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 2013429bbc..3fb384cb38 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -6,12 +6,12 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const wchar_t* tszUserN is_idle(false), idle_status(false),
first_online(true),
idle_timerid(0),
- session(NULL),
- my_login_info(NULL),
- my_conference(NULL),
- service_places(NULL),
- service_conference(NULL),
- server_connection(0)
+ session(nullptr),
+ my_login_info(nullptr),
+ my_conference(nullptr),
+ service_places(nullptr),
+ service_conference(nullptr),
+ server_connection(nullptr)
{
// Register m_hNetlibUser user
wchar_t name[128];
@@ -159,7 +159,7 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType) HANDLE CSametimeProto::SearchBasic(const wchar_t* id)
{
- debugLogW(L"CSametimeProto::SearchBasic() id:len=[%d]", id == NULL ? -1 : mir_wstrlen(id));
+ debugLogW(L"CSametimeProto::SearchBasic() id:len=[%d]", id == nullptr ? -1 : mir_wstrlen(id));
return (HANDLE)SearchForUser(T2Utf(id), FALSE);
///TODO - add timeout (like at GGPROTO::searchthread)
}
@@ -171,7 +171,7 @@ HWND CSametimeProto::SearchAdvanced(HWND owner) debugLogW(L"CSametimeProto::SearchAdvanced() buf:len=[%d]", mir_wstrlen(buf));
return (HWND)SearchForUser(T2Utf(buf), TRUE);
}
- return NULL;
+ return nullptr;
}
HWND CSametimeProto::CreateExtendedSearchUI(HWND owner)
@@ -211,7 +211,7 @@ HANDLE CSametimeProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, }
}
}
- return 0; // failure
+ return nullptr; // failure
}
int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg)
@@ -270,7 +270,7 @@ HANDLE CSametimeProto::GetAwayMsg(MCONTACT hContact) mir_forkthread(sttRecvAwayThread, tfap);
return (HANDLE)1;
}
- return NULL;
+ return nullptr;
}
int CSametimeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt)
@@ -284,7 +284,7 @@ int CSametimeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt int CSametimeProto::SetAwayMsg(int iStatus, const wchar_t* msg)
{
- debugLogW(L"CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]", iStatus, msg == NULL ? -1 : mir_wstrlen(msg));
+ debugLogW(L"CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]", iStatus, msg == nullptr ? -1 : mir_wstrlen(msg));
SetSessionAwayMessage(iStatus, msg);
return 0;
}
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 154a165f83..3646cc2f34 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -35,7 +35,7 @@ void __cdecl SessionClose(mwSession* session) CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR");
proto->debugLogW(L"SessionClose() server_connection=[%d]", proto->server_connection);
Netlib_CloseHandle(proto->server_connection);
- proto->server_connection = 0;
+ proto->server_connection = nullptr;
}
void CSametimeProto::SessionStarted()
@@ -64,14 +64,14 @@ void CSametimeProto::InitMeanwhileServices() InitFiles();
InitConference();
- mwSession_setProperty(session, "PROTO_STRUCT_PTR", this, NULL);
+ mwSession_setProperty(session, "PROTO_STRUCT_PTR", this, nullptr);
- mwSession_setProperty(session, mwSession_AUTH_USER_ID, options.id, NULL);
- mwSession_setProperty(session, mwSession_AUTH_PASSWORD, options.pword, NULL);
- mwSession_setProperty(session, mwSession_CLIENT_TYPE_ID, (void*)options.client_id, NULL);
+ mwSession_setProperty(session, mwSession_AUTH_USER_ID, options.id, nullptr);
+ mwSession_setProperty(session, mwSession_AUTH_PASSWORD, options.pword, nullptr);
+ mwSession_setProperty(session, mwSession_CLIENT_TYPE_ID, (void*)options.client_id, nullptr);
- mwSession_setProperty(session, mwSession_CLIENT_VER_MAJOR, (void*)options.client_versionMajor, NULL);
- mwSession_setProperty(session, mwSession_CLIENT_VER_MINOR, (void*)options.client_versionMinor, NULL);
+ mwSession_setProperty(session, mwSession_CLIENT_VER_MAJOR, (void*)options.client_versionMajor, nullptr);
+ mwSession_setProperty(session, mwSession_CLIENT_VER_MINOR, (void*)options.client_versionMinor, nullptr);
}
@@ -138,7 +138,7 @@ void __cdecl SessionAdmin(struct mwSession* session, const char* text) CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR");
proto->debugLogW(L"SessionAdmin()");
wchar_t* tt = mir_utf8decodeW(text);
- MessageBox(0, tt, TranslateT("Sametime administrator message"), MB_OK);
+ MessageBox(nullptr, tt, TranslateT("Sametime administrator message"), MB_OK);
mir_free(tt);
}
@@ -152,7 +152,7 @@ void __cdecl SessionAnnounce(struct mwSession* session, struct mwLoginInfo* from stzFrom = mir_utf8decodeW(from->user_name);
stzText = mir_utf8decodeW(text);
mir_snwprintf(stzFromBuff, TranslateT("Session announcement - from '%s'"), stzFrom);
- MessageBox(0, TranslateW(stzText), stzFromBuff, MB_OK);
+ MessageBox(nullptr, TranslateW(stzText), stzFromBuff, MB_OK);
mir_free(stzText);
mir_free(stzFrom);
}
@@ -243,9 +243,9 @@ int CSametimeProto::SetSessionStatus(int status) struct mwUserStatus us;
debugLogW(L"SetSessionStatus() start status=[%d]", status);
- if (idle_timerid) KillTimer(0, idle_timerid);
+ if (idle_timerid) KillTimer(nullptr, idle_timerid);
- us.time = (DWORD)time(0);
+ us.time = (DWORD)time(nullptr);
//us.time = 0;
switch (status) {
@@ -271,7 +271,7 @@ int CSametimeProto::SetSessionStatus(int status) us.desc = AwayMessages.szOnline; us.status = mwStatus_ACTIVE; break;
}
- debugLogW(L"SetSessionStatus() mwSession_setUserStatus us.status=[%d], us.desc:len=[%d]", us.status, us.desc == NULL ? -1 : mir_strlen(us.desc));
+ debugLogW(L"SetSessionStatus() mwSession_setUserStatus us.status=[%d], us.desc:len=[%d]", us.status, us.desc == nullptr ? -1 : mir_strlen(us.desc));
mwSession_setUserStatus(session, &us);
return 0;
@@ -281,14 +281,14 @@ VOID CALLBACK IdleTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime {
CSametimeProto* proto = (CSametimeProto*)idEvent;
- KillTimer(0, proto->idle_timerid);
+ KillTimer(nullptr, proto->idle_timerid);
proto->idle_timerid = 0;
if (proto->idle_status) {
struct mwUserStatus us;
- us.time = (DWORD)time(0);
+ us.time = (DWORD)time(nullptr);
us.status = mwStatus_IDLE;
- us.desc = 0;
+ us.desc = nullptr;
mwSession_setUserStatus(proto->session, &us);
}
else proto->SetSessionStatus(proto->m_iStatus);
@@ -301,19 +301,19 @@ int CSametimeProto::SetIdle(bool idle) if (idle && !idle_status) {
idle_status = true;
if (!idle_timerid)
- idle_timerid = SetTimer(0, (UINT_PTR)this, 200, IdleTimerProc);
+ idle_timerid = SetTimer(nullptr, (UINT_PTR)this, 200, IdleTimerProc);
}
else if (idle_status) {
idle_status = false;
if (!idle_timerid)
- idle_timerid = SetTimer(0, (UINT_PTR)this, 200, IdleTimerProc);
+ idle_timerid = SetTimer(nullptr, (UINT_PTR)this, 200, IdleTimerProc);
}
return 0;
}
void CSametimeProto::SetSessionAwayMessage(int status, const wchar_t* msgT)
{
- debugLogW(L"SetSessionAwayMessage() status=[%d], msgT:len=[%d]", status, msgT == NULL ? -1 : mir_wstrlen(msgT));
+ debugLogW(L"SetSessionAwayMessage() status=[%d], msgT:len=[%d]", status, msgT == nullptr ? -1 : mir_wstrlen(msgT));
T2Utf msg(msgT);
if (status == ID_STATUS_ONLINE)
@@ -408,7 +408,7 @@ void __cdecl SessionThread(LPVOID param) return;
}
- mwSessionHandler handler = { 0 };
+ mwSessionHandler handler = {};
handler.clear = SessionClear;
handler.io_write = SessionWrite;
handler.io_close = SessionClose;
@@ -453,7 +453,7 @@ void __cdecl SessionThread(LPVOID param) mir_cslock lck2(proto->session_cs);
proto->DeinitMeanwhileServices();
mwSession* old_session = proto->session;
- proto->session = 0; // kills keepalive thread, if awake
+ proto->session = nullptr; // kills keepalive thread, if awake
mwSession_free(old_session);
proto->BroadcastNewStatus(ID_STATUS_OFFLINE);
@@ -536,10 +536,10 @@ int CSametimeProto::OnLogInRedirect(char* newHost) void CSametimeProto::InitAwayMsg()
{
- AwayMessages.szOnline = 0;
- AwayMessages.szAway = 0;
- AwayMessages.szDND = 0;
- AwayMessages.szOccupied = 0;
+ AwayMessages.szOnline = nullptr;
+ AwayMessages.szAway = nullptr;
+ AwayMessages.szDND = nullptr;
+ AwayMessages.szOccupied = nullptr;
}
void CSametimeProto::DeinitAwayMsg()
diff --git a/protocols/Sametime/src/session_announce_win.cpp b/protocols/Sametime/src/session_announce_win.cpp index 99b85c6bb3..45c4dffa2d 100644 --- a/protocols/Sametime/src/session_announce_win.cpp +++ b/protocols/Sametime/src/session_announce_win.cpp @@ -91,7 +91,7 @@ INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara char *p = id + 2; // it's wrong - it works for a list of user id's with no prefix - so we'll do both
// build recipient list
- safArg->recipients = 0;
+ safArg->recipients = nullptr;
int size = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_LST_ANTO));
int send_count = 0;
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index 11c8591827..a61398189a 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -25,7 +25,7 @@ bool CSametimeProto::GetAwareIdFromContact(MCONTACT hContact, mwAwareIdBlock* id if (dbv.pszVal) {
id_block->type = mwAware_USER;
id_block->user = _strdup(dbv.pszVal);
- id_block->community = 0;
+ id_block->community = nullptr;
db_free(&dbv);
return true;
}
@@ -104,7 +104,7 @@ MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary) //add to our awareness list
mwAwareIdBlock id_block;
if (GetAwareIdFromContact(hContact, &id_block)) {
- GList* gl = g_list_prepend(NULL, &id_block);
+ GList* gl = g_list_prepend(nullptr, &id_block);
mwAwareList_addAware(aware_list, gl);
g_list_free(gl);
free(id_block.user);
@@ -164,9 +164,9 @@ void CSametimeProto::ImportContactsFromList(mwSametimeList* user_list, bool temp mwAwareIdBlock id_block;
id_block.type = mwAware_GROUP;
id_block.user = (char*)group_name;
- id_block.community = 0;
+ id_block.community = nullptr;
- GList* gl = g_list_prepend(NULL, &id_block);
+ GList* gl = g_list_prepend(nullptr, &id_block);
mwAwareList_addAware(aware_list, gl);
g_list_free(gl);
}
@@ -188,7 +188,7 @@ void CSametimeProto::ImportContactsFromList(mwSametimeList* user_list, bool temp void CSametimeProto::ExportContactsToList(mwSametimeList* user_list)
{
debugLogW(L"CSametimeProto::ExportContactsToList() start");
- mwSametimeGroup* stgroup = 0;
+ mwSametimeGroup* stgroup = nullptr;
char* group_name;
char* group_alias;
mwSametimeGroupType group_type;
@@ -203,7 +203,7 @@ void CSametimeProto::ExportContactsToList(mwSametimeList* user_list) mwAwareIdBlock id_block;
mwIdBlock uid;
- GList* gl = 0;
+ GList* gl = nullptr;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (!db_get_utf(hContact, m_szModuleName, "stid", &dbv)) {
if (dbv.pszVal) {
@@ -249,7 +249,7 @@ void CSametimeProto::ExportContactsToList(mwSametimeList* user_list) group_open = (db_get_b(0, szProtoGroups, buff, 0) == 1);
}
- stgroup = 0;
+ stgroup = nullptr;
stgroup = mwSametimeList_findGroup(user_list, group_name);
if (!stgroup) {
if (group_name) stgroup = mwSametimeGroup_new(user_list, group_type, group_name);
@@ -265,14 +265,14 @@ void CSametimeProto::ExportContactsToList(mwSametimeList* user_list) db_free(&dbv2);
}
else
- user_shortName = 0;
+ user_shortName = nullptr;
if (!db_get_utf(hContact, "CList", "MyHandle", &dbv2)) {
user_alias = _strdup(dbv2.pszVal);
db_free(&dbv2);
}
else
- user_alias = 0;
+ user_alias = nullptr;
user_type = (mwSametimeUserType)db_get_b(hContact, m_szModuleName, "type", (BYTE)mwSametimeUser_NORMAL);
@@ -346,7 +346,7 @@ void CSametimeProto::ExportContactsToServer() mwPutBuffer_finalize(op, buff);
/* save the storage unit to the service */
- mwServiceStorage_save(service_storage, unit, NULL, NULL, NULL);
+ mwServiceStorage_save(service_storage, unit, nullptr, nullptr, nullptr);
}
@@ -376,7 +376,7 @@ void CSametimeProto::UserListAddStored() {
mwStorageUnit* unit;
unit = mwStorageUnit_new(mwStore_AWARE_LIST);
- mwServiceStorage_load(service_storage, unit, &load_users_callback, (gpointer)this, 0);
+ mwServiceStorage_load(service_storage, unit, &load_users_callback, (gpointer)this, nullptr);
}
int CSametimeProto::ContactDeleted(MCONTACT hContact)
@@ -389,7 +389,7 @@ int CSametimeProto::ContactDeleted(MCONTACT hContact) debugLogW(L"CSametimeProto::ContactDeleted()");
if (GetAwareIdFromContact(hContact, &id_block)) {
- GList* gl = g_list_prepend(NULL, &id_block);
+ GList* gl = g_list_prepend(nullptr, &id_block);
mwAwareList_removeAware(aware_list, gl);
g_list_free(gl);
free(id_block.user);
@@ -413,7 +413,7 @@ void mwResolve_handler_dyngroup_callback(mwServiceResolve* srvc, guint32 id, gui mwResolveResult* result;
mwResolveMatch* match;
- g_return_if_fail(results != NULL);
+ g_return_if_fail(results != nullptr);
if (results) {
result = (mwResolveResult*)results->data;
@@ -423,7 +423,7 @@ void mwResolve_handler_dyngroup_callback(mwServiceResolve* srvc, guint32 id, gui if (match) {
mwIdBlock uid;
uid.user = match->id;
- uid.community = 0;
+ uid.community = nullptr;
mwSametimeUser *stuser = mwSametimeUser_new(stgroup, mwSametimeUser_NORMAL, &uid);
mwSametimeUser_setShortName(stuser, match->name);
@@ -457,7 +457,7 @@ void mwAwareList_on_aware(mwAwareList* list, mwAwareSnapshot* aware) CSametimeProto* proto = getProtoFromMwAwareList(list);;
MCONTACT hContact = proto->FindContactByUserId(aware->id.user);
- char* group = 0;
+ char* group = nullptr;
DBVARIANT dbv;
// update self - necessary for some servers
@@ -504,8 +504,8 @@ void mwAwareList_on_aware(mwAwareList* list, mwAwareSnapshot* aware) db_free(&dbv);
}
- GList* query = g_list_prepend(0, aware->id.user);
- mwServiceResolve_resolve(proto->service_resolve, query, mwResolveFlag_USERS, mwResolve_handler_dyngroup_callback, (gpointer)stgroup, 0);
+ GList* query = g_list_prepend(nullptr, aware->id.user);
+ mwServiceResolve_resolve(proto->service_resolve, query, mwResolveFlag_USERS, mwResolve_handler_dyngroup_callback, (gpointer)stgroup, nullptr);
g_list_free(query);
}
@@ -530,7 +530,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(0));
+ db_set_dw(hContact, proto->m_szModuleName, "IdleTS", (DWORD)time(nullptr));
break;
case mwStatus_BUSY:
new_status = ID_STATUS_DND;
@@ -593,7 +593,7 @@ void CSametimeProto::UserListCreate() DBVARIANT dbv;
mwAwareIdBlock id_block;
- GList *gl = 0;
+ GList *gl = nullptr;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 0 /*&& proto && !mir_strcmp( PROTO, proto)*/) {
@@ -601,7 +601,7 @@ void CSametimeProto::UserListCreate() if (dbv.pszVal) {
if (GetAwareIdFromContact(hContact, &id_block)) {
// add user to aware list
- gl = g_list_prepend(0, &id_block);
+ gl = g_list_prepend(nullptr, &id_block);
mwAwareList_addAware(aware_list, gl);
free(id_block.user);
g_list_free(gl);
@@ -616,9 +616,9 @@ void CSametimeProto::UserListCreate() if (!db_get_utf(0, m_szModuleName, "stid", &dbv)) {
id_block.type = mwAware_USER;
id_block.user = dbv.pszVal;
- id_block.community = 0;
+ id_block.community = nullptr;
- gl = g_list_prepend(0, &id_block);
+ gl = g_list_prepend(nullptr, &id_block);
mwAwareList_addAware(aware_list, gl);
g_list_free(gl);
@@ -629,7 +629,7 @@ void CSametimeProto::UserListCreate() void CSametimeProto::UserListDestroy()
{
mwAwareList_free(aware_list);
- aware_list = 0;
+ aware_list = nullptr;
}
void CSametimeProto::UserRecvAwayMessage(MCONTACT hContact)
@@ -733,8 +733,8 @@ void mwResolve_handler_details_callback(mwServiceResolve* srvc, guint32 id, guin int CSametimeProto::SearchForUser(const char* name, BOOLEAN advanced)
{
if (m_iStatus != ID_STATUS_OFFLINE && service_resolve) {
- GList *query = g_list_prepend(0, (gpointer) name);
- guint32 id = mwServiceResolve_resolve(service_resolve, query, (mwResolveFlag)(mwResolveFlag_USERS | mwResolveFlag_GROUPS), &mwResolve_handler_callback, (gpointer)advanced, 0);
+ GList *query = g_list_prepend(nullptr, (gpointer) name);
+ guint32 id = mwServiceResolve_resolve(service_resolve, query, (mwResolveFlag)(mwResolveFlag_USERS | mwResolveFlag_GROUPS), &mwResolve_handler_callback, (gpointer)advanced, nullptr);
g_list_free(query);
return id; // search handle
}
@@ -744,8 +744,8 @@ int CSametimeProto::SearchForUser(const char* name, BOOLEAN advanced) int CSametimeProto::GetMoreDetails(const char* name)
{
if (m_iStatus != ID_STATUS_OFFLINE && service_resolve) {
- GList *query = g_list_prepend(0, (void *)name);
- guint32 id = mwServiceResolve_resolve(service_resolve, query, (mwResolveFlag)(mwResolveFlag_USERS | mwResolveFlag_UNIQUE), &mwResolve_handler_details_callback, NULL, 0);
+ GList *query = g_list_prepend(nullptr, (void *)name);
+ guint32 id = mwServiceResolve_resolve(service_resolve, query, (mwResolveFlag)(mwResolveFlag_USERS | mwResolveFlag_UNIQUE), &mwResolve_handler_details_callback, nullptr, nullptr);
g_list_free(query);
return id; // search handle
}
@@ -767,7 +767,7 @@ MCONTACT CSametimeProto::AddSearchedUser(MYPROTOSEARCHRESULT* mpsr, bool tempora MCONTACT hContact = 0;
debugLogW(L"CSametimeProto::AddSearchedUser() start");
mwSametimeList* user_list = mwSametimeList_new();
- mwSametimeGroup* stgroup = 0;
+ mwSametimeGroup* stgroup = nullptr;
if (mpsr->group) {
stgroup = mwSametimeGroup_new(user_list, mwSametimeGroup_DYNAMIC, mpsr->stid);
mwSametimeGroup_setAlias(stgroup, mpsr->name);
@@ -778,7 +778,7 @@ MCONTACT CSametimeProto::AddSearchedUser(MYPROTOSEARCHRESULT* mpsr, bool tempora mwIdBlock uid;
uid.user = mpsr->stid;
- uid.community = 0;
+ uid.community = nullptr;
mwSametimeUser *stuser = mwSametimeUser_new(stgroup, mwSametimeUser_NORMAL, &uid);
mwSametimeUser_setShortName(stuser, mpsr->name);
@@ -817,13 +817,13 @@ void CSametimeProto::DeinitUserList() mwSession_removeService(session, mwService_AWARE);
mwService_free((mwService*)service_aware);
- service_aware = 0;
+ service_aware = nullptr;
mwSession_removeService(session, mwService_RESOLVE);
mwService_free((mwService*)service_resolve);
- service_resolve = 0;
+ service_resolve = nullptr;
mwSession_removeService(session, mwService_STORAGE);
mwService_free((mwService*)service_storage);
- service_storage = 0;
+ service_storage = nullptr;
}
diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp index 27d962a9d9..17f545cf96 100644 --- a/protocols/Sametime/src/utils.cpp +++ b/protocols/Sametime/src/utils.cpp @@ -15,7 +15,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar case UM_FREEPLUGINDATA:
PopupData* puData = (PopupData*)PUGetPluginData(hWnd);
- if (puData != NULL && puData != (PopupData*)CALLSERVICE_NOTFOUND) {
+ if (puData != nullptr && puData != (PopupData*)CALLSERVICE_NOTFOUND) {
mir_free(puData->title);
mir_free(puData->text);
mir_free(puData);
@@ -99,9 +99,9 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) }
else { //disp == ED_MB
if (puData->flag == SAMETIME_POPUP_ERROR)
- MessageBox(NULL, puData->text, puData->title, MB_OK | MB_ICONWARNING);
+ MessageBox(nullptr, puData->text, puData->title, MB_OK | MB_ICONWARNING);
else
- MessageBox(NULL, puData->text, puData->title, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, puData->text, puData->title, MB_OK | MB_ICONINFORMATION);
}
if (disp != ED_POP) {
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index db03720e5d..37b2ba5a97 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. int hLangpack;
HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
-FI_INTERFACE *fii = NULL;
+FI_INTERFACE *fii = nullptr;
char g_szMirVer[100];
HANDLE g_hCallEvent;
CHAT_MANAGER *pci;
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp index 84d725aba4..e0c72c9cee 100644 --- a/protocols/SkypeWeb/src/request_queue.cpp +++ b/protocols/SkypeWeb/src/request_queue.cpp @@ -21,7 +21,7 @@ RequestQueue::RequestQueue(HNETLIBUSER _nlu) : nlu(_nlu), requests(1)
{
isTerminated = true;
- hRequestQueueThread = NULL;
+ hRequestQueueThread = nullptr;
}
RequestQueue::~RequestQueue()
@@ -40,7 +40,7 @@ void RequestQueue::Start() return;
isTerminated = false;
- if (hRequestQueueThread == NULL)
+ if (hRequestQueueThread == nullptr)
hRequestQueueThread = mir_forkthread((pThreadFunc)&RequestQueue::WorkerThread, this);
}
@@ -70,13 +70,13 @@ 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, 0);
+ mir_forkthreadowner((pThreadFuncOwner)&RequestQueue::AsyncSendThread, this, item, nullptr);
}
void RequestQueue::Execute(RequestQueueItem *item)
{
NETLIBHTTPREQUEST *response = item->request->Send(nlu);
- if (item->responseCallback != NULL)
+ if (item->responseCallback != nullptr)
item->responseCallback(response, item->arg);
Netlib_FreeHttpRequest(response);
requests.remove(item);
@@ -103,7 +103,7 @@ unsigned int RequestQueue::WorkerThread(void *arg) break;
while (true) {
- RequestQueueItem *item = NULL;
+ RequestQueueItem *item = nullptr;
{
mir_cslock lock(queue->requestQueueLock);
@@ -113,11 +113,11 @@ unsigned int RequestQueue::WorkerThread(void *arg) item = queue->requests[0];
queue->requests.remove(0);
}
- if (item != NULL)
+ if (item != nullptr)
queue->Execute(item);
}
}
- queue->hRequestQueueThread = NULL;
+ queue->hRequestQueueThread = nullptr;
return 0;
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_accounts.cpp b/protocols/SkypeWeb/src/skype_accounts.cpp index 92b58e2cc5..1e54acb021 100644 --- a/protocols/SkypeWeb/src/skype_accounts.cpp +++ b/protocols/SkypeWeb/src/skype_accounts.cpp @@ -46,7 +46,7 @@ CSkypeProto* CSkypeProto::GetContactAccount(MCONTACT hContact) for (int i = 0; i < Accounts.getCount(); i++)
if (mir_strcmpi(GetContactProto(hContact), Accounts[i]->m_szModuleName) == 0)
return Accounts[i];
- return NULL;
+ return nullptr;
}
int CSkypeProto::OnAccountLoaded(WPARAM, LPARAM)
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 594d843dce..279087960b 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -54,7 +54,7 @@ void CSkypeProto::ReloadAvatarInfo(MCONTACT hContact) void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (response == NULL || response->pData == NULL)
+ if (response == nullptr || response->pData == nullptr)
return;
MCONTACT hContact = (DWORD_PTR)arg;
@@ -67,7 +67,7 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) GetAvatarFileName(hContact, ai.filename, _countof(ai.filename));
FILE *out = _wfopen(ai.filename, L"wb");
- if (out == NULL) {
+ if (out == nullptr) {
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai, 0);
return;
}
@@ -80,7 +80,7 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) void CSkypeProto::OnSentAvatar(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (response == nullptr)
return;
JSONNode root = JSONNode::parse(response->pData);
@@ -167,7 +167,7 @@ INT_PTR CSkypeProto::SvcSetMyAvatar(WPARAM, LPARAM lParam) wchar_t *path = (wchar_t*)lParam;
wchar_t avatarPath[MAX_PATH];
GetAvatarFileName(NULL, avatarPath, _countof(avatarPath));
- if (path != NULL) {
+ if (path != nullptr) {
if (CopyFile(path, avatarPath, FALSE)) {
FILE *hFile = _wfopen(path, L"rb");
if (hFile) {
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 85ffc6a5dc..9dbb8032a8 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -70,7 +70,7 @@ void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname) void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (response == nullptr)
return;
JSONNode root = JSONNode::parse(response->pData);
@@ -214,7 +214,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) gce.ptszUID = gch->ptszUID;
gce.ptszText = tnick_new;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = time(NULL);
+ gce.time = time(nullptr);
Chat_Event(&gce);
if (!reset)
@@ -243,7 +243,7 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM) if (!IsOnline())
return 1;
- if (hContact && IDYES == MessageBox(NULL, TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION)) {
+ if (hContact && IDYES == MessageBox(nullptr, TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION)) {
ptrW idT(getWStringA(hContact, "ChatRoomID"));
Chat_Control(m_szModuleName, idT, SESSION_OFFLINE);
Chat_Terminate(m_szModuleName, idT);
@@ -283,13 +283,13 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) ptrA xinitiator, xtarget, initiator;
//content = <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember>
- HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"addmember");
- if (xml == NULL)
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), nullptr, L"addmember");
+ if (xml == nullptr)
return;
for (int i = 0; i < xmlGetChildCount(xml); i++) {
HXML xmlNode = xmlGetNthChild(xml, L"target", i);
- if (xmlNode == NULL)
+ if (xmlNode == nullptr)
break;
xtarget = mir_u2a(xmlGetText(xmlNode));
@@ -303,13 +303,13 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) ptrA xinitiator, xtarget;
//content = <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember>
- HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"deletemember");
- if (xml != NULL) {
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), nullptr, L"deletemember");
+ if (xml != nullptr) {
HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0);
- xinitiator = node != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
+ xinitiator = node != NULL ? mir_u2a(xmlGetText(xmlNode)) : nullptr;
xmlNode = xmlGetChildByPath(xml, L"target", 0);
- xtarget = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
+ xtarget = xmlNode != nullptr ? mir_u2a(xmlGetText(xmlNode)) : nullptr;
xmlDestroyNode(xml);
}
@@ -324,13 +324,13 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) else if (messageType == "ThreadActivity/TopicUpdate") {
//content=<topicupdate><eventtime>1429532702130</eventtime><initiator>8:user</initiator><value>test topic</value></topicupdate>
ptrA xinitiator, value;
- HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"topicupdate");
- if (xml != NULL) {
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), nullptr, L"topicupdate");
+ if (xml != nullptr) {
HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0);
- xinitiator = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
+ xinitiator = xmlNode != nullptr ? mir_u2a(xmlGetText(xmlNode)) : nullptr;
xmlNode = xmlGetChildByPath(xml, L"value", 0);
- value = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
+ value = xmlNode != nullptr ? mir_u2a(xmlGetText(xmlNode)) : nullptr;
xmlDestroyNode(xml);
}
@@ -342,17 +342,17 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) else if (messageType == "ThreadActivity/RoleUpdate") {
//content=<roleupdate><eventtime>1429551258363</eventtime><initiator>8:user</initiator><target><id>8:user1</id><role>admin</role></target></roleupdate>
ptrA xinitiator, xId, xRole;
- HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"roleupdate");
- if (xml != NULL) {
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), nullptr, L"roleupdate");
+ if (xml != nullptr) {
HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0);
- xinitiator = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
+ xinitiator = xmlNode != nullptr ? mir_u2a(xmlGetText(xmlNode)) : nullptr;
xmlNode = xmlGetChildByPath(xml, L"target", 0);
- if (xmlNode != NULL) {
+ if (xmlNode != nullptr) {
HXML xmlId = xmlGetChildByPath(xmlNode, L"id", 0);
HXML xmlRole = xmlGetChildByPath(xmlNode, L"role", 0);
- xId = xmlId != NULL ? mir_u2a(xmlGetText(xmlId)) : NULL;
- xRole = xmlRole != NULL ? mir_u2a(xmlGetText(xmlRole)) : NULL;
+ xId = xmlId != nullptr ? mir_u2a(xmlGetText(xmlId)) : nullptr;
+ xRole = xmlRole != nullptr ? mir_u2a(xmlGetText(xmlRole)) : nullptr;
}
xmlDestroyNode(xml);
@@ -367,7 +367,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) gce.ptszNick = tszId;
gce.ptszUID = tszId;
gce.ptszText = tszInitiator;
- gce.time = time(NULL);
+ gce.time = time(nullptr);
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateT("Admin");
Chat_Event(&gce);
@@ -388,9 +388,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(NULL), szMessage, li));
+ SendRequest(new SendChatActionRequest(szChatId, time(nullptr), szMessage, li));
else
- SendRequest(new SendChatMessageRequest(szChatId, time(NULL), szMessage, li));
+ SendRequest(new SendChatMessageRequest(szChatId, time(nullptr), 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)
@@ -421,7 +421,7 @@ void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p)
{
ptrW topic((wchar_t*)p); // memory must be freed in any case
- if (response == NULL || response->pData == NULL)
+ if (response == nullptr || response->pData == nullptr)
return;
JSONNode root = JSONNode::parse(response->pData);
@@ -469,7 +469,7 @@ void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const bool CSkypeProto::IsChatContact(const wchar_t *chat_id, const char *id)
{
ptrA users(GetChatUsers(chat_id));
- return (users != NULL && strstr(users, id) != NULL);
+ return (users != NULL && strstr(users, id) != nullptr);
}
char *CSkypeProto::GetChatUsers(const wchar_t *chat_id)
@@ -485,7 +485,7 @@ char *CSkypeProto::GetChatUsers(const wchar_t *chat_id) wchar_t* CSkypeProto::GetChatContactNick(const char *chat_id, const char *id, const char *name)
{
// Check if there is custom nick for this chat contact
- if (chat_id != NULL) {
+ if (chat_id != nullptr) {
if (wchar_t *tname = db_get_wsa(FindChatRoom(chat_id), "UsersNicks", id))
return tname;
}
@@ -510,7 +510,7 @@ wchar_t* CSkypeProto::GetChatContactNick(const char *chat_id, const char *id, co }
// Return default value as nick - given name or user id
- if (name != NULL)
+ if (name != nullptr)
return mir_a2u_cp(name, CP_UTF8);
else
return mir_a2u(id);
@@ -528,7 +528,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(NULL) : NULL;
+ gce.time = !isChange ? time(nullptr) : NULL;
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateW(role);
@@ -549,13 +549,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(NULL);
+ gce.time = time(nullptr);
}
else {
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
- gce.time = time(NULL);
+ gce.time = time(nullptr);
gce.bIsMe = IsMe(id);
}
@@ -599,7 +599,7 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) static const struct gc_item Items[] =
{
{ LPGENW("Kick &user"), 10, MENU_ITEM },
- { NULL, 0, MENU_SEPARATOR },
+ { nullptr, 0, MENU_SEPARATOR },
{ LPGENW("Set &role"), 20, MENU_NEWPOPUP },
{ LPGENW("&Admin"), 30, MENU_POPUPITEM },
{ LPGENW("&User"), 40, MENU_POPUPITEM },
@@ -617,7 +617,7 @@ CMStringW CSkypeProto::ChangeTopicForm() ENTER_STRING pForm = { sizeof(pForm) };
pForm.type = ESF_MULTILINE;
pForm.caption = caption;
- pForm.ptszInitVal = NULL;
+ pForm.ptszInitVal = nullptr;
pForm.szModuleName = m_szModuleName;
return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult));
}
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index a7e24d8f28..58b7f8ea82 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -104,7 +104,7 @@ MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary) void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (response == nullptr)
return;
JSONNode root = JSONNode::parse(response->pData);
@@ -130,10 +130,10 @@ void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response) db_set_dw(hContact, m_szModuleName, "LastAuthRequestTime", eventTime);
delSetting(hContact, "Auth");
- DB_AUTH_BLOB blob(hContact, NULL, NULL, NULL, skypename.c_str(), reason.c_str());
+ DB_AUTH_BLOB blob(hContact, nullptr, nullptr, nullptr, skypename.c_str(), reason.c_str());
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.lParam = blob.size();
pre.szMessage = blob;
@@ -146,7 +146,7 @@ void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response) //[{"username":"echo123", "firstname" : "Echo \/ Sound Test Service", "lastname" : null, "avatarUrl" : null, "mood" : null, "richMood" : null, "displayname" : null, "country" : null, "city" : null},...]
void CSkypeProto::LoadContactsInfo(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (response == nullptr)
return;
JSONNode root = JSONNode::parse(response->pData);
@@ -174,7 +174,7 @@ void CSkypeProto::LoadContactsInfo(const NETLIBHTTPREQUEST *response) void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (response == nullptr)
return;
JSONNode root = JSONNode::parse(response->pData);
@@ -314,7 +314,7 @@ INT_PTR CSkypeProto::BlockContact(WPARAM hContact, LPARAM) void CSkypeProto::OnBlockContact(const NETLIBHTTPREQUEST *response, void *p)
{
MCONTACT hContact = (DWORD_PTR)p;
- if (response == NULL)
+ if (response == nullptr)
return;
db_set_dw(hContact, "Ignore", "Mask1", 127);
db_set_b(hContact, "CList", "Hidden", 1);
@@ -329,7 +329,7 @@ INT_PTR CSkypeProto::UnblockContact(WPARAM hContact, LPARAM) void CSkypeProto::OnUnblockContact(const NETLIBHTTPREQUEST *response, void *p)
{
MCONTACT hContact = (DWORD_PTR)p;
- if (response == NULL)
+ if (response == nullptr)
return;
db_set_dw(hContact, "Ignore", "Mask1", 0);
db_set_b(hContact, "CList", "Hidden", 0);
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index 81d3fa434a..f5fd1519b6 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -32,7 +32,7 @@ struct SkypeDBType { int type; char *name; DWORD flags; } g_SkypeDBTypes[] = MEVENT CSkypeProto::GetMessageFromDb(MCONTACT hContact, const char *messageId, LONGLONG timestamp) { - if (messageId == NULL) + if (messageId == nullptr) return NULL; timestamp -= 600; // we check events written 10 minutes ago diff --git a/protocols/SkypeWeb/src/skype_dialogs.cpp b/protocols/SkypeWeb/src/skype_dialogs.cpp index 04645c8ee8..b85ab3ad27 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.cpp +++ b/protocols/SkypeWeb/src/skype_dialogs.cpp @@ -82,7 +82,7 @@ void CSkypeGCCreateDlg::btnOk_OnOk(CCtrlButton*) if (HANDLE hItem = m_clc.FindContact(hContact)) {
if (m_clc.GetCheck(hItem)) {
char *szName = mir_strdup(m_proto->Contacts[hContact]);
- if (szName != NULL)
+ if (szName != nullptr)
m_ContactsList.insert(szName);
}
}
@@ -104,7 +104,7 @@ void CSkypeGCCreateDlg::FilterList(CCtrlClc *) void CSkypeGCCreateDlg::ResetListOptions(CCtrlClc *)
{
- m_clc.SetBkBitmap(0, NULL);
+ m_clc.SetBkBitmap(0, nullptr);
m_clc.SetBkColor(GetSysColor(COLOR_WINDOW));
m_clc.SetGreyoutFlags(0);
m_clc.SetLeftMargin(4);
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 51b1f87b7c..09bebbf54c 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -52,18 +52,18 @@ INT_PTR CSkypeProto::GetEventText(WPARAM pEvent, LPARAM datatype) case SKYPE_DB_EVENT_TYPE_CALL_INFO:
{
- HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), 0, L"partlist");
- if (xml != NULL) {
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), nullptr, L"partlist");
+ if (xml != nullptr) {
ptrA type(mir_u2a(xmlGetAttrValue(xml, L"type")));
bool bType = (!mir_strcmpi(type, "started")) ? 1 : 0;
time_t callDuration = 0;
for (int i = 0; i < xmlGetChildCount(xml); i++) {
HXML xmlPart = xmlGetNthChild(xml, L"part", i);
- if (xmlPart != NULL) {
+ if (xmlPart != nullptr) {
HXML xmlDuration = xmlGetChildByPath(xmlPart, L"duration", 0);
- if (xmlDuration != NULL) {
+ if (xmlDuration != nullptr) {
callDuration = _wtol(xmlGetText(xmlDuration));
break;
}
@@ -92,15 +92,15 @@ INT_PTR CSkypeProto::GetEventText(WPARAM pEvent, LPARAM datatype) }
case SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO:
{
- HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), 0, L"files");
- if (xml != NULL) {
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), nullptr, L"files");
+ if (xml != nullptr) {
for (int i = 0; i < xmlGetChildCount(xml); i++) {
LONGLONG fileSize = 0;
HXML xmlNode = xmlGetNthChild(xml, L"file", i);
- if (xmlNode != NULL) {
+ if (xmlNode != nullptr) {
fileSize = _wtol(xmlGetAttrValue(xmlNode, L"size"));
char *fileName = _T2A(xmlGetText(xmlNode));
- if (fileName != NULL) {
+ if (fileName != nullptr) {
szText.AppendFormat(Translate("File transfer:\n\tFile name: %s \n\tSize: %lld bytes \n"), fileName, fileSize);
}
@@ -118,11 +118,11 @@ INT_PTR CSkypeProto::GetEventText(WPARAM pEvent, LPARAM datatype) case SKYPE_DB_EVENT_TYPE_MOJI:
case SKYPE_DB_EVENT_TYPE_URIOBJ:
{
- HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), 0, L"URIObject");
- if (xml != NULL) {
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), nullptr, L"URIObject");
+ if (xml != nullptr) {
//szText.Append(_T2A(xmlGetText(xml)));
HXML xmlA = xmlGetChildByPath(xml, L"a", 0);
- if (xmlA != NULL) {
+ if (xmlA != nullptr) {
szText += T2Utf(xmlGetAttrValue(xmlA, L"href"));
}
xmlDestroyNode(xml);
@@ -151,7 +151,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM pEvent, LPARAM datatype) INT_PTR CSkypeProto::EventGetIcon(WPARAM flags, LPARAM pEvent)
{
DBEVENTINFO *dbei = (DBEVENTINFO*)pEvent;
- HICON icon = NULL;
+ HICON icon = nullptr;
switch (dbei->eventType) {
case SKYPE_DB_EVENT_TYPE_CALL_INFO:
diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index 17efd46bc0..1ce9e54808 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -37,7 +37,7 @@ void CSkypeProto::OnASMObjectCreated(const NETLIBHTTPREQUEST *response, void *ar std::string strObjectId = node["id"].as_string();
fup->uid = mir_strdup(strObjectId.c_str());
FILE *pFile = _wfopen(fup->tszFileName, L"rb");
- if (pFile == NULL) return;
+ if (pFile == nullptr) return;
fseek(pFile, 0, SEEK_END);
long lFileLen = ftell(pFile);
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 3b1f4d55a1..000007dbf3 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (response == nullptr)
return;
JSONNode root = JSONNode::parse(response->pData);
@@ -111,7 +111,7 @@ INT_PTR CSkypeProto::GetContactHistory(WPARAM hContact, LPARAM) void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL)
+ if (response == nullptr || response->pData == nullptr)
return;
JSONNode root = JSONNode::parse(response->pData);
diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index 9064f3c148..0275775124 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -40,7 +40,7 @@ HICON CSkypeProto::GetIcon(int iconId) for (size_t i = 0; i < _countof(Icons); i++)
if (Icons[i].defIconID == iconId)
return IcoLib_GetIconByHandle(Icons[i].hIcolib);
- return 0;
+ return nullptr;
}
HANDLE CSkypeProto::GetIconHandle(int iconId)
@@ -48,5 +48,5 @@ HANDLE CSkypeProto::GetIconHandle(int iconId) for (size_t i = 0; i < _countof(Icons); i++)
if (Icons[i].defIconID == iconId)
return Icons[i].hIcolib;
- return 0;
+ return nullptr;
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 4420ef8f4f..d1b339cc29 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(NULL))
+ if ((tokenExpires - 1800) > time(nullptr))
OnLoginSuccess();
PushRequest(new OAuthRequest(), &CSkypeProto::OnOAuthStart);
@@ -45,7 +45,7 @@ void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) {
if (!IsStatusConnecting(m_iStatus)) return;
- if (response == NULL || response->pData == NULL) {
+ if (response == nullptr || response->pData == nullptr) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -124,7 +124,7 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) m_iStatus++;
- if (response == NULL) {
+ if (response == nullptr) {
debugLogA(__FUNCTION__ ": failed to get create endpoint");
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
@@ -189,7 +189,7 @@ void CSkypeProto::OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response) if (!IsStatusConnecting(m_iStatus))
return;
- if (response == NULL) {
+ if (response == nullptr) {
debugLogA(__FUNCTION__ ": failed to create subscription");
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
@@ -223,7 +223,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) if (!IsStatusConnecting(m_iStatus))
return;
- if (response == NULL || response->pData == NULL) {
+ if (response == nullptr || response->pData == nullptr) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -244,7 +244,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) SendRequest(new LoadChatsRequest(li), &CSkypeProto::OnLoadChats);
SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter);
- PushRequest(new GetContactListRequest(li, NULL), &CSkypeProto::LoadContactList);
+ PushRequest(new GetContactListRequest(li, nullptr), &CSkypeProto::LoadContactList);
PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL);
if (m_opts.bAutoHistorySync)
@@ -254,12 +254,12 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) if (root)
setString("SelfEndpointName", UrlToSkypename(root["selfLink"].as_string().c_str()));
- PushRequest(new GetProfileRequest(li), &CSkypeProto::LoadProfile, NULL);
+ PushRequest(new GetProfileRequest(li), &CSkypeProto::LoadProfile, nullptr);
}
void CSkypeProto::OnStatusChanged(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL) {
+ if (response == nullptr || response->pData == nullptr) {
debugLogA(__FUNCTION__ ": failed to change status");
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 4b92e06afe..c7245ca1a2 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(NULL);
+ param->hMessage = time(nullptr);
ptrA username(getStringA(hContact, "Skypename"));
@@ -75,10 +75,10 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg) HANDLE hMessage = (HANDLE)param->hMessage;
delete param;
- if (response != NULL) {
+ if (response != nullptr) {
if (response->resultCode == 201) {
if (m_OutMessages.getIndex(hMessage) != -1) {
- if (response->pData != NULL) {
+ if (response->pData != nullptr) {
JSONNode jRoot = JSONNode::parse(response->pData);
if (m_mpOutMessages.find(hMessage) == m_mpOutMessages.end()) {
m_mpOutMessages[hMessage] = std::stoull(jRoot["OriginalArrivalTime"].as_string()) / 1000;
@@ -94,7 +94,7 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg) else {
std::string strError = Translate("Unknown error!");
- if (response->pData != NULL) {
+ if (response->pData != nullptr) {
JSONNode jRoot = JSONNode::parse(response->pData);
const JSONNode &jErr = jRoot["errorCode"];
@@ -245,7 +245,7 @@ void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent) void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const char *szContent, const char *szMessageId)
{
- HXML xmlNode = xmlParseString(mir_utf8decodeW(szContent), 0, L"contacts");
+ HXML xmlNode = xmlParseString(mir_utf8decodeW(szContent), nullptr, L"contacts");
if (xmlNode) {
int nCount = 0;
PROTOSEARCHRESULT **psr;
@@ -256,7 +256,7 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const nCount = 0;
for (int i = 0; i < xmlGetChildCount(xmlNode); i++) {
HXML xmlContact = xmlGetNthChild(xmlNode, L"c", i);
- if (xmlContact != NULL) {
+ if (xmlContact != nullptr) {
const wchar_t *tszContactId = xmlGetAttrValue(xmlContact, L"s");
//const wchar_t *tszContactName = xmlGetAttrValue(xmlContact, L"f");
diff --git a/protocols/SkypeWeb/src/skype_mslogin.cpp b/protocols/SkypeWeb/src/skype_mslogin.cpp index dd7a894319..73e05e8221 100644 --- a/protocols/SkypeWeb/src/skype_mslogin.cpp +++ b/protocols/SkypeWeb/src/skype_mslogin.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::OnMSLoginFirst(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL) {
+ if (response == nullptr || response->pData == nullptr) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -56,7 +56,7 @@ void CSkypeProto::OnMSLoginFirst(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnMSLoginSecond(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL) {
+ if (response == nullptr || response->pData == nullptr) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -106,7 +106,7 @@ void CSkypeProto::OnMSLoginSecond(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnMSLoginThird(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL) {
+ if (response == nullptr || response->pData == nullptr) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -130,7 +130,7 @@ void CSkypeProto::OnMSLoginThird(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnMSLoginEnd(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL) {
+ if (response == nullptr || response->pData == nullptr) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -165,7 +165,7 @@ CMStringW CSkypeProto::RunConfirmationCode() ENTER_STRING pForm = { sizeof(pForm) };
pForm.type = ESF_PASSWORD;
pForm.caption = caption;
- pForm.ptszInitVal = NULL;
+ pForm.ptszInitVal = nullptr;
pForm.szModuleName = m_szModuleName;
return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult));
}
diff --git a/protocols/SkypeWeb/src/skype_network.cpp b/protocols/SkypeWeb/src/skype_network.cpp index 4f1e98454c..46a564599b 100644 --- a/protocols/SkypeWeb/src/skype_network.cpp +++ b/protocols/SkypeWeb/src/skype_network.cpp @@ -39,6 +39,6 @@ void CSkypeProto::ShutdownConnections() Netlib_CloseHandle(m_pollingConnection);
Netlib_CloseHandle(m_TrouterConnection);
- m_pollingConnection = m_TrouterConnection = 0;
+ m_pollingConnection = m_TrouterConnection = nullptr;
//Netlib_Shutdown(m_hNetlibUser);
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_oauth.cpp b/protocols/SkypeWeb/src/skype_oauth.cpp index 99d73c7e0c..f198c160ae 100644 --- a/protocols/SkypeWeb/src/skype_oauth.cpp +++ b/protocols/SkypeWeb/src/skype_oauth.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::OnOAuthStart(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; @@ -58,7 +58,7 @@ void CSkypeProto::OnOAuthStart(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnOAuthAuthorize(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; @@ -80,7 +80,7 @@ void CSkypeProto::OnOAuthAuthorize(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnOAuthEnd(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index 00b6c4e57b..4325632571 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -64,8 +64,8 @@ void CSkypeProto::PollingThread(void*) SetStatus(ID_STATUS_OFFLINE);
}
}
- m_hPollingThread = NULL;
- m_pollingConnection = NULL;
+ m_hPollingThread = nullptr;
+ m_pollingConnection = nullptr;
debugLogA(__FUNCTION__ ": leaving");
}
diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index 4babb8941c..b87d31c223 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -77,7 +77,7 @@ void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *messag }
else {
DWORD mtype = MB_OK | MB_SETFOREGROUND | MB_ICONSTOP;
- MessageBox(NULL, message, caption, mtype);
+ MessageBox(nullptr, message, caption, mtype);
}
}
diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 5fda01d573..d0f7304b0a 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -436,7 +436,7 @@ void CSkypeProto::LoadProfile(const NETLIBHTTPREQUEST *response, void *arg) {
MCONTACT hContact = (DWORD_PTR)arg;
- if (response == NULL) {
+ if (response == nullptr) {
ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, 0);
return;
}
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index e1c3368f74..58406f4630 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -67,12 +67,12 @@ CSkypeProto::~CSkypeProto() if (m_hPollingThread) { WaitForSingleObject(m_hPollingThread, INFINITE); - m_hPollingThread = NULL; + m_hPollingThread = nullptr; } if (m_hTrouterThread) { WaitForSingleObject(m_hTrouterThread, INFINITE); - m_hTrouterThread = NULL; + m_hTrouterThread = nullptr; } SkypeUnsetTimer(); @@ -140,7 +140,7 @@ MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) { debugLogA(__FUNCTION__); - if (psr->id.a == NULL) + if (psr->id.a == nullptr) return NULL; MCONTACT hContact; @@ -158,7 +158,7 @@ MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) DBEVENTINFO dbei = {}; if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) return NULL; - if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == NULL) + if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == nullptr) return NULL; if (db_event_get(hDbEvent, &dbei)) return NULL; diff --git a/protocols/SkypeWeb/src/skype_request.cpp b/protocols/SkypeWeb/src/skype_request.cpp index 6be0271352..31ec15960f 100644 --- a/protocols/SkypeWeb/src/skype_request.cpp +++ b/protocols/SkypeWeb/src/skype_request.cpp @@ -43,7 +43,7 @@ void CSkypeProto::PushRequest(HttpRequest *request, SkypeResponseWithArgCallback void CSkypeProto::SendRequest(HttpRequest *request)
{
- requestQueue->Send(request, NULL, NULL);
+ requestQueue->Send(request, nullptr, nullptr);
}
void CSkypeProto::SendRequest(HttpRequest *request, SkypeResponseCallback response)
diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index 0bfcccbad6..e5a311388a 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -35,7 +35,7 @@ void CSkypeProto::SearchBasicThread(void* id) void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response)
{
debugLogA(__FUNCTION__);
- if (response == NULL) {
+ if (response == nullptr) {
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
return;
}
diff --git a/protocols/SkypeWeb/src/skype_timers.cpp b/protocols/SkypeWeb/src/skype_timers.cpp index b3561f3613..3fc9bfb94f 100644 --- a/protocols/SkypeWeb/src/skype_timers.cpp +++ b/protocols/SkypeWeb/src/skype_timers.cpp @@ -23,7 +23,7 @@ mir_cs CSkypeProto::accountsLock; void CSkypeProto::ProcessTimer()
{
if (IsOnline()) {
- PushRequest(new GetContactListRequest(li, NULL), &CSkypeProto::LoadContactList);
+ PushRequest(new GetContactListRequest(li, nullptr), &CSkypeProto::LoadContactList);
SendPresence(false);
}
}
@@ -39,13 +39,13 @@ void CSkypeProto::SkypeSetTimer() {
mir_cslock lck(timerLock);
if (!m_timer)
- m_timer = SetTimer(NULL, 0, 600000, TimerProc);
+ m_timer = SetTimer(nullptr, 0, 600000, TimerProc);
}
void CSkypeProto::SkypeUnsetTimer()
{
mir_cslock lck(timerLock);
if (m_timer && Accounts.getCount() == 0)
- KillTimer(NULL, m_timer);
+ KillTimer(nullptr, m_timer);
m_timer = 0;
}
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index c5c055e213..c8aff831dc 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL) {
+ if (response == nullptr || response->pData == nullptr) {
LBL_Error:
debugLogA("Failed to establish a TRouter connection.");
return;
@@ -49,7 +49,7 @@ LBL_Error: void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL) {
+ if (response == nullptr || response->pData == nullptr) {
LBL_Error:
debugLogA("Failed to establish a TRouter connection.");
return;
@@ -82,7 +82,7 @@ LBL_Error: void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL) {
+ if (response == nullptr || response->pData == nullptr) {
debugLogA("Failed to establish a TRouter connection.");
return;
}
@@ -95,9 +95,9 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response) m_hTrouterEvent.Set();
m_hTrouterHealthEvent.Set();
- if ((time(NULL) - TRouter.lastRegistrationTime) >= 3600) {
+ if ((time(nullptr) - TRouter.lastRegistrationTime) >= 3600) {
SendRequest(new RegisterTrouterRequest(li, TRouter.url.c_str(), TRouter.sessId.c_str()));
- TRouter.lastRegistrationTime = time(NULL);
+ TRouter.lastRegistrationTime = time(nullptr);
}
}
@@ -166,8 +166,8 @@ void CSkypeProto::TRouterThread(void*) SetStatus(ID_STATUS_OFFLINE);
}
}
- m_hTrouterThread = NULL;
- m_TrouterConnection = NULL;
+ m_hTrouterThread = nullptr;
+ m_TrouterConnection = nullptr;
debugLogA(__FUNCTION__": leaving");
}
@@ -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(NULL), DBEF_READ, gp.c_str(), callId.c_str());
+ MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(nullptr), DBEF_READ, gp.c_str(), callId.c_str());
Skin_PlaySound("skype_inc_call");
CLISTEVENT cle = {};
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 2c36178f39..221e657342 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -24,7 +24,7 @@ time_t CSkypeProto::IsoToUnixTime(const char *stamp) char date[9]; int i, y; - if (stamp == NULL) + if (stamp == nullptr) return 0; char *p = NEWSTR_ALLOCA(stamp); @@ -379,7 +379,7 @@ char *CSkypeProto::RemoveHtml(const char *text) if (!entity.empty()) { found = true; errno = 0; - unsigned long value = strtoul(entity.c_str(), NULL, hex ? 16 : 10); + unsigned long value = strtoul(entity.c_str(), nullptr, hex ? 16 : 10); if (errno != 0) { // error with conversion in strtoul, ignore the result found = false; } @@ -471,12 +471,12 @@ bool CSkypeProto::IsFileExists(std::wstring path) CMStringA CSkypeProto::ParseUrl(const char *url, const char *token) { const char *start = strstr(url, token); - if (start == NULL) + if (start == nullptr) return CMStringA(); start = start + mir_strlen(token); const char *end = strchr(start, '/'); - if (end == NULL) + if (end == nullptr) return CMStringA(start); return CMStringA(start, end - start); } @@ -484,12 +484,12 @@ CMStringA CSkypeProto::ParseUrl(const char *url, const char *token) CMStringA CSkypeProto::GetStringChunk(const char *haystack, const char *start, const char *end) { const char *sstart = strstr(haystack, start); - if (sstart == NULL) + if (sstart == nullptr) return CMStringA(); sstart = sstart + mir_strlen(start); const char *send = strstr(sstart, end); - if (send == NULL) + if (send == nullptr) return CMStringA(sstart); return CMStringA(sstart, send - sstart); } @@ -516,14 +516,14 @@ CMStringA CSkypeProto::GetServerFromUrl(const char *url) INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) { wchar_t *arg = (wchar_t *)lParam; - if (arg == NULL) + if (arg == nullptr) return 1; // skip leading prefix wchar_t szUri[1024]; wcsncpy_s(szUri, arg, _TRUNCATE); wchar_t *szJid = wcschr(szUri, ':'); - if (szJid == NULL) + if (szJid == nullptr) return 1; // empty jid? @@ -537,7 +537,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) *(szCommand++) = 0; // parameters - wchar_t *szSecondParam = szCommand ? wcschr(szCommand, '&') : NULL; + wchar_t *szSecondParam = szCommand ? wcschr(szCommand, '&') : nullptr; if (szSecondParam) *(szSecondParam++) = 0; diff --git a/protocols/Steam/src/request_queue.cpp b/protocols/Steam/src/request_queue.cpp index ca721c55e3..84d6414c40 100644 --- a/protocols/Steam/src/request_queue.cpp +++ b/protocols/Steam/src/request_queue.cpp @@ -21,8 +21,8 @@ RequestQueue::RequestQueue(HNETLIBUSER hConnection) : hConnection(hConnection), requests(1)
{
isTerminated = true;
- hRequestQueueThread = NULL;
- hRequestQueueEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hRequestQueueThread = nullptr;
+ hRequestQueueEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
}
RequestQueue::~RequestQueue()
@@ -37,7 +37,7 @@ void RequestQueue::Start() return;
isTerminated = false;
- if (hRequestQueueThread == NULL)
+ if (hRequestQueueThread == nullptr)
hRequestQueueThread = mir_forkthread((pThreadFunc)&RequestQueue::WorkerThread, this);
}
@@ -67,15 +67,15 @@ void RequestQueue::Push(HttpRequest *request, HttpResponseCallback response, voi void RequestQueue::Send(HttpRequest *request, HttpResponseCallback response, void *arg, HttpFinallyCallback last)
{
RequestQueueItem *item = new RequestQueueItem(request, response, arg, last);
- mir_forkthreadowner((pThreadFuncOwner)&RequestQueue::AsyncSendThread, this, item, 0);
+ mir_forkthreadowner((pThreadFuncOwner)&RequestQueue::AsyncSendThread, this, item, nullptr);
}
void RequestQueue::Execute(RequestQueueItem *item)
{
HttpResponse *response = item->request->Send(hConnection);
- if (item->responseCallback != NULL)
+ if (item->responseCallback != nullptr)
item->responseCallback(response, item->arg);
- if (item->finallyCallback != NULL)
+ if (item->finallyCallback != nullptr)
item->finallyCallback(item->arg);
delete item;
delete response;
@@ -100,7 +100,7 @@ unsigned int RequestQueue::WorkerThread(void *arg) WaitForSingleObject(queue->hRequestQueueEvent, INFINITE);
while (true)
{
- RequestQueueItem *item = NULL;
+ RequestQueueItem *item = nullptr;
{
mir_cslock lock(queue->requestQueueLock);
@@ -110,11 +110,11 @@ unsigned int RequestQueue::WorkerThread(void *arg) item = queue->requests[0];
queue->requests.remove(0);
}
- if (item != NULL)
+ if (item != nullptr)
queue->Execute(item);
}
}
- queue->hRequestQueueThread = NULL;
+ queue->hRequestQueueThread = nullptr;
return 0;
}
\ No newline at end of file diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index 2faa102476..a4ed74dd27 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -13,7 +13,7 @@ wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact) if (steamId != NULL)
mir_snwprintf(path, MAX_PATH, L"%s\\%s.jpg", path, _A2T(steamId));
else
- return NULL;
+ return nullptr;
return mir_wstrdup(path);
}
@@ -51,7 +51,7 @@ void CSteamProto::CheckAvatarChange(MCONTACT hContact, std::string avatarUrl) else if (update_required)
{
db_set_b(hContact, "ContactPhoto", "NeedUpdate", 1);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
}
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 1b3620e736..7546f33d40 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -108,7 +108,7 @@ void CSteamProto::UpdateContactDetails(MCONTACT hContact, JSONNode *data) // set name node = json_get(data, "realname"); - if (node != NULL) + if (node != nullptr) { std::wstring realname = (wchar_t*)ptrW(json_as_string(node)); if (!realname.empty()) @@ -140,7 +140,7 @@ void CSteamProto::UpdateContactDetails(MCONTACT hContact, JSONNode *data) // set country node = json_get(data, "loccountrycode"); - if (node != NULL) + if (node != nullptr) { const char *iso = ptrA(mir_u2a(ptrW(json_as_string(node)))); char *country = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)iso, 0); @@ -261,7 +261,7 @@ void CSteamProto::ContactIsRemoved(MCONTACT hContact) // If this contact was authorized and now is not (and isn't filled time of deletion), notify it if (!getDword(hContact, "DeletedTS", 0) && getByte(hContact, "Auth", 0) == 0) { - setDword(hContact, "DeletedTS", ::time(NULL)); + setDword(hContact, "DeletedTS", ::time(nullptr)); ptrW nick(getWStringA(hContact, "Nick")); wchar_t message[MAX_PATH]; @@ -335,7 +335,7 @@ void CSteamProto::ContactIsAskingAuth(MCONTACT hContact) DB_AUTH_BLOB blob(hContact, nickName, firstName, lastName, steamId, reason); PROTORECVEVENT recv = { 0 }; - recv.timestamp = time(NULL); + recv.timestamp = time(nullptr); recv.szMessage = blob; recv.lParam = blob.size(); ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&recv); @@ -395,7 +395,7 @@ void CSteamProto::UpdateContactRelationship(MCONTACT hContact, JSONNode *data) db_set_dw(hContact, "UserInfo", "ContactAddTime", json_as_int(node)); node = json_get(data, "relationship"); - if (node == NULL) + if (node == nullptr) return; ptrA relationship(mir_u2a(ptrW(json_as_string(node)))); @@ -419,7 +419,7 @@ void CSteamProto::OnGotFriendList(const HttpResponse *response) return; JSONROOT root(response->pData); - if (root == NULL) + if (root == nullptr) return; std::string steamIds = (char*)ptrA(getStringA("SteamID")); @@ -429,16 +429,16 @@ void CSteamProto::OnGotFriendList(const HttpResponse *response) // Remember contacts on server JSONNode *node = json_get(root, "friends"); JSONNode *nroot = json_as_array(node); - if (nroot != NULL) + if (nroot != nullptr) { for (size_t i = 0; i < json_size(nroot); i++) { JSONNode *child = json_at(nroot, i); - if (child == NULL) + if (child == nullptr) break; node = json_get(child, "steamid"); - if (node == NULL) + if (node == nullptr) continue; std::string steamId = (char*)_T2A(ptrW(json_as_string(node))); @@ -515,19 +515,19 @@ void CSteamProto::OnGotBlockList(const HttpResponse *response) return; JSONROOT root(response->pData); - if (root == NULL) + if (root == nullptr) return; //std::string steamIds; JSONNode *node = json_get(root, "friends"); JSONNode *nroot = json_as_array(node); - if (nroot != NULL) + if (nroot != nullptr) { for (size_t i = 0; i < json_size(nroot); i++) { JSONNode *child = json_at(nroot, i); - if (child == NULL) + if (child == nullptr) break; node = json_get(child, "steamid"); @@ -559,17 +559,17 @@ void CSteamProto::OnGotUserSummaries(const HttpResponse *response) return; JSONROOT root(response->pData); - if (root == NULL) + if (root == nullptr) return; JSONNode *node = json_get(root, "players"); JSONNode *nroot = json_as_array(node); - if (nroot != NULL) + if (nroot != nullptr) { for (size_t i = 0; i < json_size(nroot); i++) { JSONNode *item = json_at(nroot, i); - if (item == NULL) + if (item == nullptr) break; node = json_get(item, "steamid"); @@ -659,7 +659,7 @@ void CSteamProto::OnFriendRemoved(const HttpResponse *response, void *arg) } setByte(hContact, "Auth", 1); - setDword(hContact, "DeletedTS", ::time(NULL)); + setDword(hContact, "DeletedTS", ::time(nullptr)); } void CSteamProto::OnAuthRequested(const HttpResponse *response, void *arg) @@ -671,14 +671,14 @@ void CSteamProto::OnAuthRequested(const HttpResponse *response, void *arg) } JSONROOT root(response->pData); - if (root == NULL) + if (root == nullptr) return; JSONNode *node = json_get(root, "players"); JSONNode *nodes = json_as_array(node); JSONNode *nroot = json_at(nodes, 0); - if (nroot != NULL) + if (nroot != nullptr) { node = json_get(nroot, "steamid"); ptrA steamId(mir_u2a(ptrW(json_as_string(node)))); @@ -702,7 +702,7 @@ void CSteamProto::OnPendingApproved(const HttpResponse *response, void *arg) } JSONROOT root(response->pData); - if (root == NULL) + if (root == nullptr) return; JSONNode *node = json_get(root, "success"); @@ -722,7 +722,7 @@ void CSteamProto::OnPendingIgnoreded(const HttpResponse *response, void *arg) } JSONROOT root(response->pData); - if (root == NULL) + if (root == nullptr) return; JSONNode *node = json_get(root, "success"); @@ -745,7 +745,7 @@ void CSteamProto::OnSearchResults(const HttpResponse *response, void *arg) } JSONROOT root(response->pData); - if (root == NULL) + if (root == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, searchType, 0); return; @@ -753,12 +753,12 @@ void CSteamProto::OnSearchResults(const HttpResponse *response, void *arg) JSONNode *node = json_get(root, "players"); JSONNode *nroot = json_as_array(node); - if (nroot != NULL) + if (nroot != nullptr) { for (size_t i = 0; i < json_size(nroot); i++) { JSONNode *child = json_at(nroot, i); - if (child == NULL) + if (child == nullptr) break; STEAM_SEARCH_RESULT ssr = { 0 }; @@ -772,7 +772,7 @@ void CSteamProto::OnSearchResults(const HttpResponse *response, void *arg) ssr.hdr.nick.w = mir_wstrdup(ptrW(json_as_string(node))); node = json_get(child, "realname"); - if (node != NULL) + if (node != nullptr) { std::wstring realname = (wchar_t*)ptrW(json_as_string(node)); if (!realname.empty()) @@ -810,7 +810,7 @@ void CSteamProto::OnSearchByNameStarted(const HttpResponse *response, void *arg) } JSONROOT root(response->pData); - if (root == NULL) + if (root == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)arg, 0); return; @@ -824,16 +824,16 @@ void CSteamProto::OnSearchByNameStarted(const HttpResponse *response, void *arg) JSONNode *node = json_get(root, "results"); JSONNode *nroot = json_as_array(node); - if (nroot != NULL) + if (nroot != nullptr) { for (size_t i = 0; i < json_size(nroot); i++) { JSONNode *child = json_at(nroot, i); - if (child == NULL) + if (child == nullptr) break; node = json_get(child, "steamid"); - if (node == NULL) + if (node == nullptr) continue; std::string steamId = (char*)_T2A(ptrW(json_as_string(node))); diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp index c3099c67c6..c3e3b71931 100644 --- a/protocols/Steam/src/steam_dialogs.cpp +++ b/protocols/Steam/src/steam_dialogs.cpp @@ -20,7 +20,7 @@ void CSteamPasswordEditor::OnInitDialog() void CSteamPasswordEditor::OnOk(CCtrlButton*)
{
- if (m_proto->password != NULL)
+ if (m_proto->password != nullptr)
mir_free(m_proto->password);
m_proto->password = m_password.GetText();
if (m_savePermanently.Enabled())
@@ -117,7 +117,7 @@ const char* CSteamTwoFactorDialog::GetTwoFactorCode() CSteamCaptchaDialog::CSteamCaptchaDialog(CSteamProto *proto, BYTE *captchaImage, int captchaImageSize)
: CSteamDlgBase(proto, IDD_CAPTCHA, false),
m_ok(this, IDOK), m_text(this, IDC_TEXT),
- m_captchaImage(NULL)
+ m_captchaImage(nullptr)
{
memset(m_captchaText, 0, sizeof(m_captchaText));
m_captchaImageSize = captchaImageSize;
@@ -158,14 +158,14 @@ INT_PTR CSteamCaptchaDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) {
if (msg == WM_PAINT)
{
- FI_INTERFACE *fei = 0;
+ FI_INTERFACE *fei = nullptr;
INT_PTR result = CALLSERVICE_NOTFOUND;
if (ServiceExists(MS_IMG_GETINTERFACE))
result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei);
- if (fei == NULL || result != S_OK) {
- MessageBox(0, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar Service"), MB_OK);
+ if (fei == nullptr || result != S_OK) {
+ MessageBox(nullptr, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar Service"), MB_OK);
return 0;
}
diff --git a/protocols/Steam/src/steam_events.cpp b/protocols/Steam/src/steam_events.cpp index db3b5a054c..3697689ca4 100644 --- a/protocols/Steam/src/steam_events.cpp +++ b/protocols/Steam/src/steam_events.cpp @@ -69,7 +69,7 @@ int CSteamProto::OnIdleChanged(WPARAM, LPARAM lParam) CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii); // Compute time when user really became idle - m_idleTS = time(0) - mii.idleTime * 60; + m_idleTS = time(nullptr) - mii.idleTime * 60; setDword("IdleTS", m_idleTS); } else diff --git a/protocols/Steam/src/steam_history.cpp b/protocols/Steam/src/steam_history.cpp index 61b9ae6019..3b62aa21bc 100644 --- a/protocols/Steam/src/steam_history.cpp +++ b/protocols/Steam/src/steam_history.cpp @@ -10,14 +10,14 @@ void CSteamProto::OnGotConversations(const HttpResponse *response) return; JSONROOT root(response->pData); - if (root == NULL) + if (root == nullptr) return; JSONNode *node = json_get(root, "response"); JSONNode *sessions = json_get(node, "message_sessions"); JSONNode *nsessions = json_as_array(sessions); - if (nsessions != NULL) + if (nsessions != nullptr) { ptrA token(getStringA("TokenSecret")); ptrA steamId(getStringA("SteamID")); @@ -63,7 +63,7 @@ void CSteamProto::OnGotHistoryMessages(const HttpResponse *response, void *arg) return; JSONROOT root(response->pData); - if (root == NULL) + if (root == nullptr) return; JSONNode *node = json_get(root, "response"); diff --git a/protocols/Steam/src/steam_instances.cpp b/protocols/Steam/src/steam_instances.cpp index d535e53b09..82da33d4bc 100644 --- a/protocols/Steam/src/steam_instances.cpp +++ b/protocols/Steam/src/steam_instances.cpp @@ -33,12 +33,12 @@ void CSteamProto::UninitProtoInstances() CSteamProto* CSteamProto::GetContactProtoInstance(MCONTACT hContact)
{
char *proto = GetContactProto(hContact);
- if (proto == NULL)
- return NULL;
+ if (proto == nullptr)
+ return nullptr;
for (int i = 0; i < InstanceList.getCount(); i++)
if (!mir_strcmp(proto, InstanceList[i]->m_szModuleName))
return InstanceList[i];
- return NULL;
+ return nullptr;
}
\ No newline at end of file diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp index 1c68e5c647..2f883517e9 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -27,7 +27,7 @@ bool CSteamProto::Relogin() if (CheckResponse(response)) { JSONROOT root(response->pData); - if (root != NULL) { + if (root != nullptr) { JSONNode *node = json_get(root, "error"); ptrW error(json_as_string(node)); @@ -75,7 +75,7 @@ void CSteamProto::OnGotRsaKey(const HttpResponse *response) DWORD error = 0; DWORD encryptedSize = 0; - if ((error = RsaEncrypt(modulus.c_str(), szPassword, NULL, encryptedSize)) != 0) + if ((error = RsaEncrypt(modulus.c_str(), szPassword, nullptr, encryptedSize)) != 0) { debugLogA("CSteamProto::OnGotRsaKey: encryption error (%lu)", error); return; @@ -400,5 +400,5 @@ void CSteamProto::OnLoggedOn(const HttpResponse *response) ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus = m_iDesiredStatus); // start polling thread - m_hPollingThread = ForkThreadEx(&CSteamProto::PollingThread, 0, NULL); + m_hPollingThread = ForkThreadEx(&CSteamProto::PollingThread, nullptr, nullptr); }
\ No newline at end of file diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index 9a4430882d..78d675f088 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -110,7 +110,7 @@ void CSteamProto::OnInitStatusMenu() void CSteamProto::InitMenus()
{
- hChooserMenu = Menu_AddObject("SteamAccountChooser", LPGEN("Steam menu chooser"), 0, "Steam/MenuChoose");
+ hChooserMenu = Menu_AddObject("SteamAccountChooser", LPGEN("Steam menu chooser"), nullptr, "Steam/MenuChoose");
//////////////////////////////////////////////////////////////////////////////////////
// Contact menu initialization
@@ -142,7 +142,7 @@ void CSteamProto::InitMenus() mi.pszService = MODULE "/JoinToGame";
mi.name.w = LPGENW("Join to game");
mi.position = -200001000 + CMI_JOIN_GAME;
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
contactMenuItems[CMI_JOIN_GAME] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&CSteamProto::JoinToGameCommand>);
}
diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index 49407e4e59..ac768f09f7 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -4,7 +4,7 @@ void CSteamProto::ParsePollData(JSONNode *data) { - JSONNode *node, *item = NULL; + JSONNode *node, *item = nullptr; // FIXME: Temporary solution for receivng too many duplicated typing events; should be reworked better std::string typingUser; @@ -13,7 +13,7 @@ void CSteamProto::ParsePollData(JSONNode *data) for (size_t i = 0; i < json_size(data); i++) { item = json_at(data, i); - if (item == NULL) + if (item == nullptr) break; node = json_get(item, "steamid_from"); @@ -38,7 +38,7 @@ void CSteamProto::ParsePollData(JSONNode *data) PROTORECVEVENT recv = { 0 }; recv.timestamp = timestamp; recv.szMessage = szMessage; - if (wcsstr(type, L"my_") == NULL) + if (wcsstr(type, L"my_") == nullptr) { ProtoChainRecvMsg(hContact, &recv); } @@ -169,7 +169,7 @@ void CSteamProto::ParsePollData(JSONNode *data) dbei.cbBlob = 1; dbei.eventType = EVENTTYPE_STEAM_CHATSTATES; dbei.flags = DBEF_READ; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.szModule = m_szModuleName; db_event_add(hContact, &dbei); } @@ -217,7 +217,7 @@ void CSteamProto::PollingThread(void*) ptrA body((char*)mir_calloc(response->dataLength + 2)); mir_strncpy(body, response->pData, response->dataLength + 1); JSONROOT root(body); - if (root == NULL) + if (root == nullptr) { errors++; } @@ -241,7 +241,7 @@ void CSteamProto::PollingThread(void*) node = json_get(root, "messages"); JSONNode *nroot = json_as_array(node); - if (nroot != NULL) + if (nroot != nullptr) { ParsePollData(nroot); json_delete(nroot); @@ -307,6 +307,6 @@ void CSteamProto::PollingThread(void*) SetStatus(ID_STATUS_OFFLINE); } - m_hPollingThread = NULL; + m_hPollingThread = nullptr; debugLogW(L"CSteamProto::PollingThread: leaving"); } diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 5ea69328b8..e5fd1b3b89 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -9,9 +9,9 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) m_idleTS = 0; m_lastMessageTS = 0; isLoginAgain = false; - m_hQueueThread = NULL; - m_pollingConnection = NULL; - m_hPollingThread = NULL; + m_hQueueThread = nullptr; + m_pollingConnection = nullptr; + m_hPollingThread = nullptr; // icons wchar_t filePath[MAX_PATH]; @@ -23,7 +23,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) char settingName[100]; mir_snprintf(settingName, "%s_%s", MODULE, "main"); - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.flags = SIDF_ALL_UNICODE; sid.defaultFile.w = filePath; sid.pszName = settingName; @@ -225,7 +225,7 @@ DWORD_PTR CSteamProto:: GetCaps(int type, MCONTACT) HANDLE CSteamProto::SearchBasic(const wchar_t* id) { if (!this->IsOnline()) - return 0; + return nullptr; ptrA token(getStringA("TokenSecret")); ptrA steamId(mir_u2a(id)); @@ -241,7 +241,7 @@ HANDLE CSteamProto::SearchBasic(const wchar_t* id) HANDLE CSteamProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName) { if (!this->IsOnline()) - return 0; + return nullptr; // Combine all fields to single text wchar_t keywordsT[200]; @@ -262,7 +262,7 @@ int CSteamProto::SendMsg(MCONTACT hContact, int, const char *message) { if (!IsOnline()) { - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("You cannot send messages when you are offline.")); + ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)Translate("You cannot send messages when you are offline.")); return 0; } diff --git a/protocols/Steam/src/steam_request.cpp b/protocols/Steam/src/steam_request.cpp index 0254d16db6..508552e232 100644 --- a/protocols/Steam/src/steam_request.cpp +++ b/protocols/Steam/src/steam_request.cpp @@ -13,17 +13,17 @@ private: public:
SteamResponseDelegate(CSteamProto *proto, SteamResponseCallback responseCallback)
- : proto(proto), responseCallback(responseCallback), responseWithArgCallback(NULL), arg(NULL), httpFinallyCallback(NULL), hasArg(false) {}
+ : proto(proto), responseCallback(responseCallback), responseWithArgCallback(nullptr), arg(nullptr), httpFinallyCallback(nullptr), hasArg(false) {}
SteamResponseDelegate(CSteamProto *proto, SteamResponseWithArgCallback responseCallback, void *arg, HttpFinallyCallback httpFinallyCallback)
- : proto(proto), responseCallback(NULL), responseWithArgCallback(responseCallback), arg(arg), httpFinallyCallback(httpFinallyCallback), hasArg(true) { }
+ : proto(proto), responseCallback(nullptr), responseWithArgCallback(responseCallback), arg(arg), httpFinallyCallback(httpFinallyCallback), hasArg(true) { }
void Invoke(const HttpResponse *response)
{
if (hasArg)
{
(proto->*(responseWithArgCallback))(response, arg);
- if (httpFinallyCallback != NULL)
+ if (httpFinallyCallback != nullptr)
httpFinallyCallback(arg);
}
else
diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index 1f3cfdfa8e..4723eb7fd9 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -52,14 +52,14 @@ int CSteamProto::RsaEncrypt(const char *pszModulus, const char *data, BYTE *encr {
DWORD cchModulus = (DWORD)mir_strlen(pszModulus);
int result = 0;
- BYTE *pbBuffer = 0;
- BYTE *pKeyBlob = 0;
+ BYTE *pbBuffer = nullptr;
+ BYTE *pKeyBlob = nullptr;
HCRYPTKEY phKey = 0;
HCRYPTPROV hCSP = 0;
// convert hex string to byte array
DWORD cbLen = 0, dwSkip = 0, dwFlags = 0;
- if (!CryptStringToBinaryA(pszModulus, cchModulus, CRYPT_STRING_HEX, NULL, &cbLen, &dwSkip, &dwFlags))
+ if (!CryptStringToBinaryA(pszModulus, cchModulus, CRYPT_STRING_HEX, nullptr, &cbLen, &dwSkip, &dwFlags))
{
result = GetLastError();
goto exit;
@@ -81,8 +81,8 @@ int CSteamProto::RsaEncrypt(const char *pszModulus, const char *data, BYTE *encr pbBuffer[i] = temp;
}
- if (!CryptAcquireContext(&hCSP, NULL, NULL, PROV_RSA_AES, CRYPT_SILENT) &&
- !CryptAcquireContext(&hCSP, NULL, NULL, PROV_RSA_AES, CRYPT_SILENT | CRYPT_NEWKEYSET))
+ if (!CryptAcquireContext(&hCSP, nullptr, nullptr, PROV_RSA_AES, CRYPT_SILENT) &&
+ !CryptAcquireContext(&hCSP, nullptr, nullptr, PROV_RSA_AES, CRYPT_SILENT | CRYPT_NEWKEYSET))
{
result = GetLastError();
goto exit;
@@ -121,10 +121,10 @@ int CSteamProto::RsaEncrypt(const char *pszModulus, const char *data, BYTE *encr DWORD dataSize = (DWORD)mir_strlen(data);
// if data is not allocated just renurn size
- if (encryptedData == NULL)
+ if (encryptedData == nullptr)
{
// get length of encrypted data
- if (!CryptEncrypt(phKey, 0, TRUE, 0, NULL, &encryptedSize, dataSize))
+ if (!CryptEncrypt(phKey, 0, TRUE, 0, nullptr, &encryptedSize, dataSize))
result = GetLastError();
goto exit;
}
@@ -176,7 +176,7 @@ void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *messag return;
}
- MessageBox(NULL, message, caption, MB_OK | flags);
+ MessageBox(nullptr, message, caption, MB_OK | flags);
}
void CSteamProto::ShowNotification(const wchar_t *message, int flags, MCONTACT hContact)
diff --git a/protocols/Steam/src/steam_xstatus.cpp b/protocols/Steam/src/steam_xstatus.cpp index bf6812cad4..dc7bf6024d 100644 --- a/protocols/Steam/src/steam_xstatus.cpp +++ b/protocols/Steam/src/steam_xstatus.cpp @@ -22,7 +22,7 @@ void SetContactExtraIcon(MCONTACT hContact, int status) char iconName[100]; mir_snprintf(iconName, "%s_%s", MODULE, "gaming"); - ExtraIcon_SetIcon(hExtraXStatus, hContact, (status > 0) ? IcoLib_GetIconHandle(iconName) : NULL); + ExtraIcon_SetIcon(hExtraXStatus, hContact, (status > 0) ? IcoLib_GetIconHandle(iconName) : nullptr); } INT_PTR CSteamProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam) @@ -40,7 +40,7 @@ INT_PTR CSteamProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam) // fill status name member if (pData->flags & CSSF_MASK_NAME) { - int status = (pData->wParam == NULL) ? GetContactXStatus(hContact) : *pData->wParam; + int status = (pData->wParam == nullptr) ? GetContactXStatus(hContact) : *pData->wParam; if (status < 1) return 1; @@ -93,7 +93,7 @@ INT_PTR CSteamProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam) HICON CSteamProto::GetXStatusIcon(int status, UINT flags) { if (status < 1) - return 0; + return nullptr; char iconName[100]; mir_snprintf(iconName, "%s_%s", MODULE, "gaming"); diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index db1a4bbfb1..452a641a0a 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -86,16 +86,16 @@ HANDLE GetIconHandle(int iconId) if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
HICON GetIcolibIcon(int iconId)
{
HANDLE handle = GetIconHandle(iconId);
- if (handle != NULL)
+ if (handle != nullptr)
return IcoLib_GetIconByHandle(handle);
- return NULL;
+ return nullptr;
}
void ReleaseIcolibIcon(HICON hIcon)
@@ -115,7 +115,7 @@ int TlenProtocol::PrebuildContactMenu(WPARAM hContact, LPARAM) if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
TLEN_LIST_ITEM *item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal);
db_free(&dbv);
- if (item != NULL) {
+ if (item != nullptr) {
Menu_ShowItem(hMenuContactRequestAuth, item->subscription == SUB_NONE || item->subscription == SUB_FROM);
Menu_ShowItem(hMenuContactGrantAuth, item->subscription == SUB_NONE || item->subscription == SUB_TO);
Menu_ShowItem(hMenuContactMUC, item->status != ID_STATUS_OFFLINE);
@@ -171,7 +171,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM, LPARAM) NETLIBHTTPREQUEST req;
NETLIBHTTPHEADER headers[2];
NETLIBHTTPREQUEST *resp;
- char *login = NULL, *password = NULL;
+ char *login = nullptr, *password = nullptr;
char form[1024];
char cookie[1024];
if (!db_get(NULL, m_szModuleName, "LoginName", &dbv)) {
@@ -181,11 +181,11 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM, LPARAM) if (db_get_b(NULL, m_szModuleName, "SavePassword", TRUE) == TRUE)
password = db_get_sa(NULL, m_szModuleName, "Password");
- else if (threadData != NULL && mir_strlen(threadData->password) > 0)
+ else if (threadData != nullptr && mir_strlen(threadData->password) > 0)
password = mir_strdup(threadData->password);
memset(&cookie, 0, sizeof(cookie));
- if (login != NULL && password != NULL) {
+ if (login != nullptr && password != nullptr) {
mir_snprintf(form, "username=%s&password=%s", login, password);
headers[0].szName = "Content-Type";
headers[0].szValue = "application/x-www-form-urlencoded";
@@ -199,16 +199,16 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM, LPARAM) req.dataLength = (int)mir_strlen(form);
req.szUrl = "http://poczta.o2.pl/login.html";
resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
- if (resp != NULL) {
+ if (resp != nullptr) {
if (resp->resultCode / 100 == 2 || resp->resultCode == 302) {
int i;
for (i = 0; i < resp->headersCount; i++) {
if (strcmpi(resp->headers[i].szName, "Set-Cookie") == 0) {
char *start = strstr(resp->headers[i].szValue, "ssid=");
- if (start != NULL) {
+ if (start != nullptr) {
char *end = strstr(resp->headers[i].szValue, ";");
start = start + 5;
- if (end == NULL) {
+ if (end == nullptr) {
end = resp->headers[i].szValue + mir_strlen(resp->headers[i].szValue);
}
strncpy(cookie, start, (end - start));
@@ -260,7 +260,7 @@ void TlenProtocol::initMenuItems() mi.root = hMenuRoot = Menu_CreateRoot(MO_MAIN, m_tszUserName, -1999901009, GetIconHandle(IDI_TLEN));
mi.pszService = text;
- hMenuChats = NULL;
+ hMenuChats = nullptr;
// "Multi-User Conference"
SET_UID(mi,0x4984828, 0x2066, 0x43da, 0x87, 0x9e, 0x71, 0x23, 0xc6, 0xe2, 0x46, 0xd5);
@@ -282,7 +282,7 @@ void TlenProtocol::initMenuItems() hMenuInbox = Menu_AddMainMenuItem(&mi);
// contact menu items
- mi.root = NULL;
+ mi.root = nullptr;
// "Send picture"
SET_UID(mi, 0x12c66fb1, 0x6e57, 0x4acd, 0x90, 0x16, 0xc, 0x83, 0xae, 0x16, 0xe3, 0x12);
@@ -349,7 +349,7 @@ extern "C" int __declspec(dllexport) Load(void) DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0);
- srand((unsigned)time(NULL));
+ srand((unsigned)time(nullptr));
TlenRegisterIcons();
diff --git a/protocols/Tlen/src/tlen_advsearch.cpp b/protocols/Tlen/src/tlen_advsearch.cpp index 62ee5cde41..a8fe15d789 100644 --- a/protocols/Tlen/src/tlen_advsearch.cpp +++ b/protocols/Tlen/src/tlen_advsearch.cpp @@ -32,7 +32,7 @@ static void InitComboBox(HWND hwndCombo, TLEN_FIELD_MAP *fieldMap) SendMessage(hwndCombo, CB_SETITEMDATA, n, 0);
SendMessage(hwndCombo, CB_SETCURSEL, n, 0);
for (i=0;;i++) {
- if (fieldMap[i].name == NULL)
+ if (fieldMap[i].name == nullptr)
break;
n = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) TranslateW(fieldMap[i].name));
SendMessage(hwndCombo, CB_SETITEMDATA, n, fieldMap[i].id);
@@ -59,12 +59,12 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i char text[512];
char *localFieldName, *localText;
- if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
+ if (hwndDlg == nullptr || fieldName == nullptr || str == nullptr || strSize == nullptr)
return;
GetDlgItemTextA(hwndDlg, idCtrl, text, _countof(text));
if (text[0]) {
- if ((localFieldName=TlenTextEncode(fieldName)) != NULL) {
- if ((localText=TlenTextEncode(text)) != NULL) {
+ if ((localFieldName=TlenTextEncode(fieldName)) != nullptr) {
+ if ((localText=TlenTextEncode(text)) != nullptr) {
TlenStringAppend(str, strSize, "<%s>%s</%s>", localFieldName, localText, localFieldName);
mir_free(localText);
}
@@ -78,11 +78,11 @@ static void FetchCombo(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i int value;
char *localFieldName;
- if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
+ if (hwndDlg == nullptr || fieldName == nullptr || str == nullptr || strSize == nullptr)
return;
value = (int) SendDlgItemMessage(hwndDlg, idCtrl, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, idCtrl, CB_GETCURSEL, 0, 0), 0);
if (value > 0) {
- if ((localFieldName=TlenTextEncode(fieldName)) != NULL) {
+ if ((localFieldName=TlenTextEncode(fieldName)) != nullptr) {
TlenStringAppend(str, strSize, "<%s>%d</%s>", localFieldName, value, localFieldName);
mir_free(localFieldName);
}
@@ -94,8 +94,8 @@ char *TlenAdvSearchCreateQuery(HWND hwndDlg, int) char *str;
int strSize;
- if (hwndDlg == NULL) return NULL;
- str = NULL;
+ if (hwndDlg == nullptr) return nullptr;
+ str = nullptr;
FetchField(hwndDlg, IDC_FIRSTNAME, "first", &str, &strSize);
FetchField(hwndDlg, IDC_LASTNAME, "last", &str, &strSize);
FetchField(hwndDlg, IDC_NICK, "nick", &str, &strSize);
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index 3689a8bb75..998265a326 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -49,15 +49,15 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, wchar_t* p int format = PA_FORMAT_PNG; ptszDest[tPathLen++] = '\\'; - if (item != NULL) + if (item != nullptr) format = item->avatarFormat; - else if (proto->threadData != NULL) + else if (proto->threadData != nullptr) format = proto->threadData->avatarFormat; else format = db_get_dw(NULL, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN); const wchar_t *tszFileType = ProtoGetAvatarExtension(format); - if (item != NULL) + if (item != nullptr) mir_snwprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S%s"), ptrA(TlenSha1(item->jid)), tszFileType); else mir_snwprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S_avatar%s"), proto->m_szModuleName, tszFileType); @@ -69,12 +69,12 @@ static void RemoveAvatar(TlenProtocol *proto, MCONTACT hContact) if (hContact == NULL) proto->threadData->avatarHash[0] = '\0'; - TlenGetAvatarFileName(proto, NULL, tFileName, _countof(tFileName) - 1); + TlenGetAvatarFileName(proto, nullptr, tFileName, _countof(tFileName) - 1); DeleteFile(tFileName); db_unset(hContact, "ContactPhoto", "File"); db_unset(hContact, proto->m_szModuleName, "AvatarHash"); db_unset(hContact, proto->m_szModuleName, "AvatarFormat"); - ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); + ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0); } static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *item, char *data, int len, DWORD format) @@ -92,7 +92,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it mir_md5_finish(&ctx, (BYTE*)digest); sprintf(md5, "%08x%08x%08x%08x", (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3])); //!!!!!!!!!!!!!! - if (item != NULL) { + if (item != nullptr) { char *hash = item->avatarHash; item->avatarFormat = format; item->avatarHash = mir_strdup(md5); @@ -105,7 +105,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it TlenGetAvatarFileName(proto, item, filename, _countof(filename) - 1); DeleteFile(filename); FILE *out = _wfopen(filename, TEXT("wb")); - if (out != NULL) { + if (out != nullptr) { fwrite(data, len, 1, out); fclose(out); db_set_ws(hContact, "ContactPhoto", "File", filename); @@ -119,36 +119,36 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it proto->debugLogW(buffer); return; } - ProtoBroadcastAck(proto->m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); + ProtoBroadcastAck(proto->m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0); } int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_ITEM *item) { XmlNode *aNode; - char *oldHash = NULL; - char *md5 = NULL, *type = NULL; + char *oldHash = nullptr; + char *md5 = nullptr, *type = nullptr; MCONTACT hContact = NULL; - if (item != NULL) + if (item != nullptr) if ((hContact = TlenHContactFromJID(proto, item->jid)) == NULL) return 0; - if (item == NULL) + if (item == nullptr) oldHash = proto->threadData->avatarHash; else oldHash = item->avatarHash; - if (avatarNode != NULL) { + if (avatarNode != nullptr) { aNode = TlenXmlGetChild(avatarNode, "a"); - if (aNode != NULL) { + if (aNode != nullptr) { type = TlenXmlGetAttrValue(aNode, "type"); md5 = TlenXmlGetAttrValue(aNode, "md5"); } } - if (md5 != NULL) { + if (md5 != nullptr) { /* check contact's avatar hash - md5 */ - if (oldHash == NULL || mir_strcmp(oldHash, md5)) { - if (item != NULL) { + if (oldHash == nullptr || mir_strcmp(oldHash, md5)) { + if (item != nullptr) { item->newAvatarDownloading = TRUE; } TlenGetAvatar(proto, hContact); @@ -157,9 +157,9 @@ int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_IT } else { /* remove avatar */ - if (oldHash != NULL) { - if (item != NULL) { - item->avatarHash = NULL; + if (oldHash != nullptr) { + if (item != nullptr) { + item->avatarHash = nullptr; mir_free(oldHash); item->newAvatarDownloading = FALSE; } @@ -237,10 +237,10 @@ struct TLENGETAVATARTHREADDATA static void TlenGetAvatarThread(void *ptr) { - TLEN_LIST_ITEM *item = NULL; + TLEN_LIST_ITEM *item = nullptr; TLENGETAVATARTHREADDATA *data = (TLENGETAVATARTHREADDATA *)ptr; MCONTACT hContact = data->hContact; - char *login = NULL; + char *login = nullptr; if (hContact != NULL) { char *jid = TlenJIDFromHContact(data->proto, hContact); login = TlenNickFromJID(jid); @@ -248,13 +248,13 @@ static void TlenGetAvatarThread(void *ptr) mir_free(jid); } else { - if (data->proto->threadData != NULL) + if (data->proto->threadData != nullptr) login = mir_strdup(data->proto->threadData->username); } - if ((data->proto->threadData != NULL && hContact == NULL) || item != NULL) { + if ((data->proto->threadData != nullptr && hContact == NULL) || item != nullptr) { DWORD format = PA_FORMAT_UNKNOWN; - if (item != NULL) + if (item != nullptr) item->newAvatarDownloading = TRUE; char *request = replaceTokens(data->proto->threadData->tlenConfig.mailBase, data->proto->threadData->tlenConfig.avatarGet, login, data->proto->threadData->avatarToken, 0, 0); @@ -264,14 +264,14 @@ static void TlenGetAvatarThread(void *ptr) req.requestType = data->proto->threadData->tlenConfig.avatarGetMthd; req.flags = 0; req.headersCount = 0; - req.headers = NULL; + req.headers = nullptr; req.dataLength = 0; req.szUrl = request; NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(data->proto->m_hNetlibUser, &req); - if (item != NULL) + if (item != nullptr) item->newAvatarDownloading = FALSE; - if (resp != NULL) { + if (resp != nullptr) { if (resp->resultCode/100 == 2) { if (resp->dataLength > 0) { for (int i=0; i<resp->headersCount; i++ ) { @@ -326,7 +326,7 @@ static void TlenRemoveAvatarRequestThread(void *ptr) { mir_free(req->headers); mir_free(req->pData); mir_free(req); - if (resp != NULL) { + if (resp != nullptr) { Netlib_FreeHttpRequest(resp); RemoveAvatar(data->proto, NULL); } @@ -344,7 +344,7 @@ struct TLENUPLOADAVATARTHREADDATA boolean checkUploadAvatarResponse(TlenProtocol *proto, NETLIBHTTPREQUEST *resp) { - if (resp == NULL) { + if (resp == nullptr) { proto->debugLogA("Error while setting avatar on Tlen account (no response)"); PUShowMessageT(TranslateT("Error while setting avatar on Tlen account (no response)"), SM_WARNING); return false; @@ -369,7 +369,7 @@ static void TlenUploadAvatarRequestThread(void *ptr) NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(data->proto->m_hNetlibUser, req); if (checkUploadAvatarResponse(data->proto, resp)) { Netlib_FreeHttpRequest(resp); - SetAvatar(data->proto, NULL, NULL, data->data, data->length, PA_FORMAT_PNG); + SetAvatar(data->proto, NULL, nullptr, data->data, data->length, PA_FORMAT_PNG); } mir_free(req->szUrl); mir_free(req->headers); @@ -381,7 +381,7 @@ static void TlenUploadAvatarRequestThread(void *ptr) void TlenRemoveAvatar(TlenProtocol *proto) { - if (proto->threadData != NULL) { + if (proto->threadData != nullptr) { TLENREMOVEAVATARTHREADDATA *data = (TLENREMOVEAVATARTHREADDATA *)mir_alloc(sizeof(TLENREMOVEAVATARTHREADDATA)); NETLIBHTTPREQUEST *req = (NETLIBHTTPREQUEST *)mir_alloc(sizeof(NETLIBHTTPREQUEST)); data->proto = proto; @@ -399,7 +399,7 @@ void TlenUploadAvatar(TlenProtocol *proto, unsigned char *data, int dataLen, int { NETLIBHTTPHEADER *headers; unsigned char *buffer; - if (proto->threadData != NULL && dataLen > 0 && data != NULL) { + if (proto->threadData != nullptr && dataLen > 0 && data != nullptr) { char *mpartHead = "--AaB03x\r\nContent-Disposition: form-data; name=\"filename\"; filename=\"plik.png\"\r\nContent-Type: image/png\r\n\r\n"; char *mpartTail = "\r\n--AaB03x--\r\n"; int size, sizeHead = (int)mir_strlen(mpartHead), sizeTail = (int)mir_strlen(mpartTail); diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index f97e6f1b19..d80baba3e6 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -31,10 +31,10 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft) {
int i;
char *p;
- TLEN_FILE_PACKET *rpacket = NULL, *packet;
+ TLEN_FILE_PACKET *rpacket = nullptr, *packet;
if (ft->state == FT_CONNECTING) {
rpacket = TlenP2PPacketReceive(ft->s);
- if (rpacket != NULL) {
+ if (rpacket != nullptr) {
p = rpacket->packet;
if (rpacket->type == TLEN_FILE_PACKET_FILE_LIST) { // list of files (length & name)
ft->fileCount = (int)(*((DWORD*)p));
@@ -53,7 +53,7 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft) p += 256;
}
- if ((packet = TlenP2PPacketCreate(3 * sizeof(DWORD))) == NULL)
+ if ((packet = TlenP2PPacketCreate(3 * sizeof(DWORD))) == nullptr)
ft->state = FT_ERROR;
else {
TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_FILE_LIST_ACK);
@@ -69,7 +69,7 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft) }
else if (ft->state == FT_INITIALIZING) {
char *fullFileName;
- if ((packet = TlenP2PPacketCreate(3 * sizeof(DWORD))) != NULL) {
+ if ((packet = TlenP2PPacketCreate(3 * sizeof(DWORD))) != nullptr) {
TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_FILE_REQUEST); // file request
TlenP2PPacketPackDword(packet, ft->currentFile);
TlenP2PPacketPackDword(packet, 0);
@@ -101,14 +101,14 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft) pfts.totalFiles = ft->fileCount;
pfts.currentFileNumber = ft->currentFile;
pfts.totalBytes = ft->allFileTotalSize;
- pfts.szWorkingDir = NULL;
+ pfts.szWorkingDir = nullptr;
pfts.szCurrentFile = ft->files[ft->currentFile];
pfts.currentFileSize = ft->filesSize[ft->currentFile];
pfts.currentFileTime = 0;
ft->proto->debugLogA("Receiving data...");
while (ft->state == FT_RECEIVING) {
rpacket = TlenP2PPacketReceive(ft->s);
- if (rpacket != NULL) {
+ if (rpacket != nullptr) {
p = rpacket->packet;
if (rpacket->type == TLEN_FILE_PACKET_FILE_DATA) { // file data
int writeSize;
@@ -148,7 +148,7 @@ static void TlenFileReceivingConnection(HNETLIBCONN hConnection, DWORD, void * p {
TlenProtocol *proto = (TlenProtocol *)pExtra;
TLEN_FILE_TRANSFER *ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_FILE, TRUE);
- if (ft != NULL) {
+ if (ft != nullptr) {
HNETLIBCONN slisten = ft->s;
ft->s = hConnection;
ft->proto->debugLogA("Set ft->s to %d (saving %d)", hConnection, slisten);
@@ -166,7 +166,7 @@ static void TlenFileReceivingConnection(HNETLIBCONN hConnection, DWORD, void * p if (ft->s != hConnection)
Netlib_CloseHandle(hConnection);
- if (ft->hFileEvent != NULL)
+ if (ft->hFileEvent != nullptr)
SetEvent(ft->hFileEvent);
}
else Netlib_CloseHandle(hConnection);
@@ -183,7 +183,7 @@ static void __cdecl TlenFileReceiveThread(void *arg) nloc.wPort = ft->wPort;
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
HNETLIBCONN s = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
- if (s != NULL) {
+ if (s != nullptr) {
ft->s = s;
ft->proto->debugLogA("Entering file receive loop");
TlenP2PEstablishOutgoingConnection(ft, TRUE);
@@ -192,16 +192,16 @@ static void __cdecl TlenFileReceiveThread(void *arg) if (ft->s) {
Netlib_CloseHandle(s);
- ft->s = NULL;
+ ft->s = nullptr;
}
}
else {
ft->pfnNewConnectionV2 = TlenFileReceivingConnection;
ft->proto->debugLogA("Connection failed - receiving as server");
s = TlenP2PListen(ft);
- if (s != NULL) {
+ if (s != nullptr) {
ft->s = s;
- HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
ft->hFileEvent = hEvent;
ft->currentFile = 0;
ft->state = FT_CONNECTING;
@@ -210,7 +210,7 @@ static void __cdecl TlenFileReceiveThread(void *arg) mir_free(nick);
ft->proto->debugLogA("Waiting for the file to be received...");
WaitForSingleObject(hEvent, INFINITE);
- ft->hFileEvent = NULL;
+ ft->hFileEvent = nullptr;
CloseHandle(hEvent);
ft->proto->debugLogA("Finish all files");
Netlib_CloseHandle(s);
@@ -245,7 +245,7 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft) if (ft->state == FT_CONNECTING) {
char filename[256]; // Must be 256 (0x100)
- if ((packet = TlenP2PPacketCreate(sizeof(DWORD) + (ft->fileCount*(sizeof(filename) + sizeof(DWORD))))) != NULL) {
+ if ((packet = TlenP2PPacketCreate(sizeof(DWORD) + (ft->fileCount*(sizeof(filename) + sizeof(DWORD))))) != nullptr) {
// Must pause a bit, sending these two packets back to back
// will break the session because the receiver cannot take it :)
SleepEx(1000, TRUE);
@@ -258,7 +258,7 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft) // TlenP2PPacketPackDword(packet, statbuf.st_size);
TlenP2PPacketPackDword(packet, ft->filesSize[i]);
memset(filename, 0, sizeof(filename));
- if ((t = strrchr(ft->files[i], '\\')) != NULL)
+ if ((t = strrchr(ft->files[i], '\\')) != nullptr)
t++;
else
t = ft->files[i];
@@ -277,7 +277,7 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft) else if (ft->state == FT_INITIALIZING) { // FT_INITIALIZING
TLEN_FILE_PACKET *rpacket = TlenP2PPacketReceive(ft->s);
ft->proto->debugLogA("FT_INITIALIZING: recv %d", rpacket);
- if (rpacket == NULL) {
+ if (rpacket == nullptr) {
ft->state = FT_ERROR;
return;
}
@@ -319,12 +319,12 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft) pfts.totalFiles = ft->fileCount;
pfts.currentFileNumber = ft->currentFile;
pfts.totalBytes = ft->allFileTotalSize;
- pfts.szWorkingDir = NULL;
+ pfts.szWorkingDir = nullptr;
pfts.szCurrentFile = ft->files[ft->currentFile];
pfts.currentFileSize = ft->filesSize[ft->currentFile]; //statbuf.st_size;
pfts.currentFileTime = 0;
ft->fileReceivedBytes = 0;
- if ((packet = TlenP2PPacketCreate(2 * sizeof(DWORD) + 2048)) == NULL) {
+ if ((packet = TlenP2PPacketCreate(2 * sizeof(DWORD) + 2048)) == nullptr) {
ft->state = FT_ERROR;
}
else {
@@ -384,7 +384,7 @@ static void TlenFileSendingConnection(HNETLIBCONN hConnection, DWORD, void * pEx TlenProtocol *proto = (TlenProtocol *)pExtra;
TLEN_FILE_TRANSFER *ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_FILE, TRUE);
- if (ft != NULL) {
+ if (ft != nullptr) {
slisten = ft->s;
ft->s = hConnection;
ft->proto->debugLogA("Set ft->s to %d (saving %d)", hConnection, slisten);
@@ -403,7 +403,7 @@ static void TlenFileSendingConnection(HNETLIBCONN hConnection, DWORD, void * pEx if (ft->s != hConnection)
Netlib_CloseHandle(hConnection);
- if (ft->hFileEvent != NULL)
+ if (ft->hFileEvent != nullptr)
SetEvent(ft->hFileEvent);
}
else Netlib_CloseHandle(hConnection);
@@ -416,19 +416,19 @@ int TlenFileCancelAll(TlenProtocol *proto) while ((i = TlenListFindNext(proto, LIST_FILE, 0)) >= 0) {
TLEN_LIST_ITEM *item = TlenListGetItemPtrFromIndex(proto, i);
- if (item != NULL) {
+ if (item != nullptr) {
TLEN_FILE_TRANSFER *ft = item->ft;
TlenListRemoveByIndex(proto, i);
- if (ft != NULL) {
+ if (ft != nullptr) {
if (ft->s) {
//ProtoBroadcastAck(m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
ft->proto->debugLogA("Closing ft->s = %d", ft->s);
ft->state = FT_ERROR;
Netlib_CloseHandle(ft->s);
- ft->s = NULL;
- if (ft->hFileEvent != NULL) {
+ ft->s = nullptr;
+ if (ft->hFileEvent != nullptr) {
hEvent = ft->hFileEvent;
- ft->hFileEvent = NULL;
+ ft->hFileEvent = nullptr;
SetEvent(hEvent);
}
}
@@ -451,13 +451,13 @@ static void __cdecl TlenFileSendingThread(void *arg) ft->mode = FT_SEND;
ft->pfnNewConnectionV2 = TlenFileSendingConnection;
HNETLIBCONN s = TlenP2PListen(ft);
- if (s != NULL) {
+ if (s != nullptr) {
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
ft->s = s;
//TlenLog("ft->s = %d", s);
//TlenLog("fileCount = %d", ft->fileCount);
- HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
ft->hFileEvent = hEvent;
ft->currentFile = 0;
ft->state = FT_CONNECTING;
@@ -467,11 +467,11 @@ static void __cdecl TlenFileSendingThread(void *arg) mir_free(nick);
ft->proto->debugLogA("Waiting for the file to be sent...");
WaitForSingleObject(hEvent, INFINITE);
- ft->hFileEvent = NULL;
+ ft->hFileEvent = nullptr;
CloseHandle(hEvent);
ft->proto->debugLogA("Finish all files");
Netlib_CloseHandle(s);
- ft->s = NULL;
+ ft->s = nullptr;
ft->proto->debugLogA("ft->s is NULL");
if (ft->state == FT_SWITCH) {
@@ -482,7 +482,7 @@ static void __cdecl TlenFileSendingThread(void *arg) nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
HNETLIBCONN hConn = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
- if (hConn != NULL) {
+ if (hConn != nullptr) {
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
ft->s = hConn;
TlenP2PEstablishOutgoingConnection(ft, TRUE);
@@ -548,30 +548,30 @@ void TlenProcessF(XmlNode *node, ThreadData *info) TLEN_LIST_ITEM *item;
// if (!node->name || mir_strcmp(node->name, "f")) return;
- if (info == NULL) return;
+ if (info == nullptr) return;
char *from = TlenXmlGetAttrValue(node, "f");
- if (from != NULL) {
- if (strchr(from, '@') == NULL)
+ if (from != nullptr) {
+ if (strchr(from, '@') == nullptr)
mir_snprintf(jid, "%s@%s", from, info->server);
else
strncpy_s(jid, from, _TRUNCATE);
char *e = TlenXmlGetAttrValue(node, "e");
- if (e != NULL) {
+ if (e != nullptr) {
if (!mir_strcmp(e, "1")) {
// FILE_RECV : e='1' : File transfer request
TLEN_FILE_TRANSFER *ft = TlenFileCreateFT(info->proto, jid);
ft->hContact = TlenHContactFromJID(info->proto, jid);
- if ((p = TlenXmlGetAttrValue(node, "i")) != NULL)
+ if ((p = TlenXmlGetAttrValue(node, "i")) != nullptr)
ft->iqId = mir_strdup(p);
szFilename[0] = '\0';
- if ((p = TlenXmlGetAttrValue(node, "c")) != NULL) {
+ if ((p = TlenXmlGetAttrValue(node, "c")) != nullptr) {
numFiles = atoi(p);
if (numFiles == 1) {
- if ((p = TlenXmlGetAttrValue(node, "n")) != NULL) {
+ if ((p = TlenXmlGetAttrValue(node, "n")) != nullptr) {
p = TlenTextDecode(p);
strncpy(szFilename, p, sizeof(szFilename) - 1);
mir_free(p);
@@ -582,12 +582,12 @@ void TlenProcessF(XmlNode *node, ThreadData *info) mir_snprintf(szFilename, Translate("%d Files"), numFiles);
}
- if (szFilename[0] != '\0' && ft->iqId != NULL) {
+ if (szFilename[0] != '\0' && ft->iqId != nullptr) {
wchar_t* filenameT = mir_utf8decodeW((char*)szFilename);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = filenameT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
@@ -606,9 +606,9 @@ void TlenProcessF(XmlNode *node, ThreadData *info) }
else if (!mir_strcmp(e, "3")) {
// FILE_RECV : e='3' : invalid transfer error
- if ((p = TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
- if (item->ft != NULL) {
+ if ((p = TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != nullptr) {
+ if (item->ft != nullptr) {
ProtoBroadcastAck(info->proto->m_szModuleName, item->ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, item->ft, 0);
info->proto->FileCancel(NULL, item->ft);
}
@@ -618,8 +618,8 @@ void TlenProcessF(XmlNode *node, ThreadData *info) }
else if (!mir_strcmp(e, "4")) {
// FILE_SEND : e='4' : File sending request was denied by the remote client
- if ((p = TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
+ if ((p = TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != nullptr) {
if (!mir_strcmp(item->ft->jid, jid)) {
ProtoBroadcastAck(info->proto->m_szModuleName, item->ft->hContact, ACKTYPE_FILE, ACKRESULT_DENIED, item->ft, 0);
TlenListRemove(info->proto, LIST_FILE, p);
@@ -629,18 +629,18 @@ void TlenProcessF(XmlNode *node, ThreadData *info) }
else if (!mir_strcmp(e, "5")) {
// FILE_SEND : e='5' : File sending request was accepted
- if ((p = TlenXmlGetAttrValue(node, "i")) != NULL)
- if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != NULL)
+ if ((p = TlenXmlGetAttrValue(node, "i")) != nullptr)
+ if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != nullptr)
if (!mir_strcmp(item->ft->jid, jid))
mir_forkthread(TlenFileSendingThread, item->ft);
}
else if (!mir_strcmp(e, "6")) {
// FILE_RECV : e='6' : IP and port information to connect to get file
- if ((p = TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
- if ((p = TlenXmlGetAttrValue(node, "a")) != NULL) {
+ if ((p = TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != nullptr) {
+ if ((p = TlenXmlGetAttrValue(node, "a")) != nullptr) {
item->ft->hostName = mir_strdup(p);
- if ((p = TlenXmlGetAttrValue(node, "p")) != NULL) {
+ if ((p = TlenXmlGetAttrValue(node, "p")) != nullptr) {
item->ft->wPort = atoi(p);
mir_forkthread(TlenFileReceiveThread, item->ft);
}
@@ -651,12 +651,12 @@ void TlenProcessF(XmlNode *node, ThreadData *info) else if (!mir_strcmp(e, "7")) {
// FILE_RECV : e='7' : IP and port information to connect to send file
// in case the conection to the given server was not successful
- if ((p = TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
- if ((p = TlenXmlGetAttrValue(node, "a")) != NULL) {
- if (item->ft->hostName != NULL) mir_free(item->ft->hostName);
+ if ((p = TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != nullptr) {
+ if ((p = TlenXmlGetAttrValue(node, "a")) != nullptr) {
+ if (item->ft->hostName != nullptr) mir_free(item->ft->hostName);
item->ft->hostName = mir_strdup(p);
- if ((p = TlenXmlGetAttrValue(node, "p")) != NULL) {
+ if ((p = TlenXmlGetAttrValue(node, "p")) != nullptr) {
item->ft->wPort = atoi(p);
item->ft->state = FT_SWITCH;
SetEvent(item->ft->hFileEvent);
@@ -667,10 +667,10 @@ void TlenProcessF(XmlNode *node, ThreadData *info) }
else if (!mir_strcmp(e, "8")) {
// FILE_RECV : e='8' : transfer error
- if ((p = TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
+ if ((p = TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != nullptr) {
item->ft->state = FT_ERROR;
- if (item->ft->hFileEvent != NULL)
+ if (item->ft->hFileEvent != nullptr)
SetEvent(item->ft->hFileEvent);
else
ProtoBroadcastAck(info->proto->m_szModuleName, item->ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, item->ft, 0);
diff --git a/protocols/Tlen/src/tlen_iq.cpp b/protocols/Tlen/src/tlen_iq.cpp index 19dd956a77..82923570b3 100644 --- a/protocols/Tlen/src/tlen_iq.cpp +++ b/protocols/Tlen/src/tlen_iq.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void TlenIqInit(TlenProtocol *proto)
{
- proto->iqList = NULL;
+ proto->iqList = nullptr;
proto->iqCount = 0;
proto->iqAlloced = 0;
}
@@ -34,7 +34,7 @@ void TlenIqInit(TlenProtocol *proto) void TlenIqUninit(TlenProtocol *proto)
{
if (proto->iqList) mir_free(proto->iqList);
- proto->iqList = NULL;
+ proto->iqList = nullptr;
proto->iqCount = 0;
proto->iqAlloced = 0;
}
@@ -54,7 +54,7 @@ static void TlenIqExpire(TlenProtocol *proto) time_t expire;
mir_cslock lck(proto->csIqList);
- expire = time(NULL) - 120; // 2 minute
+ expire = time(nullptr) - 120; // 2 minute
i = 0;
while (i < proto->iqCount) {
if (proto->iqList[i].requestTime < expire)
@@ -77,7 +77,7 @@ TLEN_IQ_PFUNC TlenIqFetchFunc(TlenProtocol *proto, int iqId) TlenIqRemove(proto, i);
}
else {
- res = (TLEN_IQ_PFUNC) NULL;
+ res = (TLEN_IQ_PFUNC) nullptr;
}
return res;
}
@@ -97,11 +97,11 @@ void TlenIqAdd(TlenProtocol *proto, unsigned int iqId, TLEN_IQ_PROCID procId, TL proto->iqList = (TLEN_IQ_FUNC*)mir_realloc(proto->iqList, sizeof(TLEN_IQ_FUNC)*proto->iqAlloced);
}
- if (proto->iqList != NULL) {
+ if (proto->iqList != nullptr) {
proto->iqList[i].iqId = iqId;
proto->iqList[i].procId = procId;
proto->iqList[i].func = func;
- proto->iqList[i].requestTime = time(NULL);
+ proto->iqList[i].requestTime = time(nullptr);
if (i == proto->iqCount) proto->iqCount++;
}
}
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index dd749424be..39024a544a 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void TlenIqResultAuth(TlenProtocol *proto, XmlNode *iqNode)
{
char *type = TlenXmlGetAttrValue(iqNode, "type");
- if (type == NULL)
+ if (type == nullptr)
return;
if (!mir_strcmp(type, "result")) {
@@ -55,9 +55,9 @@ void TlenIqResultAuth(TlenProtocol *proto, XmlNode *iqNode) TlenSend(proto, "</s>");
mir_snprintf(text, Translate("Authentication failed for %s@%s."), proto->threadData->username, proto->threadData->server);
- MessageBoxA(NULL, text, Translate("Tlen Authentication"), MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
- ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
- proto->threadData = NULL; // To disallow auto reconnect
+ MessageBoxA(nullptr, text, Translate("Tlen Authentication"), MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
+ ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_WRONGPASSWORD);
+ proto->threadData = nullptr; // To disallow auto reconnect
}
}
@@ -71,9 +71,9 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { XmlNode *itemNode = queryNode->child[i];
if (!mir_strcmp(itemNode->name, "item")) {
char *jid = TlenXmlGetAttrValue(itemNode, "jid");
- if (jid != NULL) {
+ if (jid != nullptr) {
char *str = TlenXmlGetAttrValue(itemNode, "subscription");
- if (str == NULL)
+ if (str == nullptr)
continue;
else if (!mir_strcmp(str, "remove")) {
if ((hContact = TlenHContactFromJID(proto, jid)) != NULL) {
@@ -84,7 +84,7 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { }
else {
TLEN_LIST_ITEM *item = TlenListAdd(proto, LIST_ROSTER, jid);
- if (item != NULL) {
+ if (item != nullptr) {
if (!mir_strcmp(str, "both"))
item->subscription = SUB_BOTH;
else if (!mir_strcmp(str, "to"))
@@ -93,13 +93,13 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { item->subscription = SUB_FROM;
else
item->subscription = SUB_NONE;
- if ((name = TlenXmlGetAttrValue(itemNode, "name")) != NULL) {
+ if ((name = TlenXmlGetAttrValue(itemNode, "name")) != nullptr) {
nick = TlenTextDecode(name);
}
else {
nick = TlenLocalNickFromJID(jid);
}
- if (nick != NULL) {
+ if (nick != nullptr) {
if (item->nick) mir_free(item->nick);
item->nick = nick;
@@ -110,7 +110,7 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { }
db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
- if ((groupNode = TlenXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
+ if ((groupNode = TlenXmlGetChild(itemNode, "group")) != nullptr && groupNode->text != nullptr) {
item->group = TlenGroupDecode(groupNode->text);
Clist_GroupCreate(0, _A2T(item->group));
// Don't set group again if already correct, or Miranda may show wrong group count in some case
@@ -123,7 +123,7 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { db_set_s(hContact, "CList", "Group", item->group);
}
else {
- item->group = NULL;
+ item->group = nullptr;
db_unset(hContact, "CList", "Group");
}
}
@@ -139,13 +139,13 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
{
char *type = TlenXmlGetAttrValue(iqNode, "type");
- if (type == NULL) return;
+ if (type == nullptr) return;
XmlNode *queryNode = TlenXmlGetChild(iqNode, "query");
- if (queryNode == NULL) return;
+ if (queryNode == nullptr) return;
if (!mir_strcmp(type, "result")) {
char *str = TlenXmlGetAttrValue(queryNode, "xmlns");
- if (str != NULL && !mir_strcmp(str, "jabber:iq:roster")) {
+ if (str != nullptr && !mir_strcmp(str, "jabber:iq:roster")) {
DBVARIANT dbv;
XmlNode *itemNode, *groupNode;
TLEN_SUBSCRIPTION sub;
@@ -157,19 +157,19 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) itemNode = queryNode->child[i];
if (!mir_strcmp(itemNode->name, "item")) {
str = TlenXmlGetAttrValue(itemNode, "subscription");
- if (str == NULL) sub = SUB_NONE;
+ if (str == nullptr) sub = SUB_NONE;
else if (!mir_strcmp(str, "both")) sub = SUB_BOTH;
else if (!mir_strcmp(str, "to")) sub = SUB_TO;
else if (!mir_strcmp(str, "from")) sub = SUB_FROM;
else sub = SUB_NONE;
//if (str != NULL && (!mir_strcmp(str, "to") || !mir_strcmp(str, "both"))) {
- if ((jid = TlenXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if ((name = TlenXmlGetAttrValue(itemNode, "name")) != NULL)
+ if ((jid = TlenXmlGetAttrValue(itemNode, "jid")) != nullptr) {
+ if ((name = TlenXmlGetAttrValue(itemNode, "name")) != nullptr)
nick = TlenTextDecode(name);
else
nick = TlenLocalNickFromJID(jid);
- if (nick != NULL) {
+ if (nick != nullptr) {
MCONTACT hContact;
item = TlenListAdd(proto, LIST_ROSTER, jid);
if (item->nick) mir_free(item->nick);
@@ -182,7 +182,7 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) }
db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
- if ((groupNode = TlenXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
+ if ((groupNode = TlenXmlGetChild(itemNode, "group")) != nullptr && groupNode->text != nullptr) {
item->group = TlenGroupDecode(groupNode->text);
Clist_GroupCreate(0, _A2T(item->group));
// Don't set group again if already correct, or Miranda may show wrong group count in some case
@@ -194,7 +194,7 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) else db_set_s(hContact, "CList", "Group", item->group);
}
else {
- item->group = NULL;
+ item->group = nullptr;
db_unset(hContact, "CList", "Group");
}
@@ -238,19 +238,19 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) // TlenLog("<iq/> iqIdGetVcard (tlen)");
char *type = TlenXmlGetAttrValue(iqNode, "type");
- if (type == NULL) return;
+ if (type == nullptr) return;
if (!mir_strcmp(type, "result")) {
DBVARIANT dbv;
XmlNode *queryNode = TlenXmlGetChild(iqNode, "query");
- if (queryNode == NULL) return;
+ if (queryNode == nullptr) return;
XmlNode *itemNode = TlenXmlGetChild(queryNode, "item");
- if (itemNode == NULL) return;
+ if (itemNode == nullptr) return;
char *jid = TlenXmlGetAttrValue(itemNode, "jid");
- if (jid != NULL) {
+ if (jid != nullptr) {
if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
- if (strchr(jid, '@') != NULL) {
+ if (strchr(jid, '@') != nullptr) {
strncpy_s(text, jid, _TRUNCATE);
}
else {
@@ -273,9 +273,9 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) hasGender = false, hasSchool = false, hasLookFor = false, hasOccupation = false;
for (int i = 0; i < itemNode->numChild; i++) {
XmlNode *n = itemNode->child[i];
- if (n == NULL || n->name == NULL) continue;
+ if (n == nullptr || n->name == nullptr) continue;
if (!mir_strcmp(n->name, "first")) {
- if (n->text != NULL) {
+ if (n->text != nullptr) {
hasFirst = true;
nText = TlenTextDecode(n->text);
db_set_s(hContact, proto->m_szModuleName, "FirstName", nText);
@@ -283,7 +283,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) }
}
else if (!mir_strcmp(n->name, "last")) {
- if (n->text != NULL) {
+ if (n->text != nullptr) {
hasLast = true;
nText = TlenTextDecode(n->text);
db_set_s(hContact, proto->m_szModuleName, "LastName", nText);
@@ -291,7 +291,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) }
}
else if (!mir_strcmp(n->name, "nick")) {
- if (n->text != NULL) {
+ if (n->text != nullptr) {
hasNick = true;
nText = TlenTextDecode(n->text);
db_set_s(hContact, proto->m_szModuleName, "Nick", nText);
@@ -299,7 +299,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) }
}
else if (!mir_strcmp(n->name, "email")) {
- if (n->text != NULL) {
+ if (n->text != nullptr) {
hasEmail = true;
nText = TlenTextDecode(n->text);
db_set_s(hContact, proto->m_szModuleName, "e-mail", nText);
@@ -307,7 +307,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) }
}
else if (!mir_strcmp(n->name, "c")) {
- if (n->text != NULL) {
+ if (n->text != nullptr) {
hasCity = true;
nText = TlenTextDecode(n->text);
db_set_s(hContact, proto->m_szModuleName, "City", nText);
@@ -315,20 +315,20 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) }
}
else if (!mir_strcmp(n->name, "b")) {
- if (n->text != NULL) {
+ if (n->text != nullptr) {
WORD nAge = atoi(n->text);
hasAge = true;
db_set_w(hContact, proto->m_szModuleName, "Age", nAge);
}
}
else if (!mir_strcmp(n->name, "s")) {
- if (n->text != NULL && n->text[1] == '\0' && (n->text[0] == '1' || n->text[0] == '2')) {
+ if (n->text != nullptr && n->text[1] == '\0' && (n->text[0] == '1' || n->text[0] == '2')) {
hasGender = true;
db_set_b(hContact, proto->m_szModuleName, "Gender", (BYTE)(n->text[0] == '1' ? 'M' : 'F'));
}
}
else if (!mir_strcmp(n->name, "e")) {
- if (n->text != NULL) {
+ if (n->text != nullptr) {
hasSchool = true;
nText = TlenTextDecode(n->text);
db_set_s(hContact, proto->m_szModuleName, "School", nText);
@@ -336,27 +336,27 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) }
}
else if (!mir_strcmp(n->name, "j")) {
- if (n->text != NULL) {
+ if (n->text != nullptr) {
hasOccupation = true;
WORD nOccupation = atoi(n->text);
db_set_w(hContact, proto->m_szModuleName, "Occupation", nOccupation);
}
}
else if (!mir_strcmp(n->name, "r")) {
- if (n->text != NULL) {
+ if (n->text != nullptr) {
WORD nLookFor = atoi(n->text);
hasLookFor = true;
db_set_w(hContact, proto->m_szModuleName, "LookingFor", nLookFor);
}
}
else if (!mir_strcmp(n->name, "g")) { // voice chat enabled
- if (n->text != NULL) {
+ if (n->text != nullptr) {
BYTE bVoice = atoi(n->text);
db_set_w(hContact, proto->m_szModuleName, "VoiceChat", bVoice);
}
}
else if (!mir_strcmp(n->name, "v")) { // status visibility
- if (n->text != NULL) {
+ if (n->text != nullptr) {
BYTE bPublic = atoi(n->text);
db_set_w(hContact, proto->m_szModuleName, "PublicStatus", bPublic);
}
@@ -397,23 +397,23 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) // TlenLog("<iq/> iqIdGetSearch");
char *type = TlenXmlGetAttrValue(iqNode, "type");
- if (type == NULL)
+ if (type == nullptr)
return;
char *str = TlenXmlGetAttrValue(iqNode, "id");
- if (str == NULL)
+ if (str == nullptr)
return;
int id = atoi(str + mir_strlen(TLEN_IQID));
if (!mir_strcmp(type, "result")) {
- if ((queryNode = TlenXmlGetChild(iqNode, "query")) == NULL) return;
+ if ((queryNode = TlenXmlGetChild(iqNode, "query")) == nullptr) return;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
jsr.hdr.cbSize = sizeof(TLEN_SEARCH_RESULT);
jsr.hdr.flags = PSR_UNICODE;
for (i = 0; i < queryNode->numChild; i++) {
itemNode = queryNode->child[i];
if (!mir_strcmp(itemNode->name, "item")) {
- if ((jid = TlenXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if (strchr(jid, '@') != NULL) {
+ if ((jid = TlenXmlGetAttrValue(itemNode, "jid")) != nullptr) {
+ if (strchr(jid, '@') != nullptr) {
strncpy_s(jsr.jid, jid, _TRUNCATE);
}
else {
@@ -421,7 +421,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) }
jsr.jid[sizeof(jsr.jid) - 1] = '\0';
jsr.hdr.id.w = mir_a2u(jid);
- if ((n = TlenXmlGetChild(itemNode, "nick")) != NULL && n->text != NULL) {
+ if ((n = TlenXmlGetChild(itemNode, "nick")) != nullptr && n->text != nullptr) {
char* buf = TlenTextDecode(n->text);
jsr.hdr.nick.w = mir_a2u(buf);
mir_free(buf);
@@ -429,7 +429,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) else {
jsr.hdr.nick.w = mir_wstrdup(TEXT(""));
}
- if ((n = TlenXmlGetChild(itemNode, "first")) != NULL && n->text != NULL) {
+ if ((n = TlenXmlGetChild(itemNode, "first")) != nullptr && n->text != nullptr) {
char* buf = TlenTextDecode(n->text);
jsr.hdr.firstName.w = mir_a2u(buf);
mir_free(buf);
@@ -437,7 +437,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) else {
jsr.hdr.firstName.w = mir_wstrdup(TEXT(""));
}
- if ((n = TlenXmlGetChild(itemNode, "last")) != NULL && n->text != NULL) {
+ if ((n = TlenXmlGetChild(itemNode, "last")) != nullptr && n->text != nullptr) {
char* buf = TlenTextDecode(n->text);
jsr.hdr.lastName.w = mir_a2u(buf);
mir_free(buf);
@@ -445,7 +445,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) else {
jsr.hdr.lastName.w = mir_wstrdup(TEXT(""));
}
- if ((n = TlenXmlGetChild(itemNode, "email")) != NULL && n->text != NULL) {
+ if ((n = TlenXmlGetChild(itemNode, "email")) != nullptr && n->text != nullptr) {
char* buf = TlenTextDecode(n->text);
jsr.hdr.email.w = mir_a2u(buf);
mir_free(buf);
@@ -464,9 +464,9 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) }
}
}
- if (proto->searchJID != NULL) {
+ if (proto->searchJID != nullptr) {
if (!found) {
- if (strchr(proto->searchJID, '@') != NULL)
+ if (strchr(proto->searchJID, '@') != nullptr)
strncpy_s(jsr.jid, proto->searchJID, _TRUNCATE);
else
mir_snprintf(jsr.jid, "%s@%s", proto->searchJID, dbv.pszVal);
@@ -475,7 +475,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
}
mir_free(proto->searchJID);
- proto->searchJID = NULL;
+ proto->searchJID = nullptr;
}
db_free(&dbv);
}
@@ -501,7 +501,7 @@ void GetConfigItem(XmlNode *node, char *dest, BOOL bMethod, int *methodDest) { TlenUrlDecode(dest);
if (bMethod) {
char *method = TlenXmlGetAttrValue(node, "method");
- if (method != NULL && !strcmpi(method, "POST")) {
+ if (method != nullptr && !strcmpi(method, "POST")) {
*methodDest = REQUEST_POST;
}
else {
@@ -515,40 +515,40 @@ void TlenIqResultTcfg(TlenProtocol *proto, XmlNode *iqNode) XmlNode *queryNode, *miniMailNode, *node;
char *type = TlenXmlGetAttrValue(iqNode, "type");
- if (type == NULL) return;
+ if (type == nullptr) return;
if (!mir_strcmp(type, "result")) {
- if ((queryNode = TlenXmlGetChild(iqNode, "query")) == NULL) return;
- if ((miniMailNode = TlenXmlGetChild(queryNode, "mini-mail")) == NULL) return;
- if ((node = TlenXmlGetChild(miniMailNode, "base")) != NULL) {
- GetConfigItem(node, proto->threadData->tlenConfig.mailBase, FALSE, NULL);
+ if ((queryNode = TlenXmlGetChild(iqNode, "query")) == nullptr) return;
+ if ((miniMailNode = TlenXmlGetChild(queryNode, "mini-mail")) == nullptr) return;
+ if ((node = TlenXmlGetChild(miniMailNode, "base")) != nullptr) {
+ GetConfigItem(node, proto->threadData->tlenConfig.mailBase, FALSE, nullptr);
}
- if ((node = TlenXmlGetChild(miniMailNode, "msg")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "msg")) != nullptr) {
GetConfigItem(node, proto->threadData->tlenConfig.mailMsg, TRUE, &proto->threadData->tlenConfig.mailMsgMthd);
}
- if ((node = TlenXmlGetChild(miniMailNode, "index")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "index")) != nullptr) {
GetConfigItem(node, proto->threadData->tlenConfig.mailIndex, TRUE, &proto->threadData->tlenConfig.mailIndexMthd);
}
- if ((node = TlenXmlGetChild(miniMailNode, "login")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "login")) != nullptr) {
GetConfigItem(node, proto->threadData->tlenConfig.mailLogin, TRUE, &proto->threadData->tlenConfig.mailLoginMthd);
}
- if ((node = TlenXmlGetChild(miniMailNode, "compose")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "compose")) != nullptr) {
GetConfigItem(node, proto->threadData->tlenConfig.mailCompose, TRUE, &proto->threadData->tlenConfig.mailComposeMthd);
}
- if ((node = TlenXmlGetChild(miniMailNode, "avatar-get")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "avatar-get")) != nullptr) {
GetConfigItem(node, proto->threadData->tlenConfig.avatarGet, TRUE, &proto->threadData->tlenConfig.avatarGetMthd);
}
- if ((node = TlenXmlGetChild(miniMailNode, "avatar-upload")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "avatar-upload")) != nullptr) {
GetConfigItem(node, proto->threadData->tlenConfig.avatarUpload, TRUE, &proto->threadData->tlenConfig.avatarUploadMthd);
}
- if ((node = TlenXmlGetChild(miniMailNode, "avatar-remove")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "avatar-remove")) != nullptr) {
GetConfigItem(node, proto->threadData->tlenConfig.avatarRemove, TRUE, &proto->threadData->tlenConfig.avatarRemoveMthd);
}
//continue connecting
- Menu_ModifyItem(proto->hMenuMUC, NULL, INVALID_HANDLE_VALUE, 0);
- if (proto->hMenuChats != NULL)
- Menu_ModifyItem(proto->hMenuChats, NULL, INVALID_HANDLE_VALUE, 0);
+ Menu_ModifyItem(proto->hMenuMUC, nullptr, INVALID_HANDLE_VALUE, 0);
+ if (proto->hMenuChats != nullptr)
+ Menu_ModifyItem(proto->hMenuChats, nullptr, INVALID_HANDLE_VALUE, 0);
proto->isOnline = TRUE;
proto->debugLogA("Status changed via THREADSTART");
@@ -562,31 +562,31 @@ void TlenIqResultTcfg(TlenProtocol *proto, XmlNode *iqNode) void TlenIqResultVersion(TlenProtocol *proto, XmlNode *iqNode)
{
XmlNode *queryNode = TlenXmlGetChild(iqNode, "query");
- if (queryNode != NULL) {
+ if (queryNode != nullptr) {
char *from = TlenXmlGetAttrValue(iqNode, "from");
- if (from != NULL) {
+ if (from != nullptr) {
TLEN_LIST_ITEM *item = TlenListGetItemPtr(proto, LIST_ROSTER, from);
- if (item != NULL) {
+ if (item != nullptr) {
XmlNode *n;
if (item->software) mir_free(item->software);
if (item->version) mir_free(item->version);
if (item->system) mir_free(item->system);
- if ((n = TlenXmlGetChild(queryNode, "name")) != NULL && n->text) {
+ if ((n = TlenXmlGetChild(queryNode, "name")) != nullptr && n->text) {
item->software = TlenTextDecode(n->text);
}
else
- item->software = NULL;
- if ((n = TlenXmlGetChild(queryNode, "version")) != NULL && n->text)
+ item->software = nullptr;
+ if ((n = TlenXmlGetChild(queryNode, "version")) != nullptr && n->text)
item->version = TlenTextDecode(n->text);
else
- item->version = NULL;
- if ((n = TlenXmlGetChild(queryNode, "os")) != NULL && n->text)
+ item->version = nullptr;
+ if ((n = TlenXmlGetChild(queryNode, "os")) != nullptr && n->text)
item->system = TlenTextDecode(n->text);
else
- item->system = NULL;
+ item->system = nullptr;
MCONTACT hContact = TlenHContactFromJID(proto, item->jid);
if (hContact != NULL) {
- if (item->software != NULL) {
+ if (item->software != nullptr) {
db_set_s(hContact, proto->m_szModuleName, "MirVer", item->software);
}
else {
@@ -601,17 +601,17 @@ void TlenIqResultVersion(TlenProtocol *proto, XmlNode *iqNode) void TlenIqResultInfo(TlenProtocol *proto, XmlNode *iqNode)
{
XmlNode *queryNode = TlenXmlGetChild(iqNode, "query");
- if (queryNode != NULL) {
+ if (queryNode != nullptr) {
char *from = TlenXmlGetAttrValue(queryNode, "from");
- if (from != NULL) {
+ if (from != nullptr) {
TLEN_LIST_ITEM *item = TlenListGetItemPtr(proto, LIST_ROSTER, from);
- if (item != NULL) {
+ if (item != nullptr) {
XmlNode *version = TlenXmlGetChild(queryNode, "version");
- if (version != NULL) {
+ if (version != nullptr) {
item->protocolVersion = TlenTextDecode(version->text);
MCONTACT hContact = TlenHContactFromJID(proto, item->jid);
if (hContact != NULL) {
- if (item->software == NULL) {
+ if (item->software == nullptr) {
char str[128];
mir_snprintf(str, "Tlen Protocol %s", item->protocolVersion);
db_set_s(hContact, proto->m_szModuleName, "MirVer", str);
diff --git a/protocols/Tlen/src/tlen_list.cpp b/protocols/Tlen/src/tlen_list.cpp index 03bad29a52..f7a141cea6 100644 --- a/protocols/Tlen/src/tlen_list.cpp +++ b/protocols/Tlen/src/tlen_list.cpp @@ -29,7 +29,7 @@ static void TlenListFreeItemInternal(TLEN_LIST_ITEM *item); void TlenListInit(TlenProtocol *proto)
{
- proto->lists = NULL;
+ proto->lists = nullptr;
proto->listsCount = 0;
}
@@ -45,9 +45,9 @@ void TlenListWipe(TlenProtocol *proto) mir_cslock lck(proto->csLists);
for (i=0; i<proto->listsCount; i++)
TlenListFreeItemInternal(&(proto->lists[i]));
- if (proto->lists != NULL) {
+ if (proto->lists != nullptr) {
mir_free(proto->lists);
- proto->lists = NULL;
+ proto->lists = nullptr;
}
proto->listsCount=0;
}
@@ -69,7 +69,7 @@ void TlenListWipeSpecial(TlenProtocol *proto) static void TlenListFreeItemInternal(TLEN_LIST_ITEM *item)
{
- if (item == NULL)
+ if (item == nullptr)
return;
if (item->jid) mir_free(item->jid);
@@ -96,8 +96,8 @@ static char * GetItemId(TLEN_LIST list, const char *jid) if (list != LIST_PICTURE) {
_strlwr(s);
// strip resouce name if any
- if ((p=strchr(s, '@')) != NULL) {
- if ((q=strchr(p, '/')) != NULL)
+ if ((p=strchr(s, '@')) != nullptr) {
+ if ((q=strchr(p, '/')) != nullptr)
*q = '\0';
}
}
@@ -132,7 +132,7 @@ TLEN_LIST_ITEM *TlenListAdd(TlenProtocol *proto, TLEN_LIST list, const char *jid TLEN_LIST_ITEM *item;
mir_cslock lck(proto->csLists);
- if ((item=TlenListGetItemPtr(proto, list, jid)) != NULL) {
+ if ((item=TlenListGetItemPtr(proto, list, jid)) != nullptr) {
return item;
}
@@ -142,20 +142,20 @@ TLEN_LIST_ITEM *TlenListAdd(TlenProtocol *proto, TLEN_LIST list, const char *jid memset(item, 0, sizeof(TLEN_LIST_ITEM));
item->list = list;
item->jid = s;
- item->nick = NULL;
+ item->nick = nullptr;
item->status = ID_STATUS_OFFLINE;
- item->statusMessage = NULL;
- item->group = NULL;
- item->messageEventIdStr = NULL;
+ item->statusMessage = nullptr;
+ item->group = nullptr;
+ item->messageEventIdStr = nullptr;
item->wantComposingEvent = FALSE;
item->isTyping = FALSE;
// item->type = NULL;
- item->ft = NULL;
- item->roomName = NULL;
- item->version = NULL;
- item->software = NULL;
- item->system = NULL;
- item->avatarHash = NULL;
+ item->ft = nullptr;
+ item->roomName = nullptr;
+ item->version = nullptr;
+ item->software = nullptr;
+ item->system = nullptr;
+ item->avatarHash = nullptr;
item->avatarFormat = PA_FORMAT_UNKNOWN;
item->newAvatarDownloading = FALSE;
item->versionRequested = FALSE;
@@ -213,12 +213,12 @@ void TlenListAddResource(TlenProtocol *proto, TLEN_LIST list, const char *jid, i }
i--;
- if (proto->lists[i].statusMessage != NULL)
+ if (proto->lists[i].statusMessage != nullptr)
mir_free(proto->lists[i].statusMessage);
if (statusMessage)
proto->lists[i].statusMessage = mir_strdup(statusMessage);
else
- proto->lists[i].statusMessage = NULL;
+ proto->lists[i].statusMessage = nullptr;
}
void TlenListRemoveResource(TlenProtocol *proto, TLEN_LIST list, const char *jid)
@@ -252,7 +252,7 @@ TLEN_LIST_ITEM *TlenListGetItemPtr(TlenProtocol *proto, TLEN_LIST list, const ch mir_cslock lck(proto->csLists);
i = TlenListExist(proto, list, jid);
if (!i) {
- return NULL;
+ return nullptr;
}
i--;
return &(proto->lists[i]);
@@ -271,14 +271,14 @@ TLEN_LIST_ITEM *TlenListFindItemPtrById2(TlenProtocol *proto, TLEN_LIST list, co for (i=0; i<proto->listsCount; i++) {
if (proto->lists[i].list == list) {
p = proto->lists[i].id2;
- if (p != NULL) {
+ if (p != nullptr) {
if (!strncmp(p, id, len)) {
return &(proto->lists[i]);
}
}
}
}
- return NULL;
+ return nullptr;
}
TLEN_LIST_ITEM *TlenListGetItemPtrFromIndex(TlenProtocol *proto, int index)
@@ -287,6 +287,6 @@ TLEN_LIST_ITEM *TlenListGetItemPtrFromIndex(TlenProtocol *proto, int index) if (index >= 0 && index<proto->listsCount) {
return &(proto->lists[index]);
}
- return NULL;
+ return nullptr;
}
diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp index ae38e33bee..4cb071da5a 100644 --- a/protocols/Tlen/src/tlen_misc.cpp +++ b/protocols/Tlen/src/tlen_misc.cpp @@ -28,7 +28,7 @@ void TlenDBAddEvent(TlenProtocol *proto, MCONTACT hContact, int eventType, DWORD {
DBEVENTINFO dbei = {};
dbei.szModule = proto->m_szModuleName;
- dbei.timestamp = (DWORD) time(NULL);
+ dbei.timestamp = (DWORD) time(nullptr);
dbei.flags = flags;
dbei.eventType = eventType;
dbei.cbBlob = cbBlob;
@@ -53,13 +53,13 @@ void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
proto->debugLogA("auth request: %s, %s", jid, nick);
- DB_AUTH_BLOB blob(hContact, nick, 0, 0, jid, 0);
+ DB_AUTH_BLOB blob(hContact, nick, nullptr, nullptr, jid, nullptr);
TlenDBAddEvent(proto, NULL, EVENTTYPE_AUTHREQUEST, 0, blob, blob.size());
}
char *TlenJIDFromHContact(TlenProtocol *proto, MCONTACT hContact)
{
- char *p = NULL;
+ char *p = nullptr;
DBVARIANT dbv;
if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
p = mir_strdup(dbv.pszVal);
@@ -72,14 +72,14 @@ MCONTACT TlenHContactFromJID(TlenProtocol *proto, const char *jid) {
DBVARIANT dbv;
char *p;
- if (jid == NULL)
+ if (jid == nullptr)
return NULL;
for (MCONTACT hContact = db_find_first(proto->m_szModuleName); hContact; hContact = db_find_next(hContact, proto->m_szModuleName)) {
if ( db_get_s(hContact, proto->m_szModuleName, "jid", &dbv))
continue;
- if ((p=dbv.pszVal) != NULL) {
+ if ((p=dbv.pszVal) != nullptr) {
if (!mir_strcmpi(p, jid)) { // exact match (node@domain/resource)
db_free(&dbv);
return hContact;
@@ -94,14 +94,14 @@ MCONTACT TlenHContactFromJID(TlenProtocol *proto, const char *jid) MCONTACT TlenDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL temporary)
{
MCONTACT hContact;
- if (jid == NULL || jid[0] == '\0')
+ if (jid == nullptr || jid[0] == '\0')
return NULL;
if ((hContact=TlenHContactFromJID(proto, jid)) == NULL) {
hContact = db_add_contact();
Proto_AddToContact(hContact, proto->m_szModuleName);
db_set_s(hContact, proto->m_szModuleName, "jid", jid);
- if (nick != NULL && nick[0] != '\0')
+ if (nick != nullptr && nick[0] != '\0')
db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
if (temporary)
db_set_b(hContact, "CList", "NotOnList", 1);
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp index a2a0469ff6..475ffa504d 100644 --- a/protocols/Tlen/src/tlen_muc.cpp +++ b/protocols/Tlen/src/tlen_muc.cpp @@ -37,8 +37,8 @@ static int isSelf(TlenProtocol *proto, const char *roomID, const char *nick) int result;
result=0;
item = TlenListGetItemPtr(proto, LIST_CHATROOM, roomID);
- if (item != NULL) {
- if (item->nick == NULL) {
+ if (item != nullptr) {
+ if (item->nick == nullptr) {
if (!mir_strcmp(nick, proto->threadData->username)) result = 1;
} else if (nick[0] == '~') {
if (!mir_strcmp(nick+1, item->nick)) {
@@ -84,7 +84,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char*, const char *from, const char*)
{
int ignore, ask, groupChatPolicy;
- if (roomId == NULL) return 1;
+ if (roomId == nullptr) return 1;
groupChatPolicy = db_get_w(NULL, proto->m_szModuleName, "GroupChatPolicy", 0);
ask = TRUE;
ignore = FALSE;
@@ -141,27 +141,27 @@ static int TlenMUCSendPresence(TlenProtocol *proto, const char *roomID, const ch if (!proto->isOnline) {
return 1;
}
- if (nick != NULL) {
+ if (nick != nullptr) {
mir_snprintf(str, "%s/%s", roomID, nick);
} else {
strncpy_s(str, roomID, _TRUNCATE);
}
- if ((jid = TlenTextEncode(str)) != NULL) {
+ if ((jid = TlenTextEncode(str)) != nullptr) {
switch (desiredStatus) {
case ID_STATUS_ONLINE:
TlenSend(proto, "<p to='%s'/>", jid);
item = TlenListGetItemPtr(proto, LIST_CHATROOM, roomID);
- if (item != NULL) {
- if (item->nick != NULL) mir_free(item->nick);
- item->nick = NULL;
- if (nick != NULL) {
+ if (item != nullptr) {
+ if (item->nick != nullptr) mir_free(item->nick);
+ item->nick = nullptr;
+ if (nick != nullptr) {
item->nick = mir_strdup(nick);
}
}
break;
default:
item = TlenListGetItemPtr(proto, LIST_CHATROOM, roomID);
- if (item != NULL) {
+ if (item != nullptr) {
TlenSend(proto, "<p to='%s'><s>unavailable</s></p>", jid);
TlenListRemove(proto, LIST_CHATROOM, roomID);
}
@@ -185,7 +185,7 @@ static int TlenMUCSendQuery(TlenProtocol *proto, int type, const char *parent, i item->roomName = mir_strdup(parent);
TlenSend(proto, "<iq to='c' type='3' n='%s' id='%s'/>", parent, serialId);
} else {
- if (parent == NULL) {
+ if (parent == nullptr) {
TlenSend(proto, "<iq to='c' type='%d'/>", type);
} else { // 1 - groups, 2 - chat rooms, 7 - user nicks, 8 - user rooms
if (type == 1 || (type == 2 && page == 0) || type == 7 || type == 8) {
diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index ec23e45445..2c7486e555 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -103,7 +103,7 @@ static LRESULT CALLBACK TlenValidateUsernameWndProc(HWND hwndEdit, UINT msg, WPA { switch (msg) { case WM_CHAR: - if (strchr("\"&'/:<>@", wParam&0xff) != NULL) + if (strchr("\"&'/:<>@", wParam&0xff) != nullptr) return 0; break; } @@ -549,7 +549,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } db_set_s(NULL, proto->m_szModuleName, "ManualHost", text); - port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, NULL, FALSE); + port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, nullptr, FALSE); if (db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port) reconnectRequired = true; db_set_w(NULL, proto->m_szModuleName, "ManualPort", port); @@ -571,7 +571,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, _countof(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text); - db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE)); + db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, nullptr, FALSE)); db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH)); GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, _countof(text)); @@ -654,7 +654,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERMANENT)) { delay=-1; } else { - delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE); + delay=GetDlgItemInt(hwndDlg, IDC_DELAY, nullptr, FALSE); } mir_snwprintf(title, TranslateT("%S mail"), proto->m_szModuleName); MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0), @@ -676,7 +676,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, db_set_b(NULL, proto->m_szModuleName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP)); db_set_dw(NULL, proto->m_szModuleName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0)); db_set_dw(NULL, proto->m_szModuleName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0)); - db_set_dw(NULL, proto->m_szModuleName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE)); + db_set_dw(NULL, proto->m_szModuleName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, nullptr, FALSE)); delayMode=0; if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_CUSTOM)) { delayMode=1; diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp index 75e24250cb..f8c8c0d15a 100644 --- a/protocols/Tlen/src/tlen_p2p_new.cpp +++ b/protocols/Tlen/src/tlen_p2p_new.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void logInfo(const char *filename, const char *fmt, ...) {
va_list vararg;
FILE *flog=fopen(filename,"at");
- if (flog != NULL) {
+ if (flog != nullptr) {
SYSTEMTIME time;
GetLocalTime(&time);
va_start(vararg, fmt);
@@ -60,10 +60,10 @@ void __cdecl TlenNewFileReceiveThread(TLEN_FILE_TRANSFER *ft) toad.sin_family = AF_INET;
toad.sin_addr.s_addr = inet_addr(ft->hostName);
toad.sin_port = htons(ft->wPort);
- if (fout != NULL) {
+ if (fout != nullptr) {
fprintf(fout, "START:\n");
}
- if (fout != NULL) {
+ if (fout != nullptr) {
fclose(fout);
}
while (ft->udps != INVALID_SOCKET) {
@@ -78,7 +78,7 @@ void __cdecl TlenNewFileReceiveThread(TLEN_FILE_TRANSFER *ft) }
logInfo("tlen_recv.dxx", "UDP");
fout = fopen("tlen_recv.dxx", "at");
- if (fout != NULL) {
+ if (fout != nullptr) {
fprintf(fout, "\n|RECV %d bytes from %s:%d|",n, inet_ntoa(cad.sin_addr), cad.sin_port);
for (j = 0; j < n; j++) {
fprintf(fout, "%02X-", buff[j]);
@@ -87,14 +87,14 @@ void __cdecl TlenNewFileReceiveThread(TLEN_FILE_TRANSFER *ft) if (n == 1) {
alen = sizeof(struct sockaddr);
n = sendto(ft->udps, (char*)buff, n, 0,(struct sockaddr *) &toad, alen);
- if (fout != NULL) {
+ if (fout != nullptr) {
fprintf(fout, "\n|SEND |");
for (j = 0; j < n; j++) {
fprintf(fout, "%02X-", buff[j]);
}
}
}
- if (fout != NULL) {
+ if (fout != nullptr) {
fprintf(fout, "\n");
fclose(fout);
}
@@ -129,7 +129,7 @@ void __cdecl TlenNewFileSendThread(TLEN_FILE_TRANSFER *ft) toad.sin_addr.s_addr = inet_addr(ft->hostName);
toad.sin_port = htons(ft->wPort);
- if (fout != NULL) {
+ if (fout != nullptr) {
fprintf(fout, "START:");
}
for (step = 0; step < 10; step ++) {
@@ -150,18 +150,18 @@ void __cdecl TlenNewFileSendThread(TLEN_FILE_TRANSFER *ft) }
n=sendto(ft->udps, (char*)buff, n, 0, (struct sockaddr *)&toad, alen);
logInfo("tlen_send.dxx", "UDP");
- if (fout != NULL) {
+ if (fout != nullptr) {
fprintf(fout, "|send: %d %s %d|",n, inet_ntoa(toad.sin_addr), toad.sin_port);
for (j = 0; j < n; j++) {
fprintf(fout, "%02X-", buff[j]);
}
}
- if (fout != NULL) {
+ if (fout != nullptr) {
fprintf(fout, "\n");
}
SleepEx(1000, TRUE);
}
- if (fout != NULL) {
+ if (fout != nullptr) {
fclose(fout);
}
}
@@ -224,10 +224,10 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { TLEN_LIST_ITEM *item;
char *from;
- if (info == NULL) return;
+ if (info == nullptr) return;
queryNode = TlenXmlGetChild(node, "query");
- if ((from=TlenXmlGetAttrValue(node, "from")) != NULL) {
+ if ((from=TlenXmlGetAttrValue(node, "from")) != nullptr) {
XmlNode *fs , *vs, *dcng, *dc;
/* file send */
fs = TlenXmlGetChild(queryNode, "fs");
@@ -235,7 +235,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { vs = TlenXmlGetChild(queryNode, "vs");
dcng = TlenXmlGetChild(queryNode, "dcng");
dc = TlenXmlGetChild(queryNode, "dc");
- if (fs != NULL) {
+ if (fs != nullptr) {
char *e, *id;
/* e - step in the process (starting with 1)*/
/* i - id of the file */
@@ -244,7 +244,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { /* v - ??? */
e = TlenXmlGetAttrValue(fs, "e");
id = TlenXmlGetAttrValue(fs, "i");
- if (e != NULL) {
+ if (e != nullptr) {
if (!mir_strcmp(e, "1")) {
TLEN_FILE_TRANSFER * ft = (TLEN_FILE_TRANSFER *) mir_alloc(sizeof(TLEN_FILE_TRANSFER));
memset(ft, 0, sizeof(TLEN_FILE_TRANSFER));
@@ -256,7 +256,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { ft->iqId = mir_strdup(id);
ft->fileTotalSize = atoi(s);
ft->newP2P = TRUE;
- if ((item=TlenListAdd(ft->proto, LIST_FILE, ft->iqId)) != NULL) {
+ if ((item=TlenListAdd(ft->proto, LIST_FILE, ft->iqId)) != nullptr) {
char fileInfo[128];
item->ft = ft;
mir_snprintf(fileInfo, "%s file(s), %s bytes", c, s);
@@ -264,7 +264,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = filenameT;
pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
@@ -278,16 +278,16 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { /* transfer denied */
} else if (!mir_strcmp(e, "5")) {
/* transfer accepted */
- if ((item=TlenListGetItemPtr(info->proto, LIST_FILE, id)) != NULL) {
+ if ((item=TlenListGetItemPtr(info->proto, LIST_FILE, id)) != nullptr) {
item->id2 = mir_strdup("84273372");
item->ft->id2 = mir_strdup("84273372");
TlenSend(info->proto, "<iq to='%s'><query xmlns='p2p'><dcng n='file_send' k='5' v='2' s='1' i='%s' ck='o7a32V9n2UZYCWpBUhSbFw==' ks='16' iv='MhjWEj9WTsovrQc=o7a32V9n2UZYCWpBUhSbFw==' mi='%s'/></query></iq>", from, item->id2, id);
}
}
}
- } else if (vs != NULL) {
+ } else if (vs != nullptr) {
- } else if (dcng != NULL) {
+ } else if (dcng != nullptr) {
info->proto->debugLogA("DCNG");
char *s = TlenXmlGetAttrValue(dcng, "s");
char *id2 = TlenXmlGetAttrValue(dcng, "i");
@@ -304,7 +304,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { /* v - ? */
char *n = TlenXmlGetAttrValue(dcng, "n"); // n - name (file_send)
if (!mir_strcmp(n, "file_send")) {
- if ((item=TlenListGetItemPtr(info->proto, LIST_FILE, id)) != NULL) {
+ if ((item=TlenListGetItemPtr(info->proto, LIST_FILE, id)) != nullptr) {
item->id2 = mir_strdup(id2);
item->ft->id2 = mir_strdup(id2);
TlenBindUDPSocket(item->ft);
@@ -317,7 +317,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { info->proto->debugLogA("%s",from);
info->proto->debugLogA("%s",id2);
/* IP and port */
- if ((item=TlenListFindItemPtrById2(info->proto, LIST_FILE, id2)) != NULL) {
+ if ((item=TlenListFindItemPtrById2(info->proto, LIST_FILE, id2)) != nullptr) {
item->ft->hostName = mir_strdup(TlenXmlGetAttrValue(dcng, "pa"));
item->ft->wPort = atoi(TlenXmlGetAttrValue(dcng, "pp"));
TlenBindUDPSocket(item->ft);
@@ -328,7 +328,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { }
} else if (!mir_strcmp(s, "4")) {
/* IP and port */
- if ((item=TlenListFindItemPtrById2(info->proto, LIST_FILE, id2)) != NULL) {
+ if ((item=TlenListFindItemPtrById2(info->proto, LIST_FILE, id2)) != nullptr) {
info->proto->debugLogA("step = 4");
item->ft->hostName = mir_strdup(TlenXmlGetAttrValue(dcng, "pa"));
item->ft->wPort = atoi(TlenXmlGetAttrValue(dcng, "pp"));
@@ -336,7 +336,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { }
}
- } else if (dc != NULL) {
+ } else if (dc != nullptr) {
}
}
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index 2180bde7a7..d5a71a204e 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -50,13 +50,13 @@ void TlenP2PFreeFileTransfer(TLEN_FILE_TRANSFER *ft) TLEN_FILE_PACKET *TlenP2PPacketCreate(int datalen)
{
TLEN_FILE_PACKET *packet=(TLEN_FILE_PACKET *) mir_alloc(sizeof(TLEN_FILE_PACKET));
- if (packet == NULL)
- return NULL;
- packet->packet = NULL;
+ if (packet == nullptr)
+ return nullptr;
+ packet->packet = nullptr;
if (datalen > 0) {
- if ((packet->packet=(char *) mir_alloc(datalen)) == NULL) {
+ if ((packet->packet=(char *) mir_alloc(datalen)) == nullptr) {
mir_free(packet);
- return NULL;
+ return nullptr;
}
}
packet->maxDataLen = datalen;
@@ -67,8 +67,8 @@ TLEN_FILE_PACKET *TlenP2PPacketCreate(int datalen) void TlenP2PPacketFree(TLEN_FILE_PACKET *packet)
{
- if (packet != NULL) {
- if (packet->packet != NULL)
+ if (packet != nullptr) {
+ if (packet->packet != nullptr)
mir_free(packet->packet);
mir_free(packet);
}
@@ -76,21 +76,21 @@ void TlenP2PPacketFree(TLEN_FILE_PACKET *packet) void TlenP2PPacketSetType(TLEN_FILE_PACKET *packet, DWORD type)
{
- if (packet != NULL) {
+ if (packet != nullptr) {
packet->type = type;
}
}
void TlenP2PPacketSetLen(TLEN_FILE_PACKET *packet, DWORD len)
{
- if (packet != NULL) {
+ if (packet != nullptr) {
packet->len = len;
}
}
void TlenP2PPacketPackDword(TLEN_FILE_PACKET *packet, DWORD data)
{
- if (packet != NULL && packet->packet != NULL) {
+ if (packet != nullptr && packet->packet != nullptr) {
if (packet->len + sizeof(DWORD) <= packet->maxDataLen) {
(*((DWORD*)((packet->packet)+(packet->len)))) = data;
packet->len += sizeof(DWORD);
@@ -100,7 +100,7 @@ void TlenP2PPacketPackDword(TLEN_FILE_PACKET *packet, DWORD data) void TlenP2PPacketPackBuffer(TLEN_FILE_PACKET *packet, char *buffer, int len)
{
- if (packet != NULL && packet->packet != NULL) {
+ if (packet != nullptr && packet->packet != nullptr) {
if (packet->len + len <= packet->maxDataLen) {
memcpy((packet->packet)+(packet->len), buffer, len);
packet->len += len;
@@ -117,7 +117,7 @@ void TlenP2PUninit() { int TlenP2PPacketSend(HNETLIBCONN s, TLEN_FILE_PACKET *packet)
{
DWORD sendResult;
- if (packet != NULL && packet->packet != NULL) {
+ if (packet != nullptr && packet->packet != nullptr) {
Netlib_Send(s, (char *)&packet->type, 4, MSG_NODUMP);
Netlib_Send(s, (char *)&packet->len, 4, MSG_NODUMP);
sendResult=Netlib_Send(s, packet->packet, packet->len, MSG_NODUMP);
@@ -130,9 +130,9 @@ TLEN_FILE_PACKET* TlenP2PPacketReceive(HNETLIBCONN s) {
DWORD type, len, pos;
DWORD recvResult = Netlib_Recv(s, (char *)&type, 4, MSG_NODUMP);
- if (recvResult == 0 || recvResult == SOCKET_ERROR) return NULL;
+ if (recvResult == 0 || recvResult == SOCKET_ERROR) return nullptr;
recvResult = Netlib_Recv(s, (char *)&len, 4, MSG_NODUMP);
- if (recvResult == 0 || recvResult == SOCKET_ERROR) return NULL;
+ if (recvResult == 0 || recvResult == SOCKET_ERROR) return nullptr;
TLEN_FILE_PACKET *packet = TlenP2PPacketCreate(len);
TlenP2PPacketSetType(packet, type);
TlenP2PPacketSetLen(packet, len);
@@ -141,7 +141,7 @@ TLEN_FILE_PACKET* TlenP2PPacketReceive(HNETLIBCONN s) recvResult = Netlib_Recv(s, packet->packet+pos, len, MSG_NODUMP);
if (recvResult == 0 || recvResult == SOCKET_ERROR) {
TlenP2PPacketFree(packet);
- return NULL;
+ return nullptr;
}
len -= recvResult;
pos += recvResult;
@@ -157,7 +157,7 @@ void TlenP2PEstablishOutgoingConnection(TLEN_FILE_TRANSFER *ft, BOOL sendAck) proto->debugLogA("Establishing outgoing connection.");
ft->state = FT_ERROR;
TLEN_FILE_PACKET *packet = TlenP2PPacketCreate(2*sizeof(DWORD) + 20);
- if (packet != NULL) {
+ if (packet != nullptr) {
TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_CONNECTION_REQUEST);
TlenP2PPacketPackDword(packet, 1);
TlenP2PPacketPackDword(packet, (DWORD) atoi(ft->iqId));
@@ -168,7 +168,7 @@ void TlenP2PEstablishOutgoingConnection(TLEN_FILE_TRANSFER *ft, BOOL sendAck) TlenP2PPacketSend(ft->s, packet);
TlenP2PPacketFree(packet);
packet = TlenP2PPacketReceive(ft->s);
- if (packet != NULL) {
+ if (packet != nullptr) {
if (packet->type == TLEN_FILE_PACKET_CONNECTION_REQUEST_ACK) { // acknowledge
if ((int)(*((DWORD*)packet->packet)) == atoi(ft->iqId)) {
ft->state = FT_CONNECTING;
@@ -192,18 +192,18 @@ TLEN_FILE_TRANSFER* TlenP2PEstablishIncomingConnection(TlenProtocol *proto, HNET // (DWORD) id
// (BYTE) hash[20]
TLEN_FILE_PACKET *packet = TlenP2PPacketReceive(s);
- if (packet == NULL || packet->type != TLEN_FILE_PACKET_CONNECTION_REQUEST || packet->len<28) {
- if (packet != NULL) {
+ if (packet == nullptr || packet->type != TLEN_FILE_PACKET_CONNECTION_REQUEST || packet->len<28) {
+ if (packet != nullptr) {
TlenP2PPacketFree(packet);
}
- return NULL;
+ return nullptr;
}
iqId = *((DWORD *)(packet->packet+sizeof(DWORD)));
int i = 0;
TLEN_LIST_ITEM *item;
while ((i=TlenListFindNext(proto, list, i)) >= 0) {
item = TlenListGetItemPtrFromIndex(proto, i);
- if (item != NULL) {
+ if (item != nullptr) {
mir_snprintf(str, "%d", iqId);
if (!mir_strcmp(item->ft->iqId, str)) {
char *hash, *nick;
@@ -223,7 +223,7 @@ TLEN_FILE_TRANSFER* TlenP2PEstablishIncomingConnection(TlenProtocol *proto, HNET }
TlenP2PPacketFree(packet);
if (i >=0) {
- if ((packet=TlenP2PPacketCreate(sizeof(DWORD))) != NULL) {
+ if ((packet=TlenP2PPacketCreate(sizeof(DWORD))) != nullptr) {
// Send connection establishment acknowledgement
TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_CONNECTION_REQUEST_ACK);
TlenP2PPacketPackDword(packet, (DWORD) atoi(item->ft->iqId));
@@ -236,7 +236,7 @@ TLEN_FILE_TRANSFER* TlenP2PEstablishIncomingConnection(TlenProtocol *proto, HNET return item->ft;
}
}
- return NULL;
+ return nullptr;
}
static void __cdecl TlenFileBindSocks4Thread(TLEN_FILE_TRANSFER* ft)
@@ -252,7 +252,7 @@ static void __cdecl TlenFileBindSocks4Thread(TLEN_FILE_TRANSFER* ft) status = 0;
}
if (!status) {
- ft->pfnNewConnectionV2(ft->s, 0, NULL);
+ ft->pfnNewConnectionV2(ft->s, 0, nullptr);
} else {
if (ft->state != FT_SWITCH) {
ft->state = FT_ERROR;
@@ -260,7 +260,7 @@ static void __cdecl TlenFileBindSocks4Thread(TLEN_FILE_TRANSFER* ft) }
ft->proto->debugLogA("Closing connection for this file transfer...");
// Netlib_CloseHandle(ft->s);
- if (ft->hFileEvent != NULL)
+ if (ft->hFileEvent != nullptr)
SetEvent(ft->hFileEvent);
}
@@ -277,7 +277,7 @@ static void __cdecl TlenFileBindSocks5Thread(TLEN_FILE_TRANSFER* ft) status = 0;
}
if (!status) {
- ft->pfnNewConnectionV2(ft->s, 0, NULL);
+ ft->pfnNewConnectionV2(ft->s, 0, nullptr);
} else {
if (ft->state != FT_SWITCH) {
ft->state = FT_ERROR;
@@ -285,7 +285,7 @@ static void __cdecl TlenFileBindSocks5Thread(TLEN_FILE_TRANSFER* ft) }
// TlenLog("Closing connection for this file transfer...");
// Netlib_CloseHandle(ft->s);
- if (ft->hFileEvent != NULL)
+ if (ft->hFileEvent != nullptr)
SetEvent(ft->hFileEvent);
}
@@ -301,9 +301,9 @@ static HNETLIBCONN TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) nloc.szHost = sb->szHost;
nloc.wPort = sb->wPort;
HNETLIBCONN s = Netlib_OpenConnection(ft->proto->hFileNetlibUser, &nloc);
- if (s == NULL) {
+ if (s == nullptr) {
// TlenLog("Connection failed (%d), thread ended", WSAGetLastError());
- return NULL;
+ return nullptr;
}
buf[0] = 4; //socks4
buf[1] = 2; //2-bind, 1-connect
@@ -321,19 +321,19 @@ static HNETLIBCONN TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) if (status == SOCKET_ERROR || status < len) {
// TlenLog("Send failed (%d), thread ended", WSAGetLastError());
Netlib_CloseHandle(s);
- return NULL;
+ return nullptr;
}
status = Netlib_Recv(s, (char*)buf, 8, MSG_NODUMP);
if (status == SOCKET_ERROR || status < 8 || buf[1] != 90) {
// TlenLog("SOCKS4 negotiation failed");
Netlib_CloseHandle(s);
- return NULL;
+ return nullptr;
}
status = Netlib_Recv(s, (char*)buf, sizeof(buf), MSG_NODUMP);
if ( status == SOCKET_ERROR || status < 7 || buf[0] != 5 || buf[1] != 0) {
// TlenLog("SOCKS5 request failed");
Netlib_CloseHandle(s);
- return NULL;
+ return nullptr;
}
in.S_un.S_addr = *(PDWORD)(buf+4);
strncpy(sb->szHost, inet_ntoa(in), sizeof(sb->szHost)-1);
@@ -353,9 +353,9 @@ static HNETLIBCONN TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) nloc.szHost = sb->szHost;
nloc.wPort = sb->wPort;
HNETLIBCONN s = Netlib_OpenConnection(ft->proto->hFileNetlibUser, &nloc);
- if (s == NULL) {
+ if (s == nullptr) {
ft->proto->debugLogA("Connection failed (%d), thread ended", WSAGetLastError());
- return NULL;
+ return nullptr;
}
buf[0] = 5; //yep, socks5
buf[1] = 1; //one auth method
@@ -364,13 +364,13 @@ static HNETLIBCONN TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) if (status == SOCKET_ERROR || status < 3) {
ft->proto->debugLogA("Send failed (%d), thread ended", WSAGetLastError());
Netlib_CloseHandle(s);
- return NULL;
+ return nullptr;
}
status = Netlib_Recv(s, (char*)buf, 2, MSG_NODUMP);
if (status == SOCKET_ERROR || status < 2 || (buf[1] != 0 && buf[1] != 2)) {
ft->proto->debugLogA("SOCKS5 negotiation failed");
Netlib_CloseHandle(s);
- return NULL;
+ return nullptr;
}
if (buf[1] == 2) { //rfc1929
int nUserLen, nPassLen;
@@ -389,13 +389,13 @@ static HNETLIBCONN TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) if (status == SOCKET_ERROR || status < 3 + nUserLen+nPassLen) {
ft->proto->debugLogA("Send failed (%d), thread ended", WSAGetLastError());
Netlib_CloseHandle(s);
- return NULL;
+ return nullptr;
}
status = Netlib_Recv(s, (char*)buf, sizeof(buf), MSG_NODUMP);
if (status == SOCKET_ERROR || status < 2 || buf[1] != 0) {
ft->proto->debugLogA("SOCKS5 sub-negotiation failed");
Netlib_CloseHandle(s);
- return NULL;
+ return nullptr;
}
}
@@ -414,14 +414,14 @@ static HNETLIBCONN TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) if (status == SOCKET_ERROR || status < 6 + nHostLen) {
// TlenLog("Send failed (%d), thread ended", WSAGetLastError());
Netlib_CloseHandle(s);
- return NULL;
+ return nullptr;
}
}
status = Netlib_Recv(s, (char*)buf, sizeof(buf), MSG_NODUMP);
if ( status == SOCKET_ERROR || status < 7 || buf[0] != 5 || buf[1] != 0) {
// TlenLog("SOCKS5 request failed");
Netlib_CloseHandle(s);
- return NULL;
+ return nullptr;
}
if (buf[2] == 1) { // domain
len = buf[4];
@@ -443,15 +443,15 @@ static HNETLIBCONN TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) HNETLIBCONN TlenP2PListen(TLEN_FILE_TRANSFER *ft)
{
- HNETLIBCONN s = NULL;
+ HNETLIBCONN s = nullptr;
int useProxy;
DBVARIANT dbv;
SOCKSBIND sb;
struct in_addr in;
TlenProtocol *proto = ft->proto;
useProxy=0;
- if (ft->localName != NULL) mir_free(ft->localName);
- ft->localName = NULL;
+ if (ft->localName != nullptr) mir_free(ft->localName);
+ ft->localName = nullptr;
ft->wPort = 0;
if (db_get_b(NULL, proto->m_szModuleName, "UseFileProxy", FALSE)) {
if (!db_get(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
@@ -506,14 +506,14 @@ HNETLIBCONN TlenP2PListen(TLEN_FILE_TRANSFER *ft) ft->wPort = nlb.wPort;
ft->wLocalPort = nlb.wExPort;
}
- if (s != NULL) {
+ if (s != nullptr) {
// listenCount++;
}
return s;
}
void TlenP2PStopListening(HANDLE s) {
- if (s != NULL) {
+ if (s != nullptr) {
// listenCount--;
// if (listenCount <= 0) {
// Netlib_CloseHandle(s);
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index 79e9b7b545..f75e0a42e6 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -44,10 +44,10 @@ static void TlenPsPostThread(void *ptr) { TLEN_LIST_ITEM *item = data->item;
HNETLIBCONN socket = TlenWsConnect(proto, "ps.tlen.pl", 443);
BOOL bSent = FALSE;
- if (socket != NULL) {
+ if (socket != nullptr) {
char header[512];
item->ft->s = socket;
- item->ft->hFileEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ item->ft->hFileEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
int ret = mir_snprintf(header, "<pic auth='%s' t='p' to='%s' size='%d' idt='%s'/>", proto->threadData->username, item->ft->jid, item->ft->fileTotalSize, item->jid);
TlenWsSend(proto, socket, header, ret);
ret = WaitForSingleObject(item->ft->hFileEvent, 1000 * 60 * 5);
@@ -100,7 +100,7 @@ static void TlenPsGetThread(void *ptr) { fp = fopen( item->ft->files[0], "wb" );
if (fp) {
HNETLIBCONN socket = TlenWsConnect(proto, "ps.tlen.pl", 443);
- if (socket != NULL) {
+ if (socket != nullptr) {
XmlState xmlState;
char header[512];
char fileBuffer[2048];
@@ -121,7 +121,7 @@ static void TlenPsGetThread(void *ptr) { if (bHeader) {
char * tagend = (char*)memchr(fileBuffer, '/', totalcount);
tagend = (char*)memchr(tagend + 1, '>', totalcount - (tagend - fileBuffer) - 1);
- if (tagend != NULL) {
+ if (tagend != nullptr) {
int parsed = TlenXmlParse(&xmlState, fileBuffer, tagend - fileBuffer + 1);
if (parsed == 0) {
continue;
@@ -166,7 +166,7 @@ static void TlenPsGet(TlenProtocol *proto, TLEN_LIST_ITEM *item) { }
void TlenProcessPic(XmlNode *node, TlenProtocol *proto) {
- TLEN_LIST_ITEM *item = NULL;
+ TLEN_LIST_ITEM *item = nullptr;
char *crc, *crc_c, *idt, *size, *from, *fromRaw, *rt;
from = TlenXmlGetAttrValue(node, "from");
fromRaw = TlenLoginFromJID(from);
@@ -175,22 +175,22 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { crc_c = TlenXmlGetAttrValue(node, "crc_c");
crc = TlenXmlGetAttrValue(node, "crc");
rt = TlenXmlGetAttrValue(node, "rt");
- if (idt != NULL) {
+ if (idt != nullptr) {
item = TlenListGetItemPtr(proto, LIST_PICTURE, idt);
}
- if (item != NULL) {
+ if (item != nullptr) {
if (!mir_strcmp(from, "ps")) {
char *st = TlenXmlGetAttrValue(node, "st");
- if (st != NULL) {
+ if (st != nullptr) {
item->ft->iqId = mir_strdup(st);
item->ft->id2 = mir_strdup(rt);
- if (item->ft->hFileEvent != NULL) {
+ if (item->ft->hFileEvent != nullptr) {
SetEvent(item->ft->hFileEvent);
- item->ft->hFileEvent = NULL;
+ item->ft->hFileEvent = nullptr;
}
}
} else if (!mir_strcmp(item->ft->jid, fromRaw)) {
- if (crc_c != NULL) {
+ if (crc_c != nullptr) {
if (!mir_strcmp(crc_c, "n")) {
/* crc_c = n, picture transfer accepted */
TlenPsPost(proto, item);
@@ -200,12 +200,12 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { TlenP2PFreeFileTransfer(item->ft);
TlenListRemove(proto, LIST_PICTURE, idt);
}
- } else if (rt != NULL) {
+ } else if (rt != nullptr) {
item->ft->id2 = mir_strdup(rt);
TlenPsGet(proto, item);
}
}
- } else if (crc != NULL) {
+ } else if (crc != nullptr) {
BOOL bAccept = proto->tlenOptions.imagePolicy == TLEN_IMAGES_ACCEPT_ALL || (proto->tlenOptions.imagePolicy == TLEN_IMAGES_IGNORE_NIR && IsAuthorized(proto, from));
if (bAccept) {
FILE* fp;
@@ -257,7 +257,7 @@ BOOL SendPicture(TlenProtocol *proto, MCONTACT hContact) { OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.lpstrFilter = tszFilter;
- ofn.lpstrCustomFilter = NULL;
+ ofn.lpstrCustomFilter = nullptr;
ofn.lpstrFile = tszFileName;
ofn.nMaxFile = _MAX_PATH;
ofn.Flags = OFN_FILEMUSTEXIST;
diff --git a/protocols/Tlen/src/tlen_presence.cpp b/protocols/Tlen/src/tlen_presence.cpp index 56e4fc9e10..3e12761582 100644 --- a/protocols/Tlen/src/tlen_presence.cpp +++ b/protocols/Tlen/src/tlen_presence.cpp @@ -33,19 +33,19 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) int status, laststatus = ID_STATUS_OFFLINE; char *p; - if ((from=TlenXmlGetAttrValue(node, "from")) != NULL) { + if ((from=TlenXmlGetAttrValue(node, "from")) != nullptr) { if (TlenListExist(proto, LIST_CHATROOM, from)); //TlenGroupchatProcessPresence(node, userdata); else { type = TlenXmlGetAttrValue(node, "type"); item = TlenListGetItemPtr(proto, LIST_ROSTER, from); - if (item != NULL) { + if (item != nullptr) { if (proto->tlenOptions.enableAvatars) { TlenProcessPresenceAvatar(proto, node, item); } } - if (type == NULL || (!mir_strcmp(type, "available"))) { - if ((nick=TlenLocalNickFromJID(from)) != NULL) { + if (type == nullptr || (!mir_strcmp(type, "available"))) { + if ((nick=TlenLocalNickFromJID(from)) != nullptr) { if ((hContact=TlenHContactFromJID(proto, from)) == NULL) hContact = TlenDBCreateContact(proto, from, nick, FALSE); if (!TlenListExist(proto, LIST_ROSTER, from)) { @@ -53,8 +53,8 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) TlenListAdd(proto, LIST_ROSTER, from); } status = ID_STATUS_ONLINE; - if ((showNode=TlenXmlGetChild(node, "show")) != NULL) { - if ((show=showNode->text) != NULL) { + if ((showNode=TlenXmlGetChild(node, "show")) != nullptr) { + if ((show=showNode->text) != nullptr) { if (!mir_strcmp(show, "away")) status = ID_STATUS_AWAY; else if (!mir_strcmp(show, "xa")) status = ID_STATUS_NA; else if (!mir_strcmp(show, "dnd")) status = ID_STATUS_DND; @@ -70,9 +70,9 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) if (statusNode) p = TlenTextDecode(statusNode->text); else - p = NULL; - TlenListAddResource(proto, LIST_ROSTER, from, status, statusNode?p:NULL); - if (p != NULL && *p) { + p = nullptr; + TlenListAddResource(proto, LIST_ROSTER, from, status, statusNode?p:nullptr); + if (p != nullptr && *p) { char* statusMsg_utf8 = mir_utf8encode(p); db_set_utf(hContact, "CList", "StatusMsg", statusMsg_utf8); mir_free(statusMsg_utf8); @@ -81,15 +81,15 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) db_unset(hContact, "CList", "StatusMsg"); } // Determine status to show for the contact and request version information - if (item != NULL) { + if (item != nullptr) { laststatus = item->status; item->status = status; } - if (strchr(from, '@') != NULL || db_get_b(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { + if (strchr(from, '@') != nullptr || db_get_b(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) db_set_w(hContact, proto->m_szModuleName, "Status", (WORD) status); } - if (item != NULL) { + if (item != nullptr) { if (!item->infoRequested) { int iqId = TlenSerialNext(proto); item->infoRequested = TRUE; @@ -123,10 +123,10 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) p = TlenTextDecode(statusNode->text); } else - p = NULL; + p = nullptr; TlenListAddResource(proto, LIST_ROSTER, from, status, p); if ((hContact=TlenHContactFromJID(proto, from)) != NULL) { - if (p != NULL && *p) { + if (p != nullptr && *p) { char* statusMsg_utf8 = mir_utf8encode(p); db_set_utf(hContact, "CList", "StatusMsg", statusMsg_utf8); mir_free(statusMsg_utf8); @@ -135,18 +135,18 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) db_unset(hContact, "CList", "StatusMsg"); } } - if ((item=TlenListGetItemPtr(proto, LIST_ROSTER, from)) != NULL) { + if ((item=TlenListGetItemPtr(proto, LIST_ROSTER, from)) != nullptr) { // Determine status to show for the contact based on the remaining resources item->status = status; item->versionRequested = FALSE; item->infoRequested = FALSE; } if ((hContact=TlenHContactFromJID(proto, from)) != NULL) { - if (strchr(from, '@') != NULL || db_get_b(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { + if (strchr(from, '@') != nullptr || db_get_b(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) db_set_w(hContact, proto->m_szModuleName, "Status", (WORD) status); } - if (item != NULL && item->isTyping) { + if (item != nullptr && item->isTyping) { item->isTyping = FALSE; CallService(MS_PROTO_CONTACTISTYPING, hContact, PROTOTYPE_CONTACTTYPING_OFF); } @@ -154,18 +154,18 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) } } else if (!mir_strcmp(type, "subscribe")) { - if (strchr(from, '@') == NULL) { + if (strchr(from, '@') == nullptr) { // automatically send authorization allowed to agent/transport TlenSend(proto, "<presence to='%s' type='subscribed'/>", from); } - else if ((nick=TlenNickFromJID(from)) != NULL) { + else if ((nick=TlenNickFromJID(from)) != nullptr) { proto->debugLogA("%s (%s) requests authorization", nick, from); TlenDBAddAuthRequest(proto, from, nick); mir_free(nick); } } else if (!mir_strcmp(type, "subscribed")) { - if ((item=TlenListGetItemPtr(proto, LIST_ROSTER, from)) != NULL) { + if ((item=TlenListGetItemPtr(proto, LIST_ROSTER, from)) != nullptr) { if (item->subscription == SUB_FROM) item->subscription = SUB_BOTH; else if (item->subscription == SUB_NONE) { item->subscription = SUB_TO; @@ -184,7 +184,7 @@ void setOwnStatusOnCList(TlenProtocol *proto, int status, char *statusMsg) if(hContact){ if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) db_set_w(hContact, proto->m_szModuleName, "Status", (WORD)status); - if (statusMsg != NULL && *statusMsg) { + if (statusMsg != nullptr && *statusMsg) { char* statusMsg_utf8 = mir_utf8encode(statusMsg); db_set_utf(hContact, "CList", "StatusMsg", statusMsg_utf8); mir_free(statusMsg_utf8); @@ -197,7 +197,7 @@ void setOwnStatusOnCList(TlenProtocol *proto, int status, char *statusMsg) static void TlenSendPresenceTo(TlenProtocol *proto, int status, char*) { char *showBody, *statusMsg, *presenceType; - char *ptr = NULL; + char *ptr = nullptr; if (!proto->isOnline) return; @@ -205,9 +205,9 @@ static void TlenSendPresenceTo(TlenProtocol *proto, int status, char*) // Note: tlenModeMsg is already encoded using TlenTextEncode() mir_cslock lck(proto->modeMsgMutex); - showBody = NULL; - statusMsg = NULL; - presenceType = NULL; + showBody = nullptr; + statusMsg = nullptr; + presenceType = nullptr; switch (status) { case ID_STATUS_ONLINE: showBody = "available"; @@ -277,9 +277,9 @@ static void TlenSendPresenceTo(TlenProtocol *proto, int status, char*) for (i=0;ptr[i];i++) { if (ptr[i] != '%') continue; if (!_strnicmp(ptr+i,"%time%",6)) - GetTimeFormatA(LOCALE_USER_DEFAULT,TIME_NOSECONDS,NULL,NULL,substituteStr,sizeof(substituteStr)); + GetTimeFormatA(LOCALE_USER_DEFAULT,TIME_NOSECONDS,nullptr,nullptr,substituteStr,sizeof(substituteStr)); else if (!_strnicmp(ptr+i,"%date%",6)) - GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,NULL,NULL,substituteStr,sizeof(substituteStr)); + GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,nullptr,nullptr,substituteStr,sizeof(substituteStr)); else continue; if (mir_strlen(substituteStr)>6) ptr=(char*)mir_realloc(ptr,mir_strlen(ptr)+1+mir_strlen(substituteStr)-6); memmove(ptr+i+mir_strlen(substituteStr),ptr+i+6,mir_strlen(ptr)-i-5); @@ -297,12 +297,12 @@ static void TlenSendPresenceTo(TlenProtocol *proto, int status, char*) } proto->m_iStatus = status; if (presenceType) { - if (statusMsg != NULL && *statusMsg) + if (statusMsg != nullptr && *statusMsg) TlenSend(proto, "<presence type='%s'><status>%s</status></presence>", presenceType, ptrA(TlenTextEncode(statusMsg))); else TlenSend(proto, "<presence type='%s'></presence>", presenceType); } else { - if (statusMsg != NULL && *statusMsg) + if (statusMsg != nullptr && *statusMsg) TlenSend(proto, "<presence><show>%s</show><status>%s</status></presence>", showBody, ptrA(TlenTextEncode(statusMsg))); else TlenSend(proto, "<presence><show>%s</show></presence>", showBody); @@ -335,7 +335,7 @@ void TlenSendPresence(TlenProtocol *proto, int statusIn) statusOut = ID_STATUS_DND; break; } - TlenSendPresenceTo(proto, statusOut, NULL); + TlenSendPresenceTo(proto, statusOut, nullptr); } diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index efced9bb74..1366155ccb 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -62,7 +62,7 @@ INT_PTR TlenProtocol::GetName(WPARAM wParam, LPARAM lParam) int TlenRunSearch(TlenProtocol *proto) {
int iqId = 0;
if (!proto->isOnline) return 0;
- if (proto->searchQuery != NULL && proto->searchIndex < 10) {
+ if (proto->searchQuery != nullptr && proto->searchIndex < 10) {
iqId = proto->searchID;
TlenIqAdd(proto, iqId, IQ_PROC_GETSEARCH, TlenIqResultSearch);
if (proto->searchIndex == 0) {
@@ -77,9 +77,9 @@ int TlenRunSearch(TlenProtocol *proto) { }
void TlenResetSearchQuery(TlenProtocol *proto) {
- if (proto->searchQuery != NULL) {
+ if (proto->searchQuery != nullptr) {
mir_free(proto->searchQuery);
- proto->searchQuery = NULL;
+ proto->searchQuery = nullptr;
}
proto->searchQueryLen = 0;
proto->searchIndex = 0;
@@ -89,11 +89,11 @@ void TlenResetSearchQuery(TlenProtocol *proto) { HANDLE TlenProtocol::SearchBasic(const wchar_t* id)
{
int iqId = 0;
- if (!isOnline) return 0;
- if (id == NULL) return 0;
+ if (!isOnline) return nullptr;
+ if (id == nullptr) return nullptr;
char* id_A = mir_u2a(id);
char *jid = TlenTextEncode(id_A);
- if (jid != NULL) {
+ if (jid != nullptr) {
searchJID = mir_strdup(id_A);
TlenResetSearchQuery(this);
TlenStringAppend(&searchQuery, &searchQueryLen, "<i>%s</i>", jid);
@@ -108,12 +108,12 @@ HANDLE TlenProtocol::SearchByEmail(const wchar_t* email) {
int iqId = 0;
- if (!isOnline) return 0;
- if (email == NULL) return 0;
+ if (!isOnline) return nullptr;
+ if (email == nullptr) return nullptr;
char* email_A = mir_u2a(email);
char *emailEnc = TlenTextEncode(email_A);
- if (emailEnc != NULL) {
+ if (emailEnc != nullptr) {
TlenResetSearchQuery(this);
TlenStringAppend(&searchQuery, &searchQueryLen, "<email>%s</email>", emailEnc);
iqId = TlenRunSearch(this);
@@ -125,7 +125,7 @@ HANDLE TlenProtocol::SearchByEmail(const wchar_t* email) HANDLE TlenProtocol::SearchByName(const wchar_t* nickT, const wchar_t* firstNameT, const wchar_t* lastNameT)
{
- if (!isOnline) return 0;
+ if (!isOnline) return nullptr;
char *nick = mir_u2a(nickT);
char *firstName = mir_u2a(firstNameT);
@@ -136,20 +136,20 @@ HANDLE TlenProtocol::SearchByName(const wchar_t* nickT, const wchar_t* firstName TlenResetSearchQuery(this);
- if (nick != NULL && nick[0] != '\0') {
- if ((p = TlenTextEncode(nick)) != NULL) {
+ if (nick != nullptr && nick[0] != '\0') {
+ if ((p = TlenTextEncode(nick)) != nullptr) {
TlenStringAppend(&searchQuery, &searchQueryLen, "<nick>%s</nick>", p);
mir_free(p);
}
}
- if (firstName != NULL && firstName[0] != '\0') {
- if ((p = TlenTextEncode(firstName)) != NULL) {
+ if (firstName != nullptr && firstName[0] != '\0') {
+ if ((p = TlenTextEncode(firstName)) != nullptr) {
TlenStringAppend(&searchQuery, &searchQueryLen, "<first>%s</first>", p);
mir_free(p);
}
}
- if (lastName != NULL && lastName[0] != '\0') {
- if ((p = TlenTextEncode(lastName)) != NULL) {
+ if (lastName != nullptr && lastName[0] != '\0') {
+ if ((p = TlenTextEncode(lastName)) != nullptr) {
TlenStringAppend(&searchQuery, &searchQueryLen, "<last>%s</last>", p);
mir_free(p);
}
@@ -166,11 +166,11 @@ HWND TlenProtocol::CreateExtendedSearchUI(HWND owner) HWND TlenProtocol::SearchAdvanced(HWND owner)
{
- if (!isOnline) return 0;
+ if (!isOnline) return nullptr;
TlenResetSearchQuery(this);
int iqId = TlenSerialNext(this);
- if ((searchQuery = TlenAdvSearchCreateQuery(owner, iqId)) != NULL) {
+ if ((searchQuery = TlenAdvSearchCreateQuery(owner, iqId)) != nullptr) {
iqId = TlenRunSearch(this);
}
return (HWND)iqId;
@@ -187,7 +187,7 @@ static MCONTACT AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD fl Proto_AddToContact(hContact, proto->m_szModuleName);
db_set_s(hContact, proto->m_szModuleName, "jid", jid);
char *nick = TlenNickFromJID(newJid);
- if (nick == NULL)
+ if (nick == nullptr)
nick = mir_strdup(newJid);
db_set_s(hContact, "CList", "MyHandle", nick);
mir_free(nick);
@@ -228,7 +228,7 @@ MCONTACT TlenProtocol::AddToListByEvent(int flags, int, MEVENT hDbEvent) DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return NULL;
- if ((dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob)) == NULL)
+ if ((dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob)) == nullptr)
return NULL;
if (db_event_get(hDbEvent, &dbei)) {
mir_free(dbei.pBlob);
@@ -265,7 +265,7 @@ int TlenProtocol::Authorize(MEVENT hDbEvent) DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)-1)
return 1;
- if ((dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob)) == NULL)
+ if ((dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob)) == nullptr)
return 1;
if (db_event_get(hDbEvent, &dbei)) {
mir_free(dbei.pBlob);
@@ -288,7 +288,7 @@ int TlenProtocol::Authorize(MEVENT hDbEvent) MCONTACT hContact;
TLEN_LIST_ITEM *item = TlenListGetItemPtr(this, LIST_ROSTER, blob.get_email());
- if (item == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) {
+ if (item == nullptr || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) {
debugLogA("Try adding contact automatically jid=%s", blob.get_email());
if ((hContact = AddToListByJID(this, blob.get_email(), 0)) != NULL) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
@@ -310,7 +310,7 @@ int TlenProtocol::AuthDeny(MEVENT hDbEvent, const wchar_t*) DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return 1;
- if ((dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob)) == NULL)
+ if ((dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob)) == nullptr)
return 1;
if (db_event_get(hDbEvent, &dbei)) {
mir_free(dbei.pBlob);
@@ -363,7 +363,7 @@ int TlenProtocol::SetStatus(int iNewStatus) // TODO bug? s = proto;
s = threadData->s;
- threadData = NULL;
+ threadData = nullptr;
if (isConnected) {
Sleep(200);
// TlenSend(s, "</s>");
@@ -438,14 +438,14 @@ int TlenProtocol::SetAwayMsg(int iStatus, const wchar_t* msg) return 1;
}
- if ((*szMsg == NULL && newModeMsg == NULL) ||
- (*szMsg != NULL && newModeMsg != NULL && !mir_strcmp(*szMsg, newModeMsg))) {
+ if ((*szMsg == nullptr && newModeMsg == nullptr) ||
+ (*szMsg != nullptr && newModeMsg != nullptr && !mir_strcmp(*szMsg, newModeMsg))) {
// Message is the same, no update needed
- if (newModeMsg != NULL) mir_free(newModeMsg);
+ if (newModeMsg != nullptr) mir_free(newModeMsg);
}
else {
// Update with the new mode message
- if (*szMsg != NULL) mir_free(*szMsg);
+ if (*szMsg != nullptr) mir_free(*szMsg);
*szMsg = newModeMsg;
// Send a presence update if needed
if (iStatus == m_iStatus) {
@@ -470,8 +470,8 @@ int TlenProtocol::GetInfo(MCONTACT hContact, int) }
else {
if (db_get(hContact, m_szModuleName, "jid", &dbv)) return 1;
- if ((nick = TlenNickFromJID(dbv.pszVal)) != NULL) {
- if ((pNick = TlenTextEncode(nick)) != NULL) {
+ if ((nick = TlenNickFromJID(dbv.pszVal)) != nullptr) {
+ if ((pNick = TlenTextEncode(nick)) != nullptr) {
iqId = TlenSerialNext(this);
TlenIqAdd(this, iqId, IQ_PROC_NONE, TlenIqResultVcard);
TlenSend(this, "<iq type='get' id='" TLEN_IQID "%d' to='tuba'><query xmlns='jabber:iq:search'><i>%s</i></query></iq>", iqId, pNick);
@@ -557,7 +557,7 @@ static void __cdecl TlenGetAwayMsgThread(void *ptr) if (!db_get(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
TLEN_LIST_ITEM *item = TlenListGetItemPtr(data->proto, LIST_ROSTER, dbv.pszVal);
- if (item != NULL) {
+ if (item != nullptr) {
db_free(&dbv);
ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1,
item->statusMessage == NULL ? NULL : _A2T(item->statusMessage));
@@ -619,8 +619,8 @@ int TlenProtocol::SendMsg(MCONTACT hContact, int, const char* msgRAW) }
else {
char *msgEnc = TlenTextEncode(msg);
- if (msgEnc != NULL) {
- if (TlenListExist(this, LIST_CHATROOM, dbv.pszVal) && strchr(dbv.pszVal, '/') == NULL)
+ if (msgEnc != nullptr) {
+ if (TlenListExist(this, LIST_CHATROOM, dbv.pszVal) && strchr(dbv.pszVal, '/') == nullptr)
mir_strcpy(msgType, "groupchat");
else if (db_get_b(hContact, m_szModuleName, "bChat", FALSE))
mir_strcpy(msgType, "privchat");
@@ -638,7 +638,7 @@ int TlenProtocol::SendMsg(MCONTACT hContact, int, const char* msgRAW) mir_forkthread(TlenSendMessageAckThread, new SENDACKTHREADDATA(this, hContact, id));
}
else {
- if ((item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != NULL)
+ if ((item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != nullptr)
item->idMsgAckPending = id;
TlenSend(this, "<message to='%s' type='%s' id='" TLEN_IQID "%d'><body>%s</body><x xmlns='jabber:x:event'><offline/><delivered/><composing/></x></message>", dbv.pszVal, msgType, id, msgEnc);
}
@@ -658,8 +658,8 @@ INT_PTR TlenProtocol::GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
if (!tlenOptions.enableAvatars) return GAIR_NOAVATAR;
BOOL downloadingAvatar = FALSE;
- char *avatarHash = NULL;
- TLEN_LIST_ITEM *item = NULL;
+ char *avatarHash = nullptr;
+ TLEN_LIST_ITEM *item = nullptr;
DBVARIANT dbv;
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
@@ -667,19 +667,19 @@ INT_PTR TlenProtocol::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (!db_get(pai->hContact, m_szModuleName, "jid", &dbv)) {
item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal);
db_free(&dbv);
- if (item != NULL) {
+ if (item != nullptr) {
downloadingAvatar = item->newAvatarDownloading;
avatarHash = item->avatarHash;
}
}
}
- else if (threadData != NULL)
+ else if (threadData != nullptr)
avatarHash = threadData->avatarHash;
- if ((avatarHash == NULL || avatarHash[0] == '\0') && !downloadingAvatar)
+ if ((avatarHash == nullptr || avatarHash[0] == '\0') && !downloadingAvatar)
return GAIR_NOAVATAR;
- if (avatarHash != NULL && !downloadingAvatar) {
+ if (avatarHash != nullptr && !downloadingAvatar) {
TlenGetAvatarFileName(this, item, pai->filename, _countof(pai->filename) - 1);
pai->format = (pai->hContact == NULL) ? threadData->avatarFormat : item->avatarFormat;
return GAIR_SUCCESS;
@@ -706,12 +706,12 @@ int TlenProtocol::RecvAwayMsg(MCONTACT, int, PROTORECVEVENT*) HANDLE TlenProtocol::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath)
{
- if (!isOnline) return 0;
+ if (!isOnline) return nullptr;
TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *)hTransfer;
ft->szSavePath = mir_strdup(mir_u2a(szPath)); //TODO convert to wchar_t*
TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_FILE, ft->iqId);
- if (item != NULL) {
+ if (item != nullptr) {
item->ft = ft;
}
char *nick = TlenNickFromJID(ft->jid);
@@ -746,13 +746,13 @@ int TlenProtocol::FileCancel(MCONTACT, HANDLE hTransfer) {
TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *)hTransfer;
debugLogA("Invoking FileCancel()");
- if (ft->s != NULL) {
+ if (ft->s != nullptr) {
ft->state = FT_ERROR;
Netlib_CloseHandle(ft->s);
- ft->s = NULL;
- if (ft->hFileEvent != NULL) {
+ ft->s = nullptr;
+ if (ft->hFileEvent != nullptr) {
HANDLE hEvent = ft->hFileEvent;
- ft->hFileEvent = NULL;
+ ft->hFileEvent = nullptr;
SetEvent(hEvent);
}
}
@@ -769,9 +769,9 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const wchar_t* szDescription, w DBVARIANT dbv;
char *nick, *p, idStr[10];
- if (!isOnline) return 0;
+ if (!isOnline) return nullptr;
// if (db_get_w(ccs->hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0;
- if (db_get(hContact, m_szModuleName, "jid", &dbv)) return 0;
+ if (db_get(hContact, m_szModuleName, "jid", &dbv)) return nullptr;
TLEN_FILE_TRANSFER *ft = TlenFileCreateFT(this, dbv.pszVal);
for (ft->fileCount = 0; ppszFiles[ft->fileCount]; ft->fileCount++);
ft->files = (char **)mir_alloc(sizeof(char *) * ft->fileCount);
@@ -797,7 +797,7 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const wchar_t* szDescription, w int id = TlenSerialNext(this);
mir_snprintf(idStr, "%d", id);
TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_FILE, idStr);
- if (item != NULL) {
+ if (item != nullptr) {
ft->iqId = mir_strdup(idStr);
nick = TlenNickFromJID(ft->jid);
item->ft = ft;
@@ -810,7 +810,7 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const wchar_t* szDescription, w else {
if (ft->fileCount == 1) {
char* ppszFiles_0_A = mir_u2a(ppszFiles[0]);
- if ((p = strrchr(ppszFiles_0_A, '\\')) != NULL) {
+ if ((p = strrchr(ppszFiles_0_A, '\\')) != nullptr) {
p++;
}
else {
@@ -837,9 +837,9 @@ static char* settingToChar(DBCONTACTWRITESETTING* cws) case DBVT_ASCIIZ:
return mir_strdup(cws->value.pszVal);
case DBVT_UTF8:
- return mir_utf8decode(mir_strdup(cws->value.pszVal), NULL);
+ return mir_utf8decode(mir_strdup(cws->value.pszVal), nullptr);
}
- return NULL;
+ return nullptr;
}
int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam)
@@ -856,11 +856,11 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) char *nick, *jid, *group;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL || strcmp(szProto, m_szModuleName)) return 0;
+ if (szProto == nullptr || strcmp(szProto, m_szModuleName)) return 0;
// A contact's group is changed
if (!strcmp(cws->szSetting, "Group")) {
if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
- if ((item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != NULL) {
+ if ((item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != nullptr) {
db_free(&dbv);
if (!db_get(hContact, "CList", "MyHandle", &dbv)) {
nick = TlenTextEncode(dbv.pszVal);
@@ -872,17 +872,17 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) }
else nick = TlenNickFromJID(item->jid);
- if (nick != NULL) {
+ if (nick != nullptr) {
// Note: we need to compare with item->group to prevent infinite loop
- if (cws->value.type == DBVT_DELETED && item->group != NULL) {
+ if (cws->value.type == DBVT_DELETED && item->group != nullptr) {
debugLogA("Group set to nothing");
TlenSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'></item></query></iq>", nick, item->jid);
}
- else if (cws->value.pszVal != NULL) {
+ else if (cws->value.pszVal != nullptr) {
char *newGroup = settingToChar(cws);
- if (item->group == NULL || strcmp(newGroup, item->group)) {
+ if (item->group == nullptr || strcmp(newGroup, item->group)) {
debugLogA("Group set to %s", newGroup);
- if ((group = TlenGroupEncode(newGroup)) != NULL) {
+ if ((group = TlenGroupEncode(newGroup)) != nullptr) {
TlenSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, item->jid, group);
mir_free(group);
}
@@ -907,21 +907,21 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
jid = dbv.pszVal;
- if ((item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != NULL) {
+ if ((item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != nullptr) {
if (cws->value.type == DBVT_DELETED) {
newNick = mir_u2a(pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE));
}
- else if (cws->value.pszVal != NULL) {
+ else if (cws->value.pszVal != nullptr) {
newNick = settingToChar(cws);
}
else {
- newNick = NULL;
+ newNick = nullptr;
}
// Note: we need to compare with item->nick to prevent infinite loop
- if (newNick != NULL && (item->nick == NULL || (item->nick != NULL && strcmp(item->nick, newNick)))) {
- if ((nick = TlenTextEncode(newNick)) != NULL) {
+ if (newNick != nullptr && (item->nick == nullptr || (item->nick != nullptr && strcmp(item->nick, newNick)))) {
+ if ((nick = TlenTextEncode(newNick)) != nullptr) {
debugLogA("Nick set to %s", newNick);
- if (item->group != NULL && (group = TlenGroupEncode(item->group)) != NULL) {
+ if (item->group != nullptr && (group = TlenGroupEncode(item->group)) != nullptr) {
TlenSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, jid, group);
mir_free(group);
}
@@ -931,7 +931,7 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) mir_free(nick);
}
}
- if (newNick != NULL) mir_free(newNick);
+ if (newNick != nullptr) mir_free(newNick);
}
db_free(&dbv);
}
@@ -949,10 +949,10 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) }
else szNick = TlenNickFromJID(szJid);
- if (szNick != NULL) {
+ if (szNick != nullptr) {
debugLogA("jid=%s szNick=%s", szJid, szNick);
if (!db_get(hContact, "CList", "Group", &dbv)) {
- if ((pGroup = TlenGroupEncode(dbv.pszVal)) != NULL) {
+ if ((pGroup = TlenGroupEncode(dbv.pszVal)) != nullptr) {
TlenSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' szJid='%s'><group>%s</group></item></query></iq>", szNick, szJid, pGroup);
TlenSend(this, "<presence to='%s' type='subscribe'/>", szJid);
mir_free(pGroup);
@@ -980,7 +980,7 @@ int TlenProtocol::TlenContactDeleted(WPARAM wParam, LPARAM) return 0;
char *szProto = GetContactProto(wParam);
- if (szProto == NULL || mir_strcmp(szProto, m_szModuleName))
+ if (szProto == nullptr || mir_strcmp(szProto, m_szModuleName))
return 0;
DBVARIANT dbv;
@@ -988,8 +988,8 @@ int TlenProtocol::TlenContactDeleted(WPARAM wParam, LPARAM) char *p, *q;
char *jid = dbv.pszVal;
- if ((p = strchr(jid, '@')) != NULL) {
- if ((q = strchr(p, '/')) != NULL)
+ if ((p = strchr(jid, '@')) != nullptr) {
+ if ((q = strchr(p, '/')) != nullptr)
*q = '\0';
}
@@ -1009,7 +1009,7 @@ int TlenProtocol::UserIsTyping(MCONTACT hContact, int type) if (!isOnline) return 0;
if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
TLEN_LIST_ITEM *item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal);
- if (item != NULL /*&& item->wantComposingEvent == TRUE*/) {
+ if (item != nullptr /*&& item->wantComposingEvent == TRUE*/) {
switch (type) {
case PROTOTYPE_SELFTYPING_OFF:
TlenSend(this, "<m tp='u' to='%s'/>", dbv.pszVal);
@@ -1028,10 +1028,10 @@ INT_PTR TlenProtocol::GetMyAvatar(WPARAM wParam, LPARAM lParam) {
wchar_t* buf = (wchar_t*)wParam;
int size = (int)lParam;
- if (buf == NULL || size <= 0)
+ if (buf == nullptr || size <= 0)
return -1;
- TlenGetAvatarFileName(this, NULL, buf, size);
+ TlenGetAvatarFileName(this, nullptr, buf, size);
return 0;
}
@@ -1069,9 +1069,9 @@ INT_PTR TlenProtocol::SetMyAvatar(WPARAM, LPARAM lParam) }
wchar_t* szFileName = (wchar_t*)lParam;
wchar_t tFileName[MAX_PATH];
- if (szFileName != NULL) {
- int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_USER_CHANGEAVATAR), NULL, TlenChangeAvatarDlgProc, (LPARAM)NULL);
- TlenGetAvatarFileName(this, NULL, tFileName, MAX_PATH);
+ if (szFileName != nullptr) {
+ int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_USER_CHANGEAVATAR), nullptr, TlenChangeAvatarDlgProc, (LPARAM)NULL);
+ TlenGetAvatarFileName(this, nullptr, tFileName, MAX_PATH);
if (CopyFile(szFileName, tFileName, FALSE) == FALSE)
return 1;
@@ -1080,7 +1080,7 @@ INT_PTR TlenProtocol::SetMyAvatar(WPARAM, LPARAM lParam) if (fileIn != -1) {
long dwPngSize = filelength(fileIn);
BYTE* pResult = (BYTE *)mir_alloc(dwPngSize);
- if (pResult != NULL) {
+ if (pResult != nullptr) {
read(fileIn, pResult, dwPngSize);
close(fileIn);
TlenUploadAvatar(this, pResult, dwPngSize, (result & 0x10000) != 0);
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 8396a9ab45..0cbe1c4819 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -96,7 +96,7 @@ static INT_PTR CALLBACK TlenPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara static VOID NTAPI TlenPasswordCreateDialogApcProc(ULONG_PTR param)
{
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_PASSWORD), NULL, TlenPasswordDlgProc, (LPARAM) param);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_PASSWORD), nullptr, TlenPasswordDlgProc, (LPARAM) param);
}
void __cdecl TlenServerThread(ThreadData *info)
@@ -115,7 +115,7 @@ void __cdecl TlenServerThread(ThreadData *info) // Normal server connection, we will fetch all connection parameters
// e.g. username, password, etc. from the database.
- if (info->proto->threadData != NULL) {
+ if (info->proto->threadData != nullptr) {
// Will not start another connection thread if a thread is already running.
// Make APC call to the main thread. This will immediately wake the thread up
// in case it is asleep in the reconnect loop so that it will immediately
@@ -162,7 +162,7 @@ void __cdecl TlenServerThread(ThreadData *info) // exit code which may not be NULL.
// Should be better with modeless.
onlinePassword[0] = (char) -1;
- hEventPasswdDlg = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hEventPasswdDlg = CreateEvent(nullptr, FALSE, FALSE, nullptr);
QueueUserAPC(TlenPasswordCreateDialogApcProc, hMainThread, (UINT_PTR)jidStr);
WaitForSingleObject(hEventPasswdDlg, INFINITE);
CloseHandle(hEventPasswdDlg);
@@ -191,17 +191,17 @@ void __cdecl TlenServerThread(ThreadData *info) tlenNetworkBufferSize = 2048;
char *buffer = (char *) mir_alloc(tlenNetworkBufferSize+1); // +1 is for '\0' when debug logging this buffer
- if (buffer == NULL) {
+ if (buffer == nullptr) {
info->proto->debugLogA("Thread ended, network buffer cannot be allocated");
loginErr = LOGINERR_NONETWORK;
}
if (loginErr != 0) {
- info->proto->threadData = NULL;
+ info->proto->threadData = nullptr;
oldStatus = info->proto->m_iStatus;
info->proto->m_iStatus = ID_STATUS_OFFLINE;
ProtoBroadcastAck(info->proto->m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->m_iStatus);
- ProtoBroadcastAck(info->proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, loginErr);
+ ProtoBroadcastAck(info->proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, loginErr);
mir_free(info);
mir_free(buffer);
return;
@@ -239,12 +239,12 @@ void __cdecl TlenServerThread(ThreadData *info) for (;;) { // Reconnect loop
info->s = TlenWsConnect(info->proto, connectHost, info->port);
- if (info->s == NULL) {
+ if (info->s == nullptr) {
info->proto->debugLogA("Connection failed (%d)", WSAGetLastError());
if (info->proto->threadData == info) {
oldStatus = info->proto->m_iStatus;
info->proto->m_iStatus = ID_STATUS_OFFLINE;
- ProtoBroadcastAck(info->proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
+ ProtoBroadcastAck(info->proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NONETWORK);
ProtoBroadcastAck(info->proto->m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->m_iStatus);
if (info->proto->tlenOptions.reconnect == TRUE) {
reconnectTime = rand() % reconnectMaxTime;
@@ -268,7 +268,7 @@ void __cdecl TlenServerThread(ThreadData *info) return;
}
}
- info->proto->threadData = NULL;
+ info->proto->threadData = nullptr;
}
info->proto->debugLogA("Thread ended, connection failed");
mir_free(buffer);
@@ -325,7 +325,7 @@ void __cdecl TlenServerThread(ThreadData *info) else if (datalen == tlenNetworkBufferSize) {
tlenNetworkBufferSize += 2048;
info->proto->debugLogA("Increasing network buffer size to %d", tlenNetworkBufferSize);
- if ((buffer=(char *) mir_realloc(buffer, tlenNetworkBufferSize+1)) == NULL) {
+ if ((buffer=(char *) mir_realloc(buffer, tlenNetworkBufferSize+1)) == nullptr) {
info->proto->debugLogA("Cannot reallocate more network buffer, go offline now");
break;
}
@@ -341,7 +341,7 @@ void __cdecl TlenServerThread(ThreadData *info) info->proto->isConnected = FALSE;
Menu_EnableItem(info->proto->hMenuMUC, false);
- if (info->proto->hMenuChats != NULL)
+ if (info->proto->hMenuChats != nullptr)
Menu_EnableItem(info->proto->hMenuChats, false);
// Set status to offline
@@ -387,7 +387,7 @@ void __cdecl TlenServerThread(ThreadData *info) info->proto->debugLogA("Thread ended: server='%s'", info->server);
if (info->proto->threadData == info) {
- info->proto->threadData = NULL;
+ info->proto->threadData = nullptr;
}
mir_free(buffer);
@@ -404,7 +404,7 @@ static void TlenSendAuth(TlenProtocol *proto) { mir_free(str);
str = TlenSha1(text);
char *p=TlenTextEncode(proto->threadData->username);
- if (p != NULL) {
+ if (p != nullptr) {
iqId = TlenSerialNext(proto->threadData->proto);
TlenIqAdd(proto, iqId, IQ_PROC_NONE, TlenIqResultAuth);
TlenSend(proto, "<iq type='set' id='" TLEN_IQID "%d'><query xmlns='jabber:iq:auth'><username>%s</username><digest>%s</digest><resource>t</resource><host>tlen.pl</host></query></iq>", iqId, p /*info->username*/, str);
@@ -416,16 +416,16 @@ static void TlenSendAuth(TlenProtocol *proto) { /* processing <s ... > tag sent from server on session opening */
static void TlenProcessStreamOpening(XmlNode *node, ThreadData *info)
{
- if (node->name == NULL || mir_strcmp(node->name, "s"))
+ if (node->name == nullptr || mir_strcmp(node->name, "s"))
return;
char *sid=TlenXmlGetAttrValue(node, "i");
- if (sid != NULL) {
+ if (sid != nullptr) {
if (info->streamId) mir_free(info->streamId);
info->streamId = mir_strdup(sid);
}
char *s=TlenXmlGetAttrValue(node, "s");
- if (s != NULL && !mir_strcmp(s, "1")) {
+ if (s != nullptr && !mir_strcmp(s, "1")) {
int i;
unsigned char aes_key[32];
char aes_key_str[140], aes_iv_str[40];
@@ -459,7 +459,7 @@ static void TlenProcessStreamOpening(XmlNode *node, ThreadData *info) mpi_read_string( &k2_mpi, 16, k2 );
memset(&aes_mpi, 0, sizeof (mpi));
mpi_read_binary(&aes_mpi, (unsigned char *)aes_key, 16);
- mpi_exp_mod( &aes_mpi, &aes_mpi, &k1_mpi, &k2_mpi, NULL );
+ mpi_exp_mod( &aes_mpi, &aes_mpi, &k1_mpi, &k2_mpi, nullptr );
slen = 140;
mpi_write_string(&aes_mpi, 16, aes_key_str, &slen);
TlenSend(info->proto, "<cipher k1='%s' k2='%s'/>", aes_key_str, aes_iv_str);
@@ -523,16 +523,16 @@ static void TlenProcessIqGetVersion(TlenProtocol *proto, XmlNode *node) OSVERSIONINFO osvi = { 0 };
char mversion[256];
char *mver;
- char* os = NULL;
+ char* os = nullptr;
if (proto->m_iStatus == ID_STATUS_INVISIBLE) return;
if (!proto->tlenOptions.enableVersion) return;
char *from = TlenXmlGetAttrValue(node, "from");
- if (from == NULL)
+ if (from == nullptr)
return;
TLEN_LIST_ITEM *item = TlenListGetItemPtr(proto, LIST_ROSTER, from);
- if (item == NULL)
+ if (item == nullptr)
return;
char *version = TlenTextEncode(TLEN_VERSION_STRING);
@@ -558,7 +558,7 @@ static void TlenProcessIqGetVersion(TlenProtocol *proto, XmlNode *node) break;
} }
- if ( os == NULL ) os = TlenTextEncode("Windows");
+ if ( os == nullptr ) os = TlenTextEncode("Windows");
mir_strcpy(mversion, "Miranda NG ");
Miranda_GetVersionText(mversion + 11, sizeof(mversion) - 11);
@@ -582,12 +582,12 @@ static void TlenProcessAvatar(XmlNode* node, ThreadData *info) {
XmlNode *tokenNode = TlenXmlGetChild(node, "token");
XmlNode *aNode = TlenXmlGetChild(node, "a");
- if (tokenNode != NULL) {
+ if (tokenNode != nullptr) {
char *token = tokenNode->text;
strncpy(info->avatarToken, token, sizeof(info->avatarToken)-1);
}
- if (aNode != NULL) {
- if (TlenProcessAvatarNode(info->proto, node, NULL)) {
+ if (aNode != nullptr) {
+ if (TlenProcessAvatarNode(info->proto, node, nullptr)) {
}
}
}
@@ -604,11 +604,11 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) if (!node->name || mir_strcmp(node->name, "message")) return;
char *type=TlenXmlGetAttrValue(node, "type");
- if (type != NULL && !mir_strcmp(type, "error")) {
+ if (type != nullptr && !mir_strcmp(type, "error")) {
}
else {
char *from=TlenXmlGetAttrValue(node, "from");
- if (from != NULL) {
+ if (from != nullptr) {
if (info->proto->tlenOptions.ignoreAdvertisements && strstr(from, "b73@tlen.pl") == from) {
return;
}
@@ -617,21 +617,21 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) TLEN_LIST_ITEM *item = TlenListGetItemPtr(info->proto, LIST_ROSTER, fromJid);
BOOL isChatRoomJid = TlenListExist(info->proto, LIST_CHATROOM, from);
- if (isChatRoomJid && type != NULL && !mir_strcmp(type, "groupchat")) {
+ if (isChatRoomJid && type != nullptr && !mir_strcmp(type, "groupchat")) {
//TlenGroupchatProcessMessage(node, userdata);
- } else if (type != NULL && !mir_strcmp(type, "pic")) {
+ } else if (type != nullptr && !mir_strcmp(type, "pic")) {
TlenProcessPic(node, info->proto);
- } else if (type != NULL && !mir_strcmp(type, "iq")) {
+ } else if (type != nullptr && !mir_strcmp(type, "iq")) {
XmlNode *iqNode;
// Tlen-compatible iq
- if ((iqNode=TlenXmlGetChild(node, "iq")) != NULL) {
+ if ((iqNode=TlenXmlGetChild(node, "iq")) != nullptr) {
TlenXmlAddAttr(iqNode, "from", from);
TlenProcessIq(iqNode, info);
}
} else {
- if ((bodyNode=TlenXmlGetChild(node, "body")) != NULL) {
- if (bodyNode->text != NULL) {
- if ((subjectNode=TlenXmlGetChild(node, "subject")) != NULL && subjectNode->text != NULL && subjectNode->text[0] != '\0') {
+ if ((bodyNode=TlenXmlGetChild(node, "body")) != nullptr) {
+ if (bodyNode->text != nullptr) {
+ if ((subjectNode=TlenXmlGetChild(node, "subject")) != nullptr && subjectNode->text != nullptr && subjectNode->text[0] != '\0') {
size_t size = mir_strlen(subjectNode->text)+mir_strlen(bodyNode->text)+5;
p = (char *)mir_alloc(size);
mir_snprintf(p, size, "%s\r\n%s", subjectNode->text, bodyNode->text);
@@ -644,33 +644,33 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) msgTime = 0;
delivered = composing = FALSE;
i = 1;
- while ((xNode=TlenXmlGetNthChild(node, "x", i)) != NULL) {
- if ((p=TlenXmlGetAttrValue(xNode, "xmlns")) != NULL) {
+ while ((xNode=TlenXmlGetNthChild(node, "x", i)) != nullptr) {
+ if ((p=TlenXmlGetAttrValue(xNode, "xmlns")) != nullptr) {
if (!mir_strcmp(p, "jabber:x:delay") && msgTime==0) {
- if ((p=TlenXmlGetAttrValue(xNode, "stamp")) != NULL) {
+ if ((p=TlenXmlGetAttrValue(xNode, "stamp")) != nullptr) {
msgTime = TlenIsoToUnixTime(p);
}
}
else if (!mir_strcmp(p, "jabber:x:event")) {
// Check whether any event is requested
- if (!delivered && (n=TlenXmlGetChild(xNode, "delivered")) != NULL) {
+ if (!delivered && (n=TlenXmlGetChild(xNode, "delivered")) != nullptr) {
delivered = TRUE;
idStr = TlenXmlGetAttrValue(node, "id");
- TlenSend(info->proto, "<message to='%s'><x xmlns='jabber:x:event'><delivered/><id>%s</id></x></message>", from, (idStr != NULL)?idStr:"");
+ TlenSend(info->proto, "<message to='%s'><x xmlns='jabber:x:event'><delivered/><id>%s</id></x></message>", from, (idStr != nullptr)?idStr:"");
}
- if (item != NULL && TlenXmlGetChild(xNode, "composing") != NULL) {
+ if (item != nullptr && TlenXmlGetChild(xNode, "composing") != nullptr) {
composing = TRUE;
if (item->messageEventIdStr)
mir_free(item->messageEventIdStr);
idStr = TlenXmlGetAttrValue(node, "id");
- item->messageEventIdStr = (idStr == NULL)?NULL:mir_strdup(idStr);
+ item->messageEventIdStr = (idStr == nullptr)?nullptr:mir_strdup(idStr);
}
}
}
i++;
}
- if (item != NULL) {
+ if (item != nullptr) {
item->wantComposingEvent = composing;
if (item->isTyping) {
item->isTyping = FALSE;
@@ -682,7 +682,7 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) if ((hContact=TlenHContactFromJID(info->proto, fromJid)) == NULL) {
// Create a temporary contact
if (isChatRoomJid) {
- if ((p=strchr(from, '/')) != NULL && p[1]!='\0')
+ if ((p=strchr(from, '/')) != nullptr && p[1]!='\0')
p++;
else
p = from;
@@ -697,7 +697,7 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) }
if (msgTime == 0) {
- msgTime = time(NULL);
+ msgTime = time(nullptr);
} else {
MEVENT hDbEvent = db_event_last(hContact);
if (hDbEvent != NULL) {
@@ -707,8 +707,8 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) msgTime = dbei.timestamp + 1;
}
}
- if (msgTime > (DWORD)time(NULL)) {
- msgTime = time(NULL);
+ if (msgTime > (DWORD)time(nullptr)) {
+ msgTime = time(nullptr);
}
}
char* localMessage_Utf8 = mir_utf8encode(localMessage);
@@ -732,9 +732,9 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) static void TlenProcessIq(XmlNode *node, ThreadData *info)
{
MCONTACT hContact;
- XmlNode *queryNode = NULL;
+ XmlNode *queryNode = nullptr;
char *jid, *nick;
- char *xmlns = NULL;
+ char *xmlns = nullptr;
char *idStr, *str;
int id;
int i;
@@ -744,13 +744,13 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) // if ((type=TlenXmlGetAttrValue(node, "type")) == NULL) return;
id = -1;
- if ((idStr=TlenXmlGetAttrValue(node, "id")) != NULL) {
+ if ((idStr=TlenXmlGetAttrValue(node, "id")) != nullptr) {
if (!strncmp(idStr, TLEN_IQID, mir_strlen(TLEN_IQID)))
id = atoi(idStr+mir_strlen(TLEN_IQID));
}
queryNode = TlenXmlGetChild(node, "query");
- if (queryNode != NULL) {
+ if (queryNode != nullptr) {
xmlns = TlenXmlGetAttrValue(queryNode, "xmlns");
}
@@ -759,20 +759,20 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) // MATCH BY ID
/////////////////////////////////////////////////////////////////////////
TLEN_IQ_PFUNC pfunc=TlenIqFetchFunc(info->proto, id);
- if (pfunc != NULL) {
+ if (pfunc != nullptr) {
info->proto->debugLogA("Handling iq request for id=%d", id);
pfunc(info->proto, node);
/////////////////////////////////////////////////////////////////////////
// MORE GENERAL ROUTINES, WHEN ID DOES NOT MATCH
/////////////////////////////////////////////////////////////////////////
// new p2p connections
- } else if (xmlns != NULL && !mir_strcmp(xmlns, "p2p")) {
+ } else if (xmlns != nullptr && !mir_strcmp(xmlns, "p2p")) {
if (info->proto->tlenOptions.useNewP2P) {
TlenProcessP2P(node, info);
}
}
// RECVED: <iq type='set'><query ...
- else if (!mir_strcmp(type, "set") && queryNode != NULL && xmlns != NULL) {
+ else if (!mir_strcmp(type, "set") && queryNode != nullptr && xmlns != nullptr) {
// RECVED: roster push
// ACTION: similar to iqIdGetRoster above
@@ -785,17 +785,17 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) for (i=0; i<queryNode->numChild; i++) {
itemNode = queryNode->child[i];
if (!mir_strcmp(itemNode->name, "item")) {
- if ((jid=TlenXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if ((str=TlenXmlGetAttrValue(itemNode, "subscription")) != NULL) {
+ if ((jid=TlenXmlGetAttrValue(itemNode, "jid")) != nullptr) {
+ if ((str=TlenXmlGetAttrValue(itemNode, "subscription")) != nullptr) {
// we will not add new account when subscription=remove
if (!mir_strcmp(str, "to") || !mir_strcmp(str, "both") || !mir_strcmp(str, "from") || !mir_strcmp(str, "none")) {
- if ((name=TlenXmlGetAttrValue(itemNode, "name")) != NULL) {
+ if ((name=TlenXmlGetAttrValue(itemNode, "name")) != nullptr) {
nick = TlenTextDecode(name);
} else {
nick = TlenLocalNickFromJID(jid);
}
- if (nick != NULL) {
- if ((item=TlenListAdd(info->proto, LIST_ROSTER, jid)) != NULL) {
+ if (nick != nullptr) {
+ if ((item=TlenListAdd(info->proto, LIST_ROSTER, jid)) != nullptr) {
if (item->nick) mir_free(item->nick);
item->nick = nick;
if ((hContact=TlenHContactFromJID(info->proto, jid)) == NULL) {
@@ -805,16 +805,16 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) }
db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
- if ((groupNode=TlenXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
+ if ((groupNode=TlenXmlGetChild(itemNode, "group")) != nullptr && groupNode->text != nullptr) {
item->group = TlenGroupDecode(groupNode->text);
Clist_GroupCreate(0, _A2T(item->group));
db_set_s(hContact, "CList", "Group", item->group);
}
else {
- item->group = NULL;
+ item->group = nullptr;
db_unset(hContact, "CList", "Group");
}
- if (!mir_strcmp(str, "none") || (!mir_strcmp(str, "from") && strchr(jid, '@') != NULL)) {
+ if (!mir_strcmp(str, "none") || (!mir_strcmp(str, "from") && strchr(jid, '@') != nullptr)) {
if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
@@ -824,7 +824,7 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) }
}
}
- if ((item=TlenListGetItemPtr(info->proto, LIST_ROSTER, jid)) != NULL) {
+ if ((item=TlenListGetItemPtr(info->proto, LIST_ROSTER, jid)) != nullptr) {
if (!mir_strcmp(str, "both"))
item->subscription = SUB_BOTH;
else if (!mir_strcmp(str, "to"))
@@ -853,14 +853,14 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) }
// RECVED: <iq type='get'><query ...
- else if ( !mir_strcmp( type, "get" ) && queryNode != NULL && xmlns != NULL ) {
+ else if ( !mir_strcmp( type, "get" ) && queryNode != nullptr && xmlns != nullptr ) {
// RECVED: software version query
// ACTION: return my software version
if ( !mir_strcmp( xmlns, "jabber:iq:version" )) TlenProcessIqGetVersion(info->proto, node);
}
// RECVED: <iq type='result'><query ...
- else if ( !mir_strcmp( type, "result") && queryNode != NULL) {
- if (xmlns != NULL ) {
+ else if ( !mir_strcmp( type, "result") && queryNode != nullptr) {
+ if (xmlns != nullptr ) {
if ( !mir_strcmp(xmlns, "jabber:iq:roster" )) {
TlenIqResultRoster(info->proto, node);
} else if ( !mir_strcmp( xmlns, "jabber:iq:version" )) {
@@ -870,7 +870,7 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) }
} else {
char *from;
- if (( from=TlenXmlGetAttrValue( node, "from" )) != NULL ) {
+ if (( from=TlenXmlGetAttrValue( node, "from" )) != nullptr ) {
if ( !mir_strcmp(from, "tcfg" )) {
TlenIqResultTcfg(info->proto, node);
}
@@ -886,7 +886,7 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) item = TlenListGetItemPtrFromIndex(info->proto,i);
if (item->ft->state==FT_CONNECTING && !mir_strcmp(idStr, item->ft->iqId)) {
item->ft->state = FT_DENIED;
- if (item->ft->hFileEvent != NULL)
+ if (item->ft->hFileEvent != nullptr)
SetEvent(item->ft->hFileEvent); // Simulate the termination of file server connection
}
i++;
@@ -907,11 +907,11 @@ static void TlenProcessW(XmlNode *node, ThreadData *info) return;
char *body=node->text;
- if (body == NULL)
+ if (body == nullptr)
return;
char *f = TlenXmlGetAttrValue(node, "f");
- if (f != NULL) {
+ if (f != nullptr) {
char webContactName[128];
mir_snprintf(webContactName, Translate("%s Web Messages"), info->proto->m_szModuleName);
MCONTACT hContact = TlenHContactFromJID(info->proto, webContactName);
@@ -922,14 +922,14 @@ static void TlenProcessW(XmlNode *node, ThreadData *info) s = TlenXmlGetAttrValue(node, "s");
e = TlenXmlGetAttrValue(node, "e");
- str = NULL;
+ str = nullptr;
strSize = 0;
TlenStringAppend(&str, &strSize, "%s\r\n%s: ", Translate("Web message"), Translate("From"));
- if (f != NULL)
+ if (f != nullptr)
TlenStringAppend(&str, &strSize, "%s", f);
TlenStringAppend(&str, &strSize, "\r\n%s: ", Translate("E-mail"));
- if (e != NULL)
+ if (e != nullptr)
TlenStringAppend(&str, &strSize, "%s", e);
TlenStringAppend(&str, &strSize, "\r\n\r\n%s", body);
@@ -937,7 +937,7 @@ static void TlenProcessW(XmlNode *node, ThreadData *info) char* localMessage_Utf8 = mir_utf8encode(localMessage);
PROTORECVEVENT recv = { 0 };
- recv.timestamp = (DWORD) time(NULL);
+ recv.timestamp = (DWORD) time(nullptr);
recv.szMessage = localMessage_Utf8;
ProtoChainRecvMsg(hContact, &recv);
@@ -959,21 +959,21 @@ static void TlenProcessM(XmlNode *node, ThreadData *info) if (!node->name || mir_strcmp(node->name, "m")) return;
char *f = TlenXmlGetAttrValue(node, "f"); //, *from;//username
- if (f != NULL) {
+ if (f != nullptr) {
char *fLogin = TlenLoginFromJID(f);
MCONTACT hContact=TlenHContactFromJID(info->proto, fLogin);
if (hContact != NULL) {
char *tp=TlenXmlGetAttrValue(node, "tp");//typing start/stop
- if (tp != NULL) {
+ if (tp != nullptr) {
TLEN_LIST_ITEM *item = TlenListGetItemPtr(info->proto, LIST_ROSTER, fLogin);
if (!mir_strcmp(tp, "t")) { //contact is writing
- if (item != NULL ) {
+ if (item != nullptr ) {
item->isTyping = TRUE;
CallService(MS_PROTO_CONTACTISTYPING, hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_INFINITE);
}
}
else if (!mir_strcmp(tp, "u")) {//contact stopped writing
- if (item != NULL) {
+ if (item != nullptr) {
item->isTyping = FALSE;
CallService(MS_PROTO_CONTACTISTYPING, hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
}
@@ -998,23 +998,23 @@ static void TlenProcessM(XmlNode *node, ThreadData *info) }
}
mir_free(fLogin);
- if ((p=strchr(f, '@')) != NULL) {
- if ((p=strchr(p, '/')) != NULL && p[1]!='\0') { // message from user
+ if ((p=strchr(f, '@')) != nullptr) {
+ if ((p=strchr(p, '/')) != nullptr && p[1]!='\0') { // message from user
time_t timestamp;
s = TlenXmlGetAttrValue(node, "s");
- if (s != NULL) {
+ if (s != nullptr) {
timestamp = TlenTimeToUTC(atol(s));
- if (timestamp > time(NULL)) {
- timestamp = time(NULL);
+ if (timestamp > time(nullptr)) {
+ timestamp = time(nullptr);
}
} else {
- timestamp = time(NULL);
+ timestamp = time(nullptr);
}
char *tp=TlenXmlGetAttrValue(node, "tp");//typing start/stop
bNode = TlenXmlGetChild(node, "b");
f = TlenTextDecode(f);
- if (bNode != NULL && bNode->text != NULL) {
- if (tp != NULL && !mir_strcmp(tp, "p")) {
+ if (bNode != nullptr && bNode->text != nullptr) {
+ if (tp != nullptr && !mir_strcmp(tp, "p")) {
/* MUC private message */
str = TlenResourceFromJID(f);
hContact = TlenDBCreateContact(info->proto, f, str, TRUE);
@@ -1036,14 +1036,14 @@ static void TlenProcessM(XmlNode *node, ThreadData *info) }
}
i=1;
- while ((xNode=TlenXmlGetNthChild(node, "x", i)) != NULL) {
+ while ((xNode=TlenXmlGetNthChild(node, "x", i)) != nullptr) {
invNode=TlenXmlGetChild(xNode, "inv");
- if (invNode != NULL) {
+ if (invNode != nullptr) {
r = TlenTextDecode(f);
f = TlenXmlGetAttrValue(invNode, "f");
f = TlenTextDecode(f);
n = TlenXmlGetAttrValue(invNode, "n");
- if (n != NULL && strstr(r, n) != r) {
+ if (n != nullptr && strstr(r, n) != r) {
n = TlenTextDecode(n);
} else {
n = mir_strdup(Translate("Private conference"));
@@ -1092,15 +1092,15 @@ static void TlenProcessN(XmlNode *node, ThreadData *info) char *s = TlenXmlGetAttrValue(node, "s");
char *f = TlenXmlGetAttrValue(node, "f");
- if (s != NULL && f != NULL) {
- str = NULL;
+ if (s != nullptr && f != nullptr) {
+ str = nullptr;
strSize = 0;
TlenStringAppend(&str, &strSize, Translate("%s mail"), info->proto->m_szModuleName);
popupTitle = TlenTextDecode(str);
mir_free(str);
- str = NULL;
+ str = nullptr;
strSize = 0;
TlenStringAppend(&str, &strSize, "%s: %s\n", Translate("From"), f);
@@ -1131,10 +1131,10 @@ static void TlenProcessP(XmlNode *node, ThreadData*) status = ID_STATUS_ONLINE;
f = TlenXmlGetAttrValue(node, "f");
xNode = TlenXmlGetChild(node, "x");
- if (xNode != NULL) { // x subtag present (message from chat room) - change user rights only
+ if (xNode != nullptr) { // x subtag present (message from chat room) - change user rights only
char *temp, *iStr;
iNode = TlenXmlGetChild(xNode, "i");
- if (iNode != NULL) {
+ if (iNode != nullptr) {
iStr = TlenXmlGetAttrValue(iNode, "i");
temp = (char*)mir_alloc(mir_strlen(f)+mir_strlen(iStr)+2);
mir_strcpy(temp, f);
@@ -1151,13 +1151,13 @@ static void TlenProcessP(XmlNode *node, ThreadData*) f = TlenTextDecode(f);
}
a = TlenXmlGetAttrValue(node, "z");
- if (a != NULL) {
+ if (a != nullptr) {
if (atoi(a) &1 ) {
flags |= USER_FLAGS_REGISTERED;
}
}
a = TlenXmlGetAttrValue(node, "a");
- if (a != NULL) {
+ if (a != nullptr) {
if (atoi(a) == 2) {
flags |= USER_FLAGS_ADMIN;
}
@@ -1172,21 +1172,21 @@ static void TlenProcessP(XmlNode *node, ThreadData*) }
}
sNode = TlenXmlGetChild(node, "s");
- if (sNode != NULL) {
+ if (sNode != nullptr) {
if (!mir_strcmp(sNode->text, "unavailable")) {
status = ID_STATUS_OFFLINE;
}
}
kNode = TlenXmlGetChild(node, "kick");
- k = NULL;
- if (kNode != NULL) {
+ k = nullptr;
+ if (kNode != nullptr) {
k = TlenXmlGetAttrValue(kNode, "r");
- if (k == NULL) {
+ if (k == nullptr) {
k = "";
}
k = TlenTextDecode(k);
}
- if (k != NULL) {
+ if (k != nullptr) {
mir_free(k);
}
mir_free(f);
@@ -1202,30 +1202,30 @@ static void TlenProcessV(XmlNode *node, ThreadData *info) // if (!node->name || mir_strcmp(node->name, "v")) return;
char *from=TlenXmlGetAttrValue(node, "f");
- if (from != NULL) {
- if (strchr(from, '@') == NULL) {
+ if (from != nullptr) {
+ if (strchr(from, '@') == nullptr) {
mir_snprintf(jid, "%s@%s", from, info->server);
} else {
strncpy_s(jid, from, _TRUNCATE);
}
- if ((e=TlenXmlGetAttrValue(node, "e")) != NULL) {
+ if ((e=TlenXmlGetAttrValue(node, "e")) != nullptr) {
if (!mir_strcmp(e, "1")) {
- if ((id=TlenXmlGetAttrValue(node, "i")) != NULL) {
+ if ((id=TlenXmlGetAttrValue(node, "i")) != nullptr) {
Skin_PlaySound("TlenVoiceNotify");
TlenVoiceAccept(info->proto, id, from);
}
} else if (!mir_strcmp(e, "3")) {
// FILE_RECV : e='3' : invalid transfer error
- if ((p=TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
- if (item->ft != NULL) {
+ if ((p=TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != nullptr) {
+ if (item->ft != nullptr) {
HANDLE hEvent = item->ft->hFileEvent;
- item->ft->hFileEvent = NULL;
+ item->ft->hFileEvent = nullptr;
item->ft->state = FT_ERROR;
- if (item->ft->s != NULL) {
+ if (item->ft->s != nullptr) {
Netlib_CloseHandle(item->ft->s);
- item->ft->s = NULL;
- if (hEvent != NULL) {
+ item->ft->s = nullptr;
+ if (hEvent != nullptr) {
SetEvent(hEvent);
}
} else {
@@ -1238,8 +1238,8 @@ static void TlenProcessV(XmlNode *node, ThreadData *info) }
} else if (!mir_strcmp(e, "4")) {
// FILE_SEND : e='4' : File sending request was denied by the remote client
- if ((p=TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
+ if ((p=TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != nullptr) {
if (!mir_strcmp(item->ft->jid, jid)) {
TlenVoiceCancelAll(info->proto);
//TlenListRemove(info->proto, LIST_VOICE, p);
@@ -1248,8 +1248,8 @@ static void TlenProcessV(XmlNode *node, ThreadData *info) }
} else if (!mir_strcmp(e, "5")) {
// FILE_SEND : e='5' : Voice request was accepted
- if ((p=TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
+ if ((p=TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != nullptr) {
info->proto->debugLogA("should start voice 1 ? %s ?? %s", jid, item->ft->jid);
if (!mir_strcmp(item->ft->jid, jid)) {
info->proto->debugLogA("starting voice 1");
@@ -1259,11 +1259,11 @@ static void TlenProcessV(XmlNode *node, ThreadData *info) }
} else if (!mir_strcmp(e, "6")) {
// FILE_RECV : e='6' : IP and port information to connect to get file
- if ((p=TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
- if ((p=TlenXmlGetAttrValue(node, "a")) != NULL) {
+ if ((p=TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != nullptr) {
+ if ((p=TlenXmlGetAttrValue(node, "a")) != nullptr) {
item->ft->hostName = mir_strdup(p);
- if ((p=TlenXmlGetAttrValue(node, "p")) != NULL) {
+ if ((p=TlenXmlGetAttrValue(node, "p")) != nullptr) {
item->ft->wPort = atoi(p);
TlenVoiceStart(item->ft, 0);
//forkthread((pThreadFunc)TlenVoiceReceiveThread, 0, item->ft);
@@ -1275,12 +1275,12 @@ static void TlenProcessV(XmlNode *node, ThreadData *info) else if (!mir_strcmp(e, "7")) {
// FILE_RECV : e='7' : IP and port information to connect to send file
// in case the conection to the given server was not successful
- if ((p=TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
- if ((p=TlenXmlGetAttrValue(node, "a")) != NULL) {
- if (item->ft->hostName != NULL) mir_free(item->ft->hostName);
+ if ((p=TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != nullptr) {
+ if ((p=TlenXmlGetAttrValue(node, "a")) != nullptr) {
+ if (item->ft->hostName != nullptr) mir_free(item->ft->hostName);
item->ft->hostName = mir_strdup(p);
- if ((p=TlenXmlGetAttrValue(node, "p")) != NULL) {
+ if ((p=TlenXmlGetAttrValue(node, "p")) != nullptr) {
item->ft->wPort = atoi(p);
item->ft->state = FT_SWITCH;
SetEvent(item->ft->hFileEvent);
@@ -1291,8 +1291,8 @@ static void TlenProcessV(XmlNode *node, ThreadData *info) }
else if (!mir_strcmp(e, "8")) {
// FILE_RECV : e='8' : transfer error
- if ((p=TlenXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
+ if ((p=TlenXmlGetAttrValue(node, "i")) != nullptr) {
+ if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != nullptr) {
item->ft->state = FT_ERROR;
SetEvent(item->ft->hFileEvent);
}
diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp index 6815573b78..8bf7c07045 100644 --- a/protocols/Tlen/src/tlen_userinfo.cpp +++ b/protocols/Tlen/src/tlen_userinfo.cpp @@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TLEN_FIELD_MAP tlenFieldGender[] = {
{ 1, L"Male" },
{ 2, L"Female" },
- { 0, NULL }
+ { 0, nullptr }
};
TLEN_FIELD_MAP tlenFieldLookfor[] = {
{ 1, L"Somebody to talk" },
@@ -42,13 +42,13 @@ TLEN_FIELD_MAP tlenFieldLookfor[] = { { 3, L"Flirt/romance" },
{ 4, L"Love" },
{ 5, L"Nothing" },
- { 0, NULL }
+ { 0, nullptr }
};
TLEN_FIELD_MAP tlenFieldStatus[] = {
{ 1, L"All" },
{ 2, L"Available" },
{ 3, L"Free for chat" },
- { 0, NULL }
+ { 0, nullptr }
};
TLEN_FIELD_MAP tlenFieldOccupation[] = {
{ 1, L"Student" },
@@ -63,7 +63,7 @@ TLEN_FIELD_MAP tlenFieldOccupation[] = { { 10, L"Teacher" },
{ 11, L"Doctor" },
{ 12, L"Other" },
- { 0, NULL }
+ { 0, nullptr }
};
TLEN_FIELD_MAP tlenFieldPlan[] = {
{ 1, L"I'd like to go downtown" },
@@ -72,7 +72,7 @@ TLEN_FIELD_MAP tlenFieldPlan[] = { { 4, L"I'd like to go to the disco" },
{ 5, L"I'd like to go on a blind date" },
{ 6, L"Waiting for suggestion" },
- { 0, NULL }
+ { 0, nullptr }
};
static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -85,7 +85,7 @@ static void InitComboBox(HWND hwndCombo, TLEN_FIELD_MAP *fieldMap) SendMessage(hwndCombo, CB_SETITEMDATA, n, 0);
SendMessage(hwndCombo, CB_SETCURSEL, n, 0);
for (i=0;;i++) {
- if (fieldMap[i].name == NULL)
+ if (fieldMap[i].name == nullptr)
break;
n = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) TranslateW(fieldMap[i].name));
SendMessage(hwndCombo, CB_SETITEMDATA, n, fieldMap[i].id);
@@ -97,12 +97,12 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i char text[512];
char *localFieldName, *localText;
- if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
+ if (hwndDlg == nullptr || fieldName == nullptr || str == nullptr || strSize == nullptr)
return;
GetDlgItemTextA(hwndDlg, idCtrl, text, _countof(text));
if (text[0]) {
- if ((localFieldName=TlenTextEncode(fieldName)) != NULL) {
- if ((localText=TlenTextEncode(text)) != NULL) {
+ if ((localFieldName=TlenTextEncode(fieldName)) != nullptr) {
+ if ((localText=TlenTextEncode(text)) != nullptr) {
TlenStringAppend(str, strSize, "<%s>%s</%s>", localFieldName, localText, localFieldName);
mir_free(localText);
}
@@ -113,7 +113,7 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i static void FetchCombo(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, int *strSize)
{
- if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
+ if (hwndDlg == nullptr || fieldName == nullptr || str == nullptr || strSize == nullptr)
return;
int value = (int) SendDlgItemMessage(hwndDlg, idCtrl, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, idCtrl, CB_GETCURSEL, 0, 0), 0);
@@ -132,13 +132,13 @@ int TlenProtocol::UserInfoInit(WPARAM wParam, LPARAM lParam) MCONTACT hContact = (MCONTACT) lParam;
char *szProto = GetContactProto(hContact);
- if ((szProto != NULL && !mir_strcmp(szProto, m_szModuleName)) || !lParam) {
+ if ((szProto != nullptr && !mir_strcmp(szProto, m_szModuleName)) || !lParam) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
odp.flags = ODPF_UNICODE;
odp.pfnDlgProc = TlenUserInfoDlgProc;
odp.position = -2000000000;
- odp.pszTemplate = ((HANDLE)lParam != NULL) ? MAKEINTRESOURCEA(IDD_USER_INFO):MAKEINTRESOURCEA(IDD_USER_VCARD);
+ odp.pszTemplate = ((HANDLE)lParam != nullptr) ? MAKEINTRESOURCEA(IDD_USER_INFO):MAKEINTRESOURCEA(IDD_USER_VCARD);
odp.szTitle.w = (hContact != NULL) ? LPGENW("Account") : m_tszUserName;
odp.dwInitParam = (LPARAM)this;
UserInfo_AddPage(wParam, &odp);
@@ -252,7 +252,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara mir_free(jid);
jid = dbv.pszVal;
if (data->proto->isOnline) {
- if ((item=TlenListGetItemPtr(data->proto, LIST_ROSTER, jid)) != NULL) {
+ if ((item=TlenListGetItemPtr(data->proto, LIST_ROSTER, jid)) != nullptr) {
switch (item->subscription) {
case SUB_BOTH:
SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, TranslateT("both"));
@@ -299,7 +299,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara break;
case WM_COMMAND:
if (LOWORD(wParam) == IDC_SAVE && HIWORD(wParam) == BN_CLICKED) {
- char *str = NULL;
+ char *str = nullptr;
int strSize;
TlenStringAppend(&str, &strSize, "<iq type='set' id='" TLEN_IQID "%d' to='tuba'><query xmlns='jabber:iq:register'>", TlenSerialNext(data->proto));
FetchField(hwndDlg, IDC_FIRSTNAME, "first", &str, &strSize);
diff --git a/protocols/Tlen/src/tlen_util.cpp b/protocols/Tlen/src/tlen_util.cpp index 0bc0bc5ef8..b0efd769ba 100644 --- a/protocols/Tlen/src/tlen_util.cpp +++ b/protocols/Tlen/src/tlen_util.cpp @@ -63,7 +63,7 @@ int TlenSend(TlenProtocol *proto, const char *fmt, ...) proto->debugLogA("SEND:%s", str);
size = (int)mir_strlen(str);
- if (proto->threadData != NULL) {
+ if (proto->threadData != nullptr) {
if (proto->threadData->useAES) {
result = TlenWsSendAES(proto, str, size, &proto->threadData->aes_out_context, proto->threadData->aes_out_iv);
}
@@ -83,9 +83,9 @@ char *TlenResourceFromJID(const char *jid2) char* jid = mir_strdup(jid2);
p = strchr(jid, '/');
- if (p != NULL && p[1] != '\0') {
+ if (p != nullptr && p[1] != '\0') {
p++;
- if ((nick = (char *)mir_alloc(1 + mir_strlen(jid) - (p - jid))) != NULL) {
+ if ((nick = (char *)mir_alloc(1 + mir_strlen(jid) - (p - jid))) != nullptr) {
strncpy(nick, p, mir_strlen(jid) - (p - jid));
nick[mir_strlen(jid) - (p - jid)] = '\0';
}
@@ -104,10 +104,10 @@ char *TlenNickFromJID(const char *jid2) char *nick;
char* jid = mir_strdup(jid2);
- if ((p = strchr(jid, '@')) == NULL)
+ if ((p = strchr(jid, '@')) == nullptr)
p = strchr(jid, '/');
- if (p != NULL) {
- if ((nick = (char *)mir_alloc((p - jid) + 1)) != NULL) {
+ if (p != nullptr) {
+ if ((nick = (char *)mir_alloc((p - jid) + 1)) != nullptr) {
strncpy(nick, jid, p - jid);
nick[p - jid] = '\0';
}
@@ -127,8 +127,8 @@ char *TlenLoginFromJID(const char *jid2) char* jid = mir_strdup(jid2);
p = strchr(jid, '/');
- if (p != NULL) {
- if ((nick = (char *)mir_alloc((p - jid) + 1)) != NULL) {
+ if (p != nullptr) {
+ if ((nick = (char *)mir_alloc((p - jid) + 1)) != nullptr) {
strncpy(nick, jid, p - jid);
nick[p - jid] = '\0';
}
@@ -158,14 +158,14 @@ char *TlenSha1(char *str) DWORD digest[5];
char* result;
- if (str == NULL)
- return NULL;
+ if (str == nullptr)
+ return nullptr;
mir_sha1_init(&sha);
mir_sha1_append(&sha, (BYTE*)str, (int)mir_strlen(str));
mir_sha1_finish(&sha, (BYTE*)digest);
- if ((result = (char *)mir_alloc(41)) == NULL)
- return NULL;
+ if ((result = (char *)mir_alloc(41)) == nullptr)
+ return nullptr;
sprintf(result, "%08x%08x%08x%08x%08x", (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3]), (int)htonl(digest[4])); //!!!!!!!!!!!
return result;
}
@@ -177,14 +177,14 @@ char *TlenSha1(char *str, int len) char* result;
int i;
- if (str == NULL)
- return NULL;
+ if (str == nullptr)
+ return nullptr;
mir_sha1_init(&sha);
mir_sha1_append(&sha, (BYTE*)str, len);
mir_sha1_finish(&sha, digest);
- if ((result = (char*)mir_alloc(20)) == NULL)
- return NULL;
+ if ((result = (char*)mir_alloc(20)) == nullptr)
+ return nullptr;
for (i = 0; i < 20; i++)
result[i] = digest[4 * (i >> 2) + (3 - (i & 0x3))];
return result;
@@ -195,7 +195,7 @@ char *TlenPasswordHash(const char *str) int magic1 = 0x50305735, magic2 = 0x12345671, sum = 7;
char *p, *res;
- if (str == NULL) return NULL;
+ if (str == nullptr) return nullptr;
for (p = (char *)str; *p != '\0'; p++) {
if (*p != ' ' && *p != '\t') {
magic1 ^= (((magic1 & 0x3f) + sum) * ((char)*p)) + (magic1 << 8);
@@ -215,13 +215,13 @@ char *TlenUrlEncode(const char *str) char *p, *q, *res;
unsigned char c;
- if (str == NULL) return NULL;
+ if (str == nullptr) return nullptr;
res = (char *)mir_alloc(3 * mir_strlen(str) + 1);
for (p = (char *)str, q = res; *p != '\0'; p++, q++) {
if (*p == ' ') {
*q = '+';
}
- else if (*p < 0x20 || *p >= 0x7f || strchr("%&+:'<>\"", *p) != NULL) {
+ else if (*p < 0x20 || *p >= 0x7f || strchr("%&+:'<>\"", *p) != nullptr) {
// Convert first from CP1252 to ISO8859-2
switch ((unsigned char)*p) {
case 0xa5: c = (unsigned char)0xa1; break;
@@ -248,7 +248,7 @@ void TlenUrlDecode(char *str) char *p, *q;
unsigned int code;
- if (str == NULL) return;
+ if (str == nullptr) return;
for (p = q = str; *p != '\0'; p++, q++) {
if (*p == '+') {
*q = ' ';
@@ -277,7 +277,7 @@ void TlenUrlDecode(char *str) char * TlenGroupDecode(const char *str)
{
char *p, *q;
- if (str == NULL) return NULL;
+ if (str == nullptr) return nullptr;
p = q = TlenTextDecode(str);
for (; *p != '\0'; p++) {
if (*p == '/') {
@@ -290,7 +290,7 @@ char * TlenGroupDecode(const char *str) char * TlenGroupEncode(const char *str)
{
char *p, *q;
- if (str == NULL) return NULL;
+ if (str == nullptr) return nullptr;
p = q = mir_strdup(str);
for (; *p != '\0'; p++) {
if (*p == '\\') {
@@ -306,9 +306,9 @@ char *TlenTextEncode(const char *str) {
char *s1;
- if (str == NULL) return NULL;
- if ((s1 = TlenUrlEncode(str)) == NULL)
- return NULL;
+ if (str == nullptr) return nullptr;
+ if ((s1 = TlenUrlEncode(str)) == nullptr)
+ return nullptr;
return s1;
}
@@ -316,7 +316,7 @@ char *TlenTextDecode(const char *str) {
char *s1;
- if (str == NULL) return NULL;
+ if (str == nullptr) return nullptr;
s1 = mir_strdup(str);
TlenUrlDecode(s1);
return s1;
@@ -348,7 +348,7 @@ time_t TlenIsoToUnixTime(char *stamp) int i, y;
time_t t;
- if (stamp == NULL) return (time_t)0;
+ if (stamp == nullptr) return (time_t)0;
p = stamp;
@@ -400,9 +400,9 @@ void TlenStringAppend(char **str, int *sizeAlloced, const char *fmt, ...) char *p;
int size, len;
- if (str == NULL) return;
+ if (str == nullptr) return;
- if (*str == NULL || *sizeAlloced <= 0) {
+ if (*str == nullptr || *sizeAlloced <= 0) {
*sizeAlloced = size = 2048;
*str = (char *)mir_alloc(size);
len = 0;
@@ -426,7 +426,7 @@ void TlenStringAppend(char **str, int *sizeAlloced, const char *fmt, ...) BOOL IsAuthorized(TlenProtocol *proto, const char *jid)
{
TLEN_LIST_ITEM *item = TlenListGetItemPtr(proto, LIST_ROSTER, jid);
- if (item != NULL) {
+ if (item != nullptr) {
return item->subscription == SUB_BOTH || item->subscription == SUB_FROM;
}
return FALSE;
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index 3255cd53f1..a209ea3edd 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -71,7 +71,7 @@ static void __cdecl TlenVoiceRecordingThreadProc(void *param) control->isRunning = 1;
control->stopThread = 0;
while (TRUE) {
- GetMessage(&msg, NULL, 0, 0);
+ GetMessage(&msg, nullptr, 0, 0);
if (msg.message == MM_WIM_DATA) {
// TlenLog("recording thread running...%d", msg.message);
hWaveIn = (HWAVEIN)msg.wParam;
@@ -245,7 +245,7 @@ static void TlenVoiceFreeVc(TLEN_VOICE_CONTROL *vc) while (vc->isRunning) {
Sleep(50);
}
- if (vc->hThread != NULL) CloseHandle(vc->hThread);
+ if (vc->hThread != nullptr) CloseHandle(vc->hThread);
if (vc->hWaveIn) {
for (int i = 0; i < vc->waveHeadersNum; i++) {
while (waveInUnprepareHeader(vc->hWaveIn, &vc->waveHeaders[i], sizeof(WAVEHDR)) == WAVERR_STILLPLAYING) {
@@ -298,12 +298,12 @@ static void __cdecl TlenVoiceReceiveThread(void *arg) nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
HNETLIBCONN s = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
- if (s != NULL) {
+ if (s != nullptr) {
ft->s = s;
ft->proto->debugLogA("Entering file receive loop");
TlenP2PEstablishOutgoingConnection(ft, FALSE);
if (ft->state != FT_ERROR) {
- ft->proto->playbackControl = NULL;
+ ft->proto->playbackControl = nullptr;
ft->proto->recordingControl = TlenVoiceCreateVC(ft->proto, 3);
ft->proto->recordingControl->ft = ft;
TlenVoiceRecordingStart(ft->proto->recordingControl);
@@ -311,22 +311,22 @@ static void __cdecl TlenVoiceReceiveThread(void *arg) TlenVoiceReceiveParse(ft);
}
TlenVoiceFreeVc(ft->proto->recordingControl);
- ft->proto->playbackControl = NULL;
- ft->proto->recordingControl = NULL;
+ ft->proto->playbackControl = nullptr;
+ ft->proto->recordingControl = nullptr;
}
if (ft->s) {
Netlib_CloseHandle(s);
}
- ft->s = NULL;
+ ft->s = nullptr;
}
else {
ft->proto->debugLogA("Connection failed - receiving as server");
ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection;
s = (HNETLIBCONN)TlenP2PListen(ft);
- if (s != NULL) {
+ if (s != nullptr) {
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Waiting for connection..."));
ft->s = s;
- HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
ft->hFileEvent = hEvent;
ft->currentFile = 0;
ft->state = FT_CONNECTING;
@@ -335,7 +335,7 @@ static void __cdecl TlenVoiceReceiveThread(void *arg) mir_free(nick);
ft->proto->debugLogA("Waiting for the file to be received...");
WaitForSingleObject(hEvent, INFINITE);
- ft->hFileEvent = NULL;
+ ft->hFileEvent = nullptr;
CloseHandle(hEvent);
ft->proto->debugLogA("Finish all files");
Netlib_CloseHandle(s);
@@ -368,12 +368,12 @@ static void TlenVoiceReceivingConnection(HNETLIBCONN hConnection, DWORD, void * TlenProtocol *proto = (TlenProtocol *)pExtra;
TLEN_FILE_TRANSFER *ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_VOICE, FALSE);
- if (ft != NULL) {
+ if (ft != nullptr) {
slisten = ft->s;
ft->s = hConnection;
ft->proto->debugLogA("Set ft->s to %d (saving %d)", hConnection, slisten);
ft->proto->debugLogA("Entering send loop for this file connection... (ft->s is hConnection)");
- proto->playbackControl = NULL;
+ proto->playbackControl = nullptr;
proto->recordingControl = TlenVoiceCreateVC(proto, 3);
proto->recordingControl->ft = ft;
TlenVoiceRecordingStart(proto->recordingControl);
@@ -381,8 +381,8 @@ static void TlenVoiceReceivingConnection(HNETLIBCONN hConnection, DWORD, void * TlenVoiceReceiveParse(ft);
}
TlenVoiceFreeVc(proto->recordingControl);
- proto->playbackControl = NULL;
- proto->recordingControl = NULL;
+ proto->playbackControl = nullptr;
+ proto->recordingControl = nullptr;
if (ft->state == FT_DONE) {
SetDlgItemText(proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Finished..."));
// ProtoBroadcastAck(proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
@@ -396,7 +396,7 @@ static void TlenVoiceReceivingConnection(HNETLIBCONN hConnection, DWORD, void * ft->proto->debugLogA("ft->s is restored to %d", ft->s);
}
Netlib_CloseHandle(hConnection);
- if (ft != NULL && ft->hFileEvent != NULL)
+ if (ft != nullptr && ft->hFileEvent != nullptr)
SetEvent(ft->hFileEvent);
}
@@ -407,7 +407,7 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft) char *p;
float val;
TLEN_FILE_PACKET *packet = TlenP2PPacketReceive(ft->s);
- if (packet != NULL) {
+ if (packet != nullptr) {
statusTxt = " Unknown packet ";
p = packet->packet;
if (packet->type == TLEN_VOICE_PACKET) {
@@ -420,7 +420,7 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft) statusTxt = " Unknown codec ";
}
else {
- if (ft->proto->playbackControl == NULL) {
+ if (ft->proto->playbackControl == nullptr) {
ft->proto->playbackControl = TlenVoiceCreateVC(ft->proto, codec);
TlenVoicePlaybackStart(ft->proto->playbackControl);
ft->proto->framesAvailableForPlayback = 0;
@@ -501,9 +501,9 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft) TlenP2PPacketFree(packet);
}
else {
- if (ft->proto->playbackControl != NULL) {
+ if (ft->proto->playbackControl != nullptr) {
TlenVoiceFreeVc(ft->proto->playbackControl);
- ft->proto->playbackControl = NULL;
+ ft->proto->playbackControl = nullptr;
}
ft->state = FT_ERROR;
}
@@ -518,14 +518,14 @@ static void __cdecl TlenVoiceSendingThread(void *arg) ft->proto->debugLogA("Thread started: type=voice_send");
ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection;
HNETLIBCONN s = (HNETLIBCONN)TlenP2PListen(ft);
- if (s != NULL) {
+ if (s != nullptr) {
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Waiting for connection..."));
//ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
ft->s = s;
//TlenLog("ft->s = %d", s);
//TlenLog("fileCount = %d", ft->fileCount);
- HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
ft->hFileEvent = hEvent;
ft->currentFile = 0;
ft->state = FT_CONNECTING;
@@ -535,11 +535,11 @@ static void __cdecl TlenVoiceSendingThread(void *arg) mir_free(nick);
ft->proto->debugLogA("Waiting for the voice data to be sent...");
WaitForSingleObject(hEvent, INFINITE);
- ft->hFileEvent = NULL;
+ ft->hFileEvent = nullptr;
CloseHandle(hEvent);
ft->proto->debugLogA("Finish voice");
Netlib_CloseHandle(s);
- ft->s = NULL;
+ ft->s = nullptr;
ft->proto->debugLogA("ft->s is NULL");
if (ft->state == FT_SWITCH) {
@@ -550,14 +550,14 @@ static void __cdecl TlenVoiceSendingThread(void *arg) nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
HNETLIBCONN sock = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
- if (sock != NULL) {
+ if (sock != nullptr) {
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Connecting..."));
//ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
ft->s = sock;
TlenP2PEstablishOutgoingConnection(ft, FALSE);
if (ft->state != FT_ERROR) {
ft->proto->debugLogA("Entering send loop for this file connection...");
- ft->proto->playbackControl = NULL;
+ ft->proto->playbackControl = nullptr;
ft->proto->recordingControl = TlenVoiceCreateVC(ft->proto, 3);
ft->proto->recordingControl->ft = ft;
TlenVoiceRecordingStart(ft->proto->recordingControl);
@@ -605,7 +605,7 @@ static void TlenVoiceSendParse(TLEN_FILE_TRANSFER *ft) int codec = ft->proto->recordingControl->codec;
TLEN_FILE_PACKET *packet = TlenP2PPacketCreate(sizeof(DWORD) + MODE_FRAME_SIZE[codec] * 33);
- if (packet != NULL) {
+ if (packet != nullptr) {
short *in;
float val;
in = ft->proto->recordingControl->recordingData;
@@ -647,19 +647,19 @@ int TlenVoiceCancelAll(TlenProtocol *proto) while ((i = TlenListFindNext(proto, LIST_VOICE, 0)) >= 0) {
TLEN_LIST_ITEM *item = TlenListGetItemPtrFromIndex(proto, i);
- if (item != NULL) {
+ if (item != nullptr) {
TLEN_FILE_TRANSFER *ft = item->ft;
TlenListRemoveByIndex(proto, i);
- if (ft != NULL) {
+ if (ft != nullptr) {
if (ft->s) {
//ProtoBroadcastAck(proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
proto->debugLogA("Closing ft->s = %d", ft->s);
ft->state = FT_ERROR;
Netlib_CloseHandle(ft->s);
- ft->s = NULL;
- if (ft->hFileEvent != NULL) {
+ ft->s = nullptr;
+ if (ft->hFileEvent != nullptr) {
hEvent = ft->hFileEvent;
- ft->hFileEvent = NULL;
+ ft->hFileEvent = nullptr;
SetEvent(hEvent);
}
}
@@ -670,7 +670,7 @@ int TlenVoiceCancelAll(TlenProtocol *proto) }
}
}
- if (proto->voiceDlgHWND != NULL) {
+ if (proto->voiceDlgHWND != nullptr) {
EndDialog(proto->voiceDlgHWND, 0);
}
return 0;
@@ -688,7 +688,7 @@ INT_PTR TlenProtocol::VoiceContactMenuHandleVoice(WPARAM wParam, LPARAM) char serialId[32];
mir_snprintf(serialId, "%d", TlenSerialNext(this));
TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_VOICE, serialId);
- if (item != NULL) {
+ if (item != nullptr) {
TLEN_FILE_TRANSFER *ft = TlenFileCreateFT(this, dbv.pszVal);
ft->iqId = mir_strdup(serialId);
item->ft = ft;
@@ -702,7 +702,7 @@ INT_PTR TlenProtocol::VoiceContactMenuHandleVoice(WPARAM wParam, LPARAM) }
int TlenVoiceIsInUse(TlenProtocol *proto) {
- if (TlenListFindNext(proto, LIST_VOICE, 0) >= 0 || proto->voiceDlgHWND != NULL) {
+ if (TlenListFindNext(proto, LIST_VOICE, 0) >= 0 || proto->voiceDlgHWND != nullptr) {
proto->debugLogA("voice in use ? %d", proto->voiceDlgHWND);
return 1;
}
@@ -723,9 +723,9 @@ static HBITMAP TlenVoiceMakeBitmap(int w, int h, int bpp, void *ptr) bmih.bmiHeader.biYPelsPerMeter = 0;
bmih.bmiHeader.biClrUsed = 0;
bmih.bmiHeader.biClrImportant = 0;
- HDC hdc = CreateDC(L"DISPLAY", NULL, NULL, NULL);
+ HDC hdc = CreateDC(L"DISPLAY", nullptr, nullptr, nullptr);
HBITMAP hbm = CreateDIBitmap(hdc, (PBITMAPINFOHEADER)&bmih, CBM_INIT, ptr, &bmih, DIB_RGB_COLORS);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
return hbm;
}
@@ -802,10 +802,10 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, TlenVoiceInitVUMeters();
SetDlgItemText(hwndDlg, IDC_STATUS, TranslateT("...???..."));
counter = 0;
- SetTimer(hwndDlg, 1, 100, NULL);
+ SetTimer(hwndDlg, 1, 100, nullptr);
return FALSE;
case WM_TIMER:
- if (proto->recordingControl != NULL && !proto->recordingControl->bDisable) {
+ if (proto->recordingControl != nullptr && !proto->recordingControl->bDisable) {
v = proto->recordingControl->vuMeter % VU_METER_LEVELS;
if (proto->recordingControl->vuMeter > 0) {
proto->recordingControl->vuMeter--;
@@ -815,13 +815,13 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, v = 0;
}
hDC = GetDC(GetDlgItem(hwndDlg, IDC_VUMETERIN));
- if (NULL != (hMemDC = CreateCompatibleDC(hDC))) {
+ if (nullptr != (hMemDC = CreateCompatibleDC(hDC))) {
SelectObject(hMemDC, vuMeterBitmaps[v]);
BitBlt(hDC, 0, 0, VU_METER_WIDTH, VU_METER_HEIGHT, hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
}
ReleaseDC(GetDlgItem(hwndDlg, IDC_PLAN), hDC);
- if (proto->playbackControl != NULL && !proto->playbackControl->bDisable) {
+ if (proto->playbackControl != nullptr && !proto->playbackControl->bDisable) {
v = proto->playbackControl->vuMeter % VU_METER_LEVELS;
if (proto->playbackControl->vuMeter > 0) {
proto->playbackControl->vuMeter--;
@@ -831,7 +831,7 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, v = 0;
}
hDC = GetDC(GetDlgItem(hwndDlg, IDC_VUMETEROUT));
- if (NULL != (hMemDC = CreateCompatibleDC(hDC))) {
+ if (nullptr != (hMemDC = CreateCompatibleDC(hDC))) {
SelectObject(hMemDC, vuMeterBitmaps[v]);
BitBlt(hDC, 0, 0, VU_METER_WIDTH, VU_METER_HEIGHT, hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
@@ -841,7 +841,7 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (counter % 10 == 0) {
char str[50];
float fv;
- if (proto->recordingControl != NULL) {
+ if (proto->recordingControl != nullptr) {
fv = (float)proto->recordingControl->bytesSum;
proto->recordingControl->bytesSum = 0;
}
@@ -850,7 +850,7 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, }
mir_snprintf(str, "%.1f kB/s", fv / 1024);
SetDlgItemTextA(hwndDlg, IDC_BYTESOUT, str);
- if (proto->playbackControl != NULL) {
+ if (proto->playbackControl != nullptr) {
fv = (float)proto->playbackControl->bytesSum;
proto->playbackControl->bytesSum = 0;
}
@@ -868,7 +868,7 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, return TRUE;
case IDC_VCQUALITY:
if (HIWORD(wParam) == CBN_SELCHANGE) {
- if (proto->recordingControl != NULL) {
+ if (proto->recordingControl != nullptr) {
int codec = SendDlgItemMessage(hwndDlg, IDC_VCQUALITY, CB_GETCURSEL, 0, 0) + 2;
if (codec != proto->recordingControl->codec && codec > 1 && codec < 6) {
TLEN_FILE_TRANSFER *ft = proto->recordingControl->ft;
@@ -881,12 +881,12 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, }
break;
case IDC_MICROPHONE:
- if (proto->recordingControl != NULL) {
+ if (proto->recordingControl != nullptr) {
proto->recordingControl->bDisable = BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_MICROPHONE);
}
break;
case IDC_SPEAKER:
- if (proto->playbackControl != NULL) {
+ if (proto->playbackControl != nullptr) {
proto->playbackControl->bDisable = BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SPEAKER);
}
break;
@@ -896,7 +896,7 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, EndDialog(hwndDlg, 0);
break;
case WM_DESTROY:
- proto->voiceDlgHWND = NULL;
+ proto->voiceDlgHWND = nullptr;
break;
}
@@ -908,7 +908,7 @@ static void __cdecl TlenVoiceDlgThread(void *ptr) TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *)ptr;
TlenProtocol *proto = ft->proto;
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_VOICE), NULL, TlenVoiceDlgProc, (LPARAM)proto);
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_VOICE), nullptr, TlenVoiceDlgProc, (LPARAM)proto);
TlenVoiceCancelAll(proto);
}
@@ -981,7 +981,7 @@ static void __cdecl TlenVoiceAcceptDlgThread(void *ptr) {
ACCEPTDIALOGDATA *data = (ACCEPTDIALOGDATA *)ptr;
- int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ACCEPT_VOICE), NULL, TlenVoiceAcceptDlgProc, (LPARAM)data);
+ int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ACCEPT_VOICE), nullptr, TlenVoiceAcceptDlgProc, (LPARAM)data);
if (result && data->proto->isOnline) {
data->item->ft = TlenFileCreateFT(data->proto, data->item->nick);
data->item->ft->iqId = mir_strdup(data->item->jid);
@@ -1001,7 +1001,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) {
if (!TlenVoiceIsInUse(proto)) {
TLEN_LIST_ITEM *item = TlenListAdd(proto, LIST_VOICE, id);
- if (item != NULL) {
+ if (item != nullptr) {
bool ask = true, ignore = false;
int voiceChatPolicy = db_get_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", 0);
if (voiceChatPolicy == TLEN_MUC_ASK) {
diff --git a/protocols/Tlen/src/tlen_ws.cpp b/protocols/Tlen/src/tlen_ws.cpp index 3da3a54c88..1cf07644d8 100644 --- a/protocols/Tlen/src/tlen_ws.cpp +++ b/protocols/Tlen/src/tlen_ws.cpp @@ -44,15 +44,15 @@ BOOL TlenWsInit(TlenProtocol *proto) nlus.useProxy = 0;
Netlib_SetUserSettings(proto->hFileNetlibUser, &nlus);
- return (proto->m_hNetlibUser != NULL)?TRUE:FALSE;
+ return (proto->m_hNetlibUser != nullptr)?TRUE:FALSE;
}
void TlenWsUninit(TlenProtocol *proto)
{
- if (proto->m_hNetlibUser != NULL) Netlib_CloseHandle(proto->m_hNetlibUser);
- if (proto->hFileNetlibUser != NULL) Netlib_CloseHandle(proto->hFileNetlibUser);
- proto->m_hNetlibUser = NULL;
- proto->hFileNetlibUser = NULL;
+ if (proto->m_hNetlibUser != nullptr) Netlib_CloseHandle(proto->m_hNetlibUser);
+ if (proto->hFileNetlibUser != nullptr) Netlib_CloseHandle(proto->hFileNetlibUser);
+ proto->m_hNetlibUser = nullptr;
+ proto->hFileNetlibUser = nullptr;
}
HNETLIBCONN TlenWsConnect(TlenProtocol *proto, char *host, WORD port)
@@ -97,7 +97,7 @@ int TlenWsSendAES(TlenProtocol *proto, char *data, int datalen, aes_context *aes int len, sendlen;
unsigned char aes_input[16];
unsigned char aes_output[256];
- if (proto->threadData == NULL) {
+ if (proto->threadData == nullptr) {
return FALSE;
}
while (datalen > 0) {
@@ -127,7 +127,7 @@ int TlenWsRecvAES(TlenProtocol *proto, char *data, long datalen, aes_context *ae int ret, len = 0, maxlen = datalen;
unsigned char aes_input[16];
unsigned char *aes_output = (unsigned char *)data;
- if (proto->threadData == NULL) {
+ if (proto->threadData == nullptr) {
return 0;
}
for (maxlen = maxlen & ~0xF; maxlen != 0; maxlen = maxlen & 0xF) {
diff --git a/protocols/Tlen/src/tlen_xml.cpp b/protocols/Tlen/src/tlen_xml.cpp index 28e3ca07c6..68ddc29145 100644 --- a/protocols/Tlen/src/tlen_xml.cpp +++ b/protocols/Tlen/src/tlen_xml.cpp @@ -29,25 +29,25 @@ static void TlenXmlRemoveChild(XmlNode *node, XmlNode *child); void TlenXmlInitState(XmlState *xmlState) { - if (xmlState == NULL) return; - xmlState->root.name = NULL; + if (xmlState == nullptr) return; + xmlState->root.name = nullptr; xmlState->root.depth = 0; xmlState->root.numAttr = 0; xmlState->root.maxNumAttr = 0; - xmlState->root.attr = NULL; + xmlState->root.attr = nullptr; xmlState->root.numChild = 0; xmlState->root.maxNumChild = 0; - xmlState->root.child = NULL; - xmlState->root.text = NULL; + xmlState->root.child = nullptr; + xmlState->root.text = nullptr; xmlState->root.state = NODE_OPEN; - xmlState->callback1_open = NULL; - xmlState->callback1_close = NULL; - xmlState->callback2_open = NULL; - xmlState->callback2_close = NULL; - xmlState->userdata1_open = NULL; - xmlState->userdata1_close = NULL; - xmlState->userdata2_open = NULL; - xmlState->userdata2_close = NULL; + xmlState->callback1_open = nullptr; + xmlState->callback1_close = nullptr; + xmlState->callback2_open = nullptr; + xmlState->callback2_close = nullptr; + xmlState->userdata1_open = nullptr; + xmlState->userdata1_close = nullptr; + xmlState->userdata2_open = nullptr; + xmlState->userdata2_close = nullptr; } void TlenXmlDestroyState(XmlState *xmlState) @@ -55,7 +55,7 @@ void TlenXmlDestroyState(XmlState *xmlState) int i; XmlNode *node; - if (xmlState == NULL) + if (xmlState == nullptr) return; // Note: cannot use TlenXmlFreeNode() to free xmlState->root // because it will do mir_free(xmlState->root) which is not freeable. @@ -173,7 +173,7 @@ int TlenXmlParse(XmlState *xmlState, char *buffer, int datalen) str = (char *) mir_alloc(q-p+1); strncpy(str, p, q-p); str[q-p] = '\0'; - TlenXmlProcessElem(xmlState, ELEM_TEXT, str, NULL); + TlenXmlProcessElem(xmlState, ELEM_TEXT, str, nullptr); mir_free(str); num += (q-p); p = q; @@ -193,7 +193,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) char *p; XmlAttr *a; - if (node == NULL || text == NULL || mir_strlen(text) <= 0) + if (node == nullptr || text == nullptr || mir_strlen(text) <= 0) return; for (p=text;;) { @@ -277,7 +277,7 @@ static BOOL TlenXmlProcessElem(XmlState *xmlState, XmlElemType elemType, char *e //BOOL activateCallback = FALSE; char *text, *attr; - if (elemText == NULL) return FALSE; + if (elemText == nullptr) return FALSE; if (elemType == ELEM_OPEN && !mir_strcmp(elemText, "?xml")) { // TlenLog("XML: skip <?xml> tag"); @@ -286,7 +286,7 @@ static BOOL TlenXmlProcessElem(XmlState *xmlState, XmlElemType elemType, char *e // Find active node node = &(xmlState->root); - parentNode = NULL; + parentNode = nullptr; while (node->numChild>0 && node->child[node->numChild-1]->state == NODE_OPEN) { parentNode = node; node = node->child[node->numChild-1]; @@ -299,7 +299,7 @@ static BOOL TlenXmlProcessElem(XmlState *xmlState, XmlElemType elemType, char *e if (elemAttr) attr = mir_strdup(elemAttr); else - attr = NULL; + attr = nullptr; switch (elemType) { case ELEM_OPEN: @@ -313,14 +313,14 @@ static BOOL TlenXmlProcessElem(XmlState *xmlState, XmlElemType elemType, char *e n->depth = node->depth + 1; n->state = NODE_OPEN; n->numChild = n->maxNumChild = 0; - n->child = NULL; + n->child = nullptr; n->numAttr = n->maxNumAttr = 0; - n->attr = NULL; + n->attr = nullptr; TlenXmlParseAttr(n, attr); - n->text = NULL; - if (n->depth == 1 && xmlState->callback1_open != NULL) + n->text = nullptr; + if (n->depth == 1 && xmlState->callback1_open != nullptr) (*(xmlState->callback1_open))(n, xmlState->userdata1_open); - if (n->depth == 2 && xmlState->callback2_open != NULL) + if (n->depth == 2 && xmlState->callback2_open != nullptr) (*xmlState->callback2_open)(n, xmlState->userdata2_open); break; case ELEM_OPENCLOSE: @@ -334,29 +334,29 @@ static BOOL TlenXmlProcessElem(XmlState *xmlState, XmlElemType elemType, char *e n->depth = node->depth + 1; n->state = NODE_CLOSE; n->numChild = n->maxNumAttr = 0; - n->child = NULL; + n->child = nullptr; n->numAttr = n->maxNumAttr = 0; - n->attr = NULL; + n->attr = nullptr; TlenXmlParseAttr(n, attr); - n->text = NULL; - if (n->depth == 1 && xmlState->callback1_close != NULL) { + n->text = nullptr; + if (n->depth == 1 && xmlState->callback1_close != nullptr) { (*(xmlState->callback1_close))(n, xmlState->userdata1_close); TlenXmlRemoveChild(node, n); } - if (n->depth == 2 && xmlState->callback2_close != NULL) { + if (n->depth == 2 && xmlState->callback2_close != nullptr) { (*xmlState->callback2_close)(n, xmlState->userdata2_close); TlenXmlRemoveChild(node, n); } break; case ELEM_CLOSE: - if (node->name != NULL && !mir_strcmp(node->name, text)) { + if (node->name != nullptr && !mir_strcmp(node->name, text)) { node->state = NODE_CLOSE; int nodeDepth = node->depth; - if (nodeDepth == 1 && xmlState->callback1_close != NULL) { + if (nodeDepth == 1 && xmlState->callback1_close != nullptr) { (*(xmlState->callback1_close))(node, xmlState->userdata1_close); TlenXmlRemoveChild(parentNode, node); } - if (nodeDepth == 2 && xmlState->callback2_close != NULL) { + if (nodeDepth == 2 && xmlState->callback2_close != nullptr) { (*xmlState->callback2_close)(node, xmlState->userdata2_close); TlenXmlRemoveChild(parentNode, node); } @@ -387,13 +387,13 @@ char *TlenXmlGetAttrValue(XmlNode *node, char *key) { int i; - if (node == NULL || node->numAttr <= 0 || key == NULL || mir_strlen(key) <= 0) - return NULL; + if (node == nullptr || node->numAttr <= 0 || key == nullptr || mir_strlen(key) <= 0) + return nullptr; for (i=0; i<node->numAttr; i++) { if (node->attr[i]->name && !mir_strcmp(key, node->attr[i]->name)) return node->attr[i]->value; } - return NULL; + return nullptr; } XmlNode *TlenXmlGetChild(XmlNode *node, char *tag) @@ -405,8 +405,8 @@ XmlNode *TlenXmlGetNthChild(XmlNode *node, char *tag, int nth) { int i, num; - if (node == NULL || node->numChild <= 0 || tag == NULL || mir_strlen(tag) <= 0 || nth < 1) - return NULL; + if (node == nullptr || node->numChild <= 0 || tag == nullptr || mir_strlen(tag) <= 0 || nth < 1) + return nullptr; num = 1; for (i=0; i<node->numChild; i++) { if (node->child[i]->name && !mir_strcmp(tag, node->child[i]->name)) { @@ -416,7 +416,7 @@ XmlNode *TlenXmlGetNthChild(XmlNode *node, char *tag, int nth) num++; } } - return NULL; + return nullptr; } XmlNode *TlenXmlGetChildWithGivenAttrValue(XmlNode *node, char *tag, char *attrKey, char *attrValue) @@ -424,23 +424,23 @@ XmlNode *TlenXmlGetChildWithGivenAttrValue(XmlNode *node, char *tag, char *attrK int i; char *str; - if (node == NULL || node->numChild <= 0 || tag == NULL || mir_strlen(tag) <= 0 || attrKey == NULL || mir_strlen(attrKey) <= 0 || attrValue == NULL || mir_strlen(attrValue) <= 0) - return NULL; + if (node == nullptr || node->numChild <= 0 || tag == nullptr || mir_strlen(tag) <= 0 || attrKey == nullptr || mir_strlen(attrKey) <= 0 || attrValue == nullptr || mir_strlen(attrValue) <= 0) + return nullptr; for (i=0; i<node->numChild; i++) { if (node->child[i]->name && !mir_strcmp(tag, node->child[i]->name)) { - if ((str=TlenXmlGetAttrValue(node->child[i], attrKey)) != NULL) + if ((str=TlenXmlGetAttrValue(node->child[i], attrKey)) != nullptr) if (!mir_strcmp(str, attrValue)) return node->child[i]; } } - return NULL; + return nullptr; } static void TlenXmlRemoveChild(XmlNode *node, XmlNode *child) { int i; - if (node == NULL || child == NULL || node->numChild <= 0) return; + if (node == nullptr || child == nullptr || node->numChild <= 0) return; for (i=0; i<node->numChild; i++) { if (node->child[i] == child) break; @@ -457,7 +457,7 @@ void TlenXmlFreeNode(XmlNode *node) { int i; - if (node == NULL) + if (node == nullptr) return; // Free all children first for (i=0; i<node->numChild; i++) @@ -482,7 +482,7 @@ XmlNode *TlenXmlCopyNode(XmlNode *node) XmlNode *n; int i; - if (node == NULL) return NULL; + if (node == nullptr) return nullptr; n = (XmlNode *) mir_alloc(sizeof(XmlNode)); // Copy attributes if (node->numAttr > 0) { @@ -490,13 +490,13 @@ XmlNode *TlenXmlCopyNode(XmlNode *node) for (i=0; i<node->numAttr; i++) { n->attr[i] = (XmlAttr *) mir_alloc(sizeof(XmlAttr)); if (node->attr[i]->name) n->attr[i]->name = mir_strdup(node->attr[i]->name); - else n->attr[i]->name = NULL; + else n->attr[i]->name = nullptr; if (node->attr[i]->value) n->attr[i]->value = mir_strdup(node->attr[i]->value); - else n->attr[i]->value = NULL; + else n->attr[i]->value = nullptr; } } else - n->attr = NULL; + n->attr = nullptr; // Recursively copy children if (node->numChild > 0) { n->child = (XmlNode **) mir_alloc(node->numChild*sizeof(XmlNode *)); @@ -504,7 +504,7 @@ XmlNode *TlenXmlCopyNode(XmlNode *node) n->child[i] = TlenXmlCopyNode(node->child[i]); } else - n->child = NULL; + n->child = nullptr; // Copy other fields n->numAttr = node->numAttr; n->maxNumAttr = node->numAttr; @@ -512,8 +512,8 @@ XmlNode *TlenXmlCopyNode(XmlNode *node) n->maxNumChild = node->numChild; n->depth = node->depth; n->state = node->state; - n->name = (node->name)?mir_strdup(node->name):NULL; - n->text = (node->text)?mir_strdup(node->text):NULL; + n->name = (node->name)?mir_strdup(node->name):nullptr; + n->text = (node->text)?mir_strdup(node->text):nullptr; return n; } @@ -522,8 +522,8 @@ XmlNode *TlenXmlCreateNode(char *name) { XmlNode *n; - if (name == NULL) - return NULL; + if (name == nullptr) + return nullptr; n = (XmlNode *) mir_alloc(sizeof(XmlNode)); memset(n, 0, sizeof(XmlNode)); @@ -535,7 +535,7 @@ void TlenXmlAddAttr(XmlNode *n, char *name, char *value) { int i; - if (n == NULL || name == NULL || value == NULL) + if (n == nullptr || name == nullptr || value == nullptr) return; i = n->numAttr; @@ -550,8 +550,8 @@ XmlNode *TlenXmlAddChild(XmlNode *n, char *name) { int i; - if (n == NULL || name == NULL) - return NULL; + if (n == nullptr || name == nullptr) + return nullptr; i = n->numChild; n->numChild++; @@ -564,7 +564,7 @@ XmlNode *TlenXmlAddChild(XmlNode *n, char *name) void TlenXmlAddText(XmlNode *n, char *text) { - if (n != NULL && text != NULL) { + if (n != nullptr && text != nullptr) { if (n->text) mir_free(n->text); n->text = mir_strdup(text); } diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp index 66979d3bdb..de5356a18a 100644 --- a/protocols/Tox/src/main.cpp +++ b/protocols/Tox/src/main.cpp @@ -4,7 +4,7 @@ int hLangpack; CHAT_MANAGER *pci; CLIST_INTERFACE *pcli; HINSTANCE g_hInstance; -HMODULE g_hToxLibrary = NULL; +HMODULE g_hToxLibrary = nullptr; PLUGININFOEX pluginInfo = { @@ -38,7 +38,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC extern "C" int __declspec(dllexport) Load(void) { g_hToxLibrary = LoadLibrary(TOX_LIBRARY); - if (g_hToxLibrary == NULL) + if (g_hToxLibrary == nullptr) return 1; if (!TOX_VERSION_IS_ABI_COMPATIBLE()) diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index fa4120abfe..b1bfa58490 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -26,7 +26,7 @@ CToxProto* CToxProto::GetContactAccount(MCONTACT hContact) for (int i = 0; i < Accounts.getCount(); i++)
if (mir_strcmpi(GetContactProto(hContact), Accounts[i]->m_szModuleName) == 0)
return Accounts[i];
- return NULL;
+ return nullptr;
}
int CToxProto::OnAccountLoaded(WPARAM, LPARAM)
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index 871276e288..3e41c796f6 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -77,14 +77,14 @@ void CToxProto::SetToxAvatar(const wchar_t* path) debugLogA(__FUNCTION__": send avatar to friend (%d)", friendNumber);
TOX_ERR_FILE_SEND error;
- uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, NULL, 0, &error);
+ uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, nullptr, 0, &error);
if (error != TOX_ERR_FILE_SEND_OK) {
mir_free(data);
debugLogA(__FUNCTION__": failed to set new avatar (%d)", error);
return;
}
- AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, NULL, length);
+ AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, nullptr, length);
transfer->pfts.flags |= PFTS_SENDING;
memcpy(transfer->hash, hash, TOX_HASH_LENGTH);
transfer->pfts.hContact = hContact;
@@ -149,7 +149,7 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam) debugLogA(__FUNCTION__": setting avatar");
wchar_t *path = (wchar_t*)lParam;
ptrW avatarPath(GetAvatarFilePath());
- if (path != NULL) {
+ if (path != nullptr) {
debugLogA(__FUNCTION__": copy new avatar");
if (!CopyFile(path, avatarPath, FALSE)) {
debugLogA(__FUNCTION__": failed to copy new avatar to avatar cache");
@@ -173,7 +173,7 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam) debugLogA(__FUNCTION__": unset avatar for friend (%d)", friendNumber);
TOX_ERR_FILE_SEND error;
- tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, &error);
+ tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, nullptr, nullptr, 0, &error);
if (error != TOX_ERR_FILE_SEND_OK) {
debugLogA(__FUNCTION__": failed to unset avatar (%d)", error);
return 0;
@@ -199,7 +199,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer) transfers.Remove(transfer);
delSetting(hConact, TOX_SETTINGS_AVATAR_HASH);
- ProtoBroadcastAck(hConact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, 0, 0);
+ ProtoBroadcastAck(hConact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, nullptr, 0);
return;
}
@@ -228,7 +228,7 @@ void CToxProto::OnGotFriendAvatarData(AvatarTransferParam *transfer) mir_wstrcpy(ai.filename, transfer->pfts.tszCurrentFile);
fclose(transfer->hFile);
- transfer->hFile = NULL;
+ transfer->hFile = nullptr;
ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
transfers.Remove(transfer);
diff --git a/protocols/Tox/src/tox_bootstrap.cpp b/protocols/Tox/src/tox_bootstrap.cpp index 6617044e73..5f1ae93dc1 100644 --- a/protocols/Tox/src/tox_bootstrap.cpp +++ b/protocols/Tox/src/tox_bootstrap.cpp @@ -5,7 +5,7 @@ void CToxProto::BootstrapUdpNode(Tox *tox, const char *address, int port, const if (!toxThread) return; - if (address == NULL || hexKey == NULL) + if (address == nullptr || hexKey == nullptr) return; ToxBinAddress binKey(hexKey, TOX_PUBLIC_KEY_SIZE * 2); @@ -19,7 +19,7 @@ void CToxProto::BootstrapTcpRelay(Tox *tox, const char *address, int port, const if (!toxThread) return; - if (address == NULL || hexKey == NULL) + if (address == nullptr || hexKey == nullptr) return; ToxBinAddress binKey(hexKey, TOX_PUBLIC_KEY_SIZE * 2); @@ -65,7 +65,7 @@ void CToxProto::BootstrapNodesFromJson(Tox *tox, bool isIPv6) if (IsFileExists(path)) { FILE *hFile = _wfopen(path, L"r"); - if (hFile != NULL) { + if (hFile != nullptr) { _fseeki64(hFile, 0, SEEK_END); size_t size = _ftelli64(hFile); json = (char*)mir_calloc(size); @@ -141,8 +141,8 @@ void CToxProto::UpdateNodes() ptrW path(mir_wstrdup((wchar_t*)VARSW(_A2W(TOX_JSON_PATH)))); if (!IsFileExists(path)) { - HANDLE hProfile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - if (hProfile == NULL) { + HANDLE hProfile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr); + if (hProfile == nullptr) { debugLogA(__FUNCTION__": failed to create tox.json"); return; } diff --git a/protocols/Tox/src/tox_connection.cpp b/protocols/Tox/src/tox_connection.cpp index d01879f065..4c578a9696 100644 --- a/protocols/Tox/src/tox_connection.cpp +++ b/protocols/Tox/src/tox_connection.cpp @@ -24,7 +24,7 @@ void CToxProto::TryConnect(Tox *tox) int maxConnectRetries = getByte("MaxConnectRetries", TOX_MAX_CONNECT_RETRIES); if (m_iStatus++ > maxConnectRetries) { SetStatus(ID_STATUS_OFFLINE); - ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK); + ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, LOGINERR_NONETWORK); debugLogA(__FUNCTION__": failed to connect to DHT"); return; } @@ -82,7 +82,7 @@ void CToxProto::PollingThread(void*) Tox_Options *options = GetToxOptions(); if (!options) { SetStatus(ID_STATUS_OFFLINE); - ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL); + ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr); debugLogA(__FUNCTION__": leaving"); return; } @@ -113,8 +113,8 @@ void CToxProto::PollingThread(void*) } UninitToxCore(toxThread.Tox()); - this->toxThread = NULL; - hPollingThread = NULL; + this->toxThread = nullptr; + hPollingThread = nullptr; debugLogA(__FUNCTION__": leaving"); }
\ No newline at end of file diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 80caaf0a00..3b76b37407 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -246,10 +246,10 @@ void CToxProto::OnFriendRequest(Tox*, const uint8_t *pubKey, const uint8_t *mess proto->delSetting(hContact, "Auth");
- DB_AUTH_BLOB blob(hContact, 0, 0, 0, (LPCSTR)address, (LPCSTR)message);
+ DB_AUTH_BLOB blob(hContact, nullptr, nullptr, nullptr, (LPCSTR)address, (LPCSTR)message);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.lParam = blob.size();
pre.szMessage = blob;
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
@@ -339,14 +339,14 @@ void CToxProto::OnConnectionStatusChanged(Tox *tox, uint32_t friendNumber, TOX_C proto->debugLogA(__FUNCTION__": send avatar to friend (%d)", friendNumber);
TOX_ERR_FILE_SEND error;
- uint32_t fileNumber = tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, NULL, 0, &error);
+ uint32_t fileNumber = tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, nullptr, 0, &error);
if (error != TOX_ERR_FILE_SEND_OK) {
Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": failed to set new avatar");
fclose(hFile);
return;
}
- AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, NULL, length);
+ AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, nullptr, length);
transfer->pfts.flags |= PFTS_SENDING;
memcpy(transfer->hash, hash, TOX_HASH_LENGTH);
transfer->pfts.hContact = hContact;
@@ -355,7 +355,7 @@ void CToxProto::OnConnectionStatusChanged(Tox *tox, uint32_t friendNumber, TOX_C }
else {
proto->debugLogA(__FUNCTION__": unset avatar for friend (%d)", friendNumber);
- tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, NULL);
+ tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, nullptr, nullptr, 0, nullptr);
}
}
@@ -366,7 +366,7 @@ int CToxProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) MCONTACT hContact = lParam;
char *szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmp(szProto, m_szModuleName)) {
+ if (szProto != nullptr && !mir_strcmp(szProto, m_szModuleName)) {
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.flags = ODPF_UNICODE | ODPF_DONTTRANSLATE;
odp.hInstance = g_hInstance;
@@ -413,7 +413,7 @@ INT_PTR CToxProto::UserInfoProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar case PSN_APPLY:
MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
char *szProto = (hContact == NULL) ? proto->m_szModuleName : GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
break;
wchar_t dnsId[MAX_PATH];
diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp index 87ebdaa925..a96e7984d4 100644 --- a/protocols/Tox/src/tox_icons.cpp +++ b/protocols/Tox/src/tox_icons.cpp @@ -20,5 +20,5 @@ HANDLE CToxProto::GetIconHandle(int iconId) if (Icons[i].defIconID == iconId)
return Icons[i].hIcolib;
- return NULL;
+ return nullptr;
}
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index 9ed494e289..761294cbf7 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -21,7 +21,7 @@ void CToxProto::OnFriendMessage(Tox *tox, uint32_t friendNumber, TOX_MESSAGE_TYP rawMessage[length] = 0;
PROTORECVEVENT recv = { 0 };
- recv.timestamp = time(NULL);
+ recv.timestamp = time(nullptr);
recv.szMessage = rawMessage;
recv.lParam = type == TOX_MESSAGE_TYPE_NORMAL ? EVENTTYPE_MESSAGE : DB_EVENT_ACTION;
ProtoChainRecvMsg(hContact, &recv);
@@ -73,7 +73,7 @@ void CToxProto::SendMessageAsync(void *arg) int CToxProto::OnSendMessage(MCONTACT hContact, const char *szMessage)
{
if (!IsOnline()) {
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("You cannot send when you are offline."));
+ ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)Translate("You cannot send when you are offline."));
return 0;
}
diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp index cb8f17fdb9..c9c840274a 100644 --- a/protocols/Tox/src/tox_multimedia.cpp +++ b/protocols/Tox/src/tox_multimedia.cpp @@ -61,7 +61,7 @@ void CToxIncomingCall::OnInitDialog() void CToxIncomingCall::OnClose()
{
- toxav_call_control(m_proto->toxThread->ToxAV(), m_proto->calls[hContact], TOXAV_CALL_CONTROL_CANCEL, NULL);
+ toxav_call_control(m_proto->toxThread->ToxAV(), m_proto->calls[hContact], TOXAV_CALL_CONTROL_CANCEL, nullptr);
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "IncomingCallWindow_");
CToxCallDlgBase::OnClose();
}
@@ -141,13 +141,13 @@ void CToxOutgoingCall::OnCall(CCtrlBase*) }
//mir_free(cSettings);
- char *message = NULL;
+ char *message = nullptr;
wchar_t title[MAX_PATH];
if (GetWindowText(m_hwnd, title, _countof(title)))
message = mir_utf8encodeW(title);
else
message = mir_utf8encode("Outgoing call");
- m_proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
+ m_proto->AddEventToDb(hContact, DB_EVENT_CALL, time(nullptr), DBEF_UTF, (PBYTE)message, mir_strlen(message));
call.Enable(FALSE);
SetIcon("audio_call");
@@ -163,7 +163,7 @@ void CToxOutgoingCall::OnCancel(CCtrlBase*) }
if (!call.Enabled())
- toxav_call_control(m_proto->toxThread->ToxAV(), friendNumber, TOXAV_CALL_CONTROL_CANCEL, NULL);
+ toxav_call_control(m_proto->toxThread->ToxAV(), friendNumber, TOXAV_CALL_CONTROL_CANCEL, nullptr);
}
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -188,7 +188,7 @@ void CToxCallDialog::OnClose() return;
}
- toxav_call_control(m_proto->toxThread->ToxAV(), friendNumber, TOXAV_CALL_CONTROL_CANCEL, NULL);
+ toxav_call_control(m_proto->toxThread->ToxAV(), friendNumber, TOXAV_CALL_CONTROL_CANCEL, nullptr);
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "CallWindow_");
CToxCallDlgBase::OnClose();
}
diff --git a/protocols/Tox/src/tox_netlib.cpp b/protocols/Tox/src/tox_netlib.cpp index f41f312722..ab76d7d815 100644 --- a/protocols/Tox/src/tox_netlib.cpp +++ b/protocols/Tox/src/tox_netlib.cpp @@ -17,5 +17,5 @@ void CToxProto::InitNetlib() void CToxProto::UninitNetlib()
{
Netlib_CloseHandle(m_hNetlibUser);
- m_hNetlibUser = NULL;
+ m_hNetlibUser = nullptr;
}
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 07cb3b2f31..bf4aeea940 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -71,15 +71,15 @@ void CToxOptionsMain::ToxAddressCopy_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*)
{
- Tox_Options *options = NULL;
+ Tox_Options *options = nullptr;
tox_options_default(options);
- Tox *tox = tox_new(options, NULL);
+ Tox *tox = tox_new(options, nullptr);
tox_options_free(options);
ptrW profilePath(m_proto->GetToxProfilePath());
if (!m_proto->IsFileExists(profilePath)) {
- HANDLE hProfile = CreateFile(profilePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- if (hProfile == NULL) {
+ HANDLE hProfile = CreateFile(profilePath, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
+ if (hProfile == nullptr) {
m_proto->debugLogA(__FUNCTION__": failed to create tox profile");
return;
}
@@ -128,7 +128,7 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) if (mir_wstrcmpi(profilePath, defaultProfilePath) != 0)
CopyFile(profilePath, defaultProfilePath, FALSE);
- Tox_Options *options = tox_options_new(NULL);
+ Tox_Options *options = tox_options_new(nullptr);
if (m_proto->LoadToxProfile(options)) {
CToxThread toxThread(options);
@@ -214,7 +214,7 @@ CToxOptionsMultimedia::CToxOptionsMultimedia(CToxProto *proto) void CToxOptionsMultimedia::EnumDevices(CCtrlCombo &combo, IMMDeviceEnumerator *pEnumerator, EDataFlow dataFlow, const char* setting)
{
- LPWSTR pwszDefID = NULL;
+ LPWSTR pwszDefID = nullptr;
ptrW wszDefID(m_proto->getWStringA(setting));
if (wszDefID != NULL) {
size_t len = mir_wstrlen(wszDefID) + 1;
@@ -222,29 +222,29 @@ void CToxOptionsMultimedia::EnumDevices(CCtrlCombo &combo, IMMDeviceEnumerator * mir_wstrncpy(pwszDefID, wszDefID, len);
}
else {
- CComPtr<IMMDevice> pDevice = NULL;
+ CComPtr<IMMDevice> pDevice = nullptr;
if (FAILED(pEnumerator->GetDefaultAudioEndpoint(dataFlow, eConsole, &pDevice))) return;
if (FAILED(pDevice->GetId(&pwszDefID))) return;
}
- CComPtr<IMMDeviceCollection> pDevices = NULL;
+ CComPtr<IMMDeviceCollection> pDevices = nullptr;
EXIT_ON_ERROR(pEnumerator->EnumAudioEndpoints(dataFlow, DEVICE_STATE_ACTIVE, &pDevices));
UINT count;
EXIT_ON_ERROR(pDevices->GetCount(&count));
for (UINT i = 0; i < count; i++) {
- CComPtr<IMMDevice> pDevice = NULL;
+ CComPtr<IMMDevice> pDevice = nullptr;
EXIT_ON_ERROR(pDevices->Item(i, &pDevice));
- CComPtr<IPropertyStore> pProperties = NULL;
+ CComPtr<IPropertyStore> pProperties = nullptr;
EXIT_ON_ERROR(pDevice->OpenPropertyStore(STGM_READ, &pProperties));
PROPVARIANT varName;
PropVariantInit(&varName);
EXIT_ON_ERROR(pProperties->GetValue(PKEY_Device_FriendlyName, &varName));
- LPWSTR pwszID = NULL;
+ LPWSTR pwszID = nullptr;
EXIT_ON_ERROR(pDevice->GetId(&pwszID));
combo.InsertString(varName.pwszVal, i, (LPARAM)mir_wstrdup(pwszID));
if (mir_wstrcmpi(pwszID, pwszDefID) == 0)
@@ -262,8 +262,8 @@ void CToxOptionsMultimedia::OnInitDialog() {
CToxDlgBase::OnInitDialog();
- CComPtr<IMMDeviceEnumerator> pEnumerator = NULL;
- if (FAILED(CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&pEnumerator)))
+ CComPtr<IMMDeviceEnumerator> pEnumerator = nullptr;
+ if (FAILED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&pEnumerator)))
return;
EnumDevices(m_audioInput, pEnumerator, eCapture, "AudioInputDeviceID");
@@ -521,7 +521,7 @@ void CToxOptionsNodeList::ReloadNodeList() ptrA json;
FILE *hFile = _wfopen(path, L"r");
- if (hFile != NULL) {
+ if (hFile != nullptr) {
_fseeki64(hFile, 0, SEEK_END);
size_t size = _ftelli64(hFile);
json = (char*)mir_calloc(size);
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 885769f154..a144eebee2 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -27,7 +27,7 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) return false;
FILE *profile = _wfopen(profilePath, L"rb");
- if (profile == NULL) {
+ if (profile == nullptr) {
ShowNotification(TranslateT("Unable to open Tox profile"), MB_ICONERROR);
debugLogA(__FUNCTION__": failed to open tox profile");
return false;
@@ -111,7 +111,7 @@ void CToxProto::SaveToxProfile(Tox *tox) ptrW profilePath(GetToxProfilePath());
FILE *profile = _wfopen(profilePath, L"wb");
- if (profile == NULL) {
+ if (profile == nullptr) {
debugLogA(__FUNCTION__": failed to open tox profile");
mir_free(data);
return;
@@ -129,7 +129,7 @@ INT_PTR CToxProto::OnCopyToxID(WPARAM, LPARAM) {
ptrA address(getStringA(TOX_SETTINGS_ID));
size_t length = mir_strlen(address) + 1;
- if (OpenClipboard(NULL)) {
+ if (OpenClipboard(nullptr)) {
EmptyClipboard();
HGLOBAL hMemory = GlobalAlloc(GMEM_FIXED, length);
memcpy(GlobalLock(hMemory), address, length);
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 5b05d878c2..5b6d345c9c 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -2,8 +2,8 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName)
: PROTO<CToxProto>(protoName, userName),
- toxThread(NULL), isTerminated(false),
- hCheckingThread(NULL), hPollingThread(NULL),
+ toxThread(nullptr), isTerminated(false),
+ hCheckingThread(nullptr), hPollingThread(nullptr),
hMessageProcess(1)
{
InitNetlib();
@@ -33,7 +33,7 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName) // hAudioDialogs = WindowList_Create();
- hTerminateEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hTerminateEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
}
CToxProto::~CToxProto()
@@ -173,7 +173,7 @@ int CToxProto::SetStatus(int iNewStatus) // login
isTerminated = false;
m_iStatus = ID_STATUS_CONNECTING;
- hPollingThread = ForkThreadEx(&CToxProto::PollingThread, NULL, NULL);
+ hPollingThread = ForkThreadEx(&CToxProto::PollingThread, nullptr, nullptr);
}
else {
// set tox status
@@ -192,7 +192,7 @@ HANDLE CToxProto::GetAwayMsg(MCONTACT hContact) return (HANDLE)hContact;
}
- return 0;
+ return nullptr;
}
int CToxProto::SetAwayMsg(int, const wchar_t *msg)
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 81724f482f..d03d3a091a 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -38,8 +38,8 @@ ToxHexAddress ResolveToxAddressFromDns(const char *dnsQuery) {
ToxHexAddress address = ToxHexAddress::Empty();
- DNS_RECORDA *record = NULL;
- DNS_STATUS status = DnsQuery_A(dnsQuery, DNS_TYPE_TEXT, DNS_QUERY_STANDARD, NULL, (PDNS_RECORD*)&record, NULL);
+ DNS_RECORDA *record = nullptr;
+ DNS_STATUS status = DnsQuery_A(dnsQuery, DNS_TYPE_TEXT, DNS_QUERY_STANDARD, nullptr, (PDNS_RECORD*)&record, nullptr);
while (status == ERROR_SUCCESS && record) {
DNS_TXT_DATAA *txt = &record->Data.Txt;
if (record->wType == DNS_TYPE_TEXT && txt->dwStringCount) {
@@ -210,7 +210,7 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) {
if (!IsOnline()) {
// we cannot add someone to friend list while tox is offline
- return NULL;
+ return nullptr;
}
std::smatch match;
@@ -233,14 +233,14 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) CallService(MS_ADDCONTACT_SHOW, (WPARAM)owner, (LPARAM)&acs);
- ForkThread(&CToxProto::SearchFailedAsync, NULL);
+ ForkThread(&CToxProto::SearchFailedAsync, nullptr);
}
else {
regex = "^\\s*(([^ @/:;()\"']+)(@[A-Za-z]+.[A-Za-z]{2,6})?)\\s*$";
if (std::regex_search(query, match, regex))
ForkThread(&CToxProto::SearchByNameAsync, mir_strdup(query.c_str()));
else
- ForkThread(&CToxProto::SearchFailedAsync, NULL);
+ ForkThread(&CToxProto::SearchFailedAsync, nullptr);
}
return (HWND)1;
}
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index 055be5d330..3fb9ad77b7 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -52,7 +52,7 @@ void CToxProto::OnFriendFile(Tox *tox, uint32_t friendNumber, uint32_t fileNumbe PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
- pre.timestamp = time(NULL);
+ pre.timestamp = time(nullptr);
pre.descr.w = L"";
pre.files.w = &name;
pre.lParam = (LPARAM)transfer;
@@ -82,7 +82,7 @@ HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t int action = FILERESUME_OVERWRITE;
const wchar_t **szFilename = (const wchar_t**)mir_alloc(sizeof(wchar_t*) * 2);
szFilename[0] = fullPath;
- szFilename[1] = NULL;
+ szFilename[1] = nullptr;
OnFileResume(hTransfer, &action, szFilename);
mir_free(szFilename);
}
@@ -96,7 +96,7 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFil FileTransferParam *transfer = (FileTransferParam*)hTransfer;
if (*action == FILERESUME_SKIP) {
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
return 0;
}
@@ -109,7 +109,7 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFil wchar_t *mode = *action == FILERESUME_OVERWRITE ? L"wb" : L"ab";
if (!transfer->OpenFile(mode)) {
debugLogA(__FUNCTION__": failed to open file (%d) from %s(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
return NULL;
}
@@ -119,7 +119,7 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFil if (!tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_RESUME, &error)) {
debugLogA(__FUNCTION__": failed to start receiving of file(%d) from %s(%d) cause (%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber, error);
ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
}
@@ -152,7 +152,7 @@ void CToxProto::OnDataReceiving(Tox *tox, uint32_t friendNumber, uint32_t fileNu ToxHexAddress pubKey = proto->GetContactPublicKey(tox, friendNumber);
FileTransferParam *transfer = proto->transfers.Get(friendNumber, fileNumber);
- if (transfer == NULL) {
+ if (transfer == nullptr) {
Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": failed to find transfer (%d) from %s(%d)", fileNumber, (const char*)pubKey, friendNumber);
return;
}
@@ -166,7 +166,7 @@ void CToxProto::OnDataReceiving(Tox *tox, uint32_t friendNumber, uint32_t fileNu MCONTACT hContact = proto->GetContact(tox, friendNumber);
if (hContact == NULL) {
Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": cannot find contact %s(%d)", (const char*)pubKey, friendNumber);
- tox_file_control(tox, friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(tox, friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
return;
}
@@ -177,7 +177,7 @@ void CToxProto::OnDataReceiving(Tox *tox, uint32_t friendNumber, uint32_t fileNu if (fwrite(data, sizeof(uint8_t), length, transfer->hFile) != length) {
proto->debugLogA(__FUNCTION__": failed write to file (%d)", fileNumber);
proto->ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(proto->toxThread->Tox(), friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(proto->toxThread->Tox(), friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
return;
}
@@ -192,12 +192,12 @@ HANDLE CToxProto::OnSendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFi {
int32_t friendNumber = GetToxFriendNumber(hContact);
if (friendNumber == UINT32_MAX)
- return NULL;
+ return nullptr;
FILE *hFile = _wfopen(ppszFiles[0], L"rb");
- if (hFile == NULL) {
+ if (hFile == nullptr) {
debugLogA(__FUNCTION__": cannot open file %s", ppszFiles[0]);
- return NULL;
+ return nullptr;
}
wchar_t *fileName = wcsrchr(ppszFiles[0], '\\') + 1;
@@ -214,12 +214,12 @@ HANDLE CToxProto::OnSendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFi char *name = mir_utf8encodeW(fileName);
TOX_ERR_FILE_SEND sendError;
- uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_DATA, fileSize, NULL, (uint8_t*)name, mir_strlen(name), &sendError);
+ uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_DATA, fileSize, nullptr, (uint8_t*)name, mir_strlen(name), &sendError);
if (sendError != TOX_ERR_FILE_SEND_OK) {
debugLogA(__FUNCTION__": failed to send file (%d) to %s(%d) cause (%d)", fileNumber, (const char*)pubKey, friendNumber, sendError);
mir_free(fileDir);
mir_free(name);
- return NULL;
+ return nullptr;
}
debugLogA(__FUNCTION__": start sending file (%d) to %s(%d)", fileNumber, (const char*)pubKey, friendNumber);
@@ -243,7 +243,7 @@ void CToxProto::OnFileSendData(Tox *tox, uint32_t friendNumber, uint32_t fileNum FileTransferParam *transfer = proto->transfers.Get(friendNumber, fileNumber);
if (!transfer) {
proto->debugLogA(__FUNCTION__": failed to find transfer (%d) to %s(%d)", fileNumber, (const char*)pubKey, friendNumber);
- tox_file_control(tox, friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(tox, friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
return;
}
@@ -266,7 +266,7 @@ void CToxProto::OnFileSendData(Tox *tox, uint32_t friendNumber, uint32_t fileNum if (fread(data, sizeof(uint8_t), length, transfer->hFile) != length) {
proto->debugLogA(__FUNCTION__": failed to read from file (%d) to %s(%d)", fileNumber, (const char*)pubKey, friendNumber);
proto->ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
mir_free(data);
return;
}
@@ -279,7 +279,7 @@ void CToxProto::OnFileSendData(Tox *tox, uint32_t friendNumber, uint32_t fileNum }
proto->debugLogA(__FUNCTION__": failed to send file chunk (%d) to %s(%d) cause (%d)", fileNumber, (const char*)pubKey, friendNumber, error);
proto->ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(proto->toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(proto->toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
mir_free(data);
return;
}
@@ -296,7 +296,7 @@ int CToxProto::CancelTransfer(MCONTACT, HANDLE hTransfer) {
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
debugLogA(__FUNCTION__": Transfer (%d) is canceled", transfer->fileNumber);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
return 0;
@@ -314,7 +314,7 @@ void CToxProto::PauseOutgoingTransfers(uint32_t friendNumber) TOX_ERR_FILE_CONTROL error;
if (!tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_PAUSE, &error)) {
debugLogA(__FUNCTION__": failed to pause the transfer (%d) to %s(%d) cause(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber, error);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
}
}
}
@@ -342,7 +342,7 @@ void CToxProto::CancelAllTransfers(Tox *tox) {
for (size_t i = 0; i < transfers.Count(); i++) {
FileTransferParam *transfer = transfers.GetAt(i);
- tox_file_control(tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
+ tox_file_control(tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DENIED, (HANDLE)transfer, 0);
transfers.Remove(transfer);
}
@@ -355,7 +355,7 @@ void CToxProto::OnFileRequest(Tox *tox, uint32_t friendNumber, uint32_t fileNumb MCONTACT hContact = proto->GetContact(tox, friendNumber);
if (hContact) {
FileTransferParam *transfer = proto->transfers.Get(friendNumber, fileNumber);
- if (transfer == NULL) {
+ if (transfer == nullptr) {
proto->debugLogA(__FUNCTION__": failed to find transfer (%d)", fileNumber);
return;
}
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index 6ef9a5b0fb..722517c427 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -115,7 +115,7 @@ void CToxProto::ShowNotification(const wchar_t *caption, const wchar_t *message, return;
}
- MessageBox(NULL, message, caption, MB_OK | flags);
+ MessageBox(nullptr, message, caption, MB_OK | flags);
}
void CToxProto::ShowNotification(const wchar_t *message, int flags, MCONTACT hContact)
@@ -149,17 +149,17 @@ INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam) if (Accounts.getCount() == 0)
return 1;
- CToxProto *proto = NULL;
+ CToxProto *proto = nullptr;
for (int i = 0; i < Accounts.getCount(); i++) {
if (Accounts[i]->IsOnline()) {
proto = Accounts[i];
break;
}
}
- if (proto == NULL)
+ if (proto == nullptr)
return 1;
- if (wcschr(uri, '@') != NULL)
+ if (wcschr(uri, '@') != nullptr)
return 1;
PROTOSEARCHRESULT psr = { sizeof(psr) };
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index b323d0dbfc..870ef95d00 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(0));
+ gce.time = DWORD(time(nullptr));
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(0));
+ gce.time = DWORD(time(nullptr));
gce.ptszNick = wszId;
gce.ptszUID = gce.ptszNick;
Chat_Event(&gce);
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 3e399e6e5e..3cc359cc59 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -68,7 +68,7 @@ void TwitterProto::SignOn(void*) OnJoinChat(0, true);
SetAllContactStatuses(ID_STATUS_ONLINE);
- hMsgLoop_ = ForkThreadEx(&TwitterProto::MessageLoop, NULL, 0);
+ hMsgLoop_ = ForkThreadEx(&TwitterProto::MessageLoop, nullptr, nullptr);
}
debugLogA("***** SignOn complete");
@@ -170,7 +170,7 @@ bool TwitterProto::NegotiateConnection() mir_snwprintf(buf, _countof(buf), AuthorizeUrl.c_str(), oauthToken.c_str());
debugLogW(L"**NegotiateConnection - Launching %s", buf);
- ShellExecute(NULL, L"open", buf, NULL, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, L"open", buf, nullptr, nullptr, SW_SHOWNORMAL);
ShowPinDialog();
}
@@ -388,7 +388,7 @@ struct update_avatar /* void *p should always be a struct of type update_avatar */
void TwitterProto::UpdateAvatarWorker(void *p)
{
- if (p == 0)
+ if (p == nullptr)
return;
std::auto_ptr<update_avatar> data(static_cast<update_avatar*>(p));
DBVARIANT dbv = { 0 };
@@ -497,7 +497,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM case WM_COMMAND:
// Get the plugin data (we need the Popup service to do it)
url = (std::string *)PUGetPluginData(hwnd);
- if (url != NULL)
+ if (url != nullptr)
Utils_OpenUrl(url->c_str());
// Intentionally no break here
@@ -540,7 +540,7 @@ void TwitterProto::ShowContactPopup(MCONTACT hContact, const std::string &text, db_free(&dbv);
}
- if (url != NULL) {
+ if (url != nullptr) {
popup.PluginWindowProc = PopupWindowProc;
popup.PluginData = (void *)url;
}
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index 9c9f6f4d50..762ccfb86c 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void TwitterProto::AddToListWorker(void *pArg)
{
// TODO: what happens if there is an error?
- if (pArg == 0)
+ if (pArg == nullptr)
return;
char *name = static_cast<char*>(pArg);
@@ -70,7 +70,7 @@ void TwitterProto::UpdateInfoWorker(void *arg) }
UpdateAvatar(hContact, user.profile_image_url, true);
- ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr);
}
int TwitterProto::GetInfo(MCONTACT hContact, int info_type)
@@ -102,7 +102,7 @@ struct search_query void TwitterProto::DoSearch(void *pArg)
{
- if (pArg == 0)
+ if (pArg == nullptr)
return;
search_query *query = static_cast<search_query*>(pArg);
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 4153006ee9..4a4fac9ca2 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -119,7 +119,7 @@ struct send_direct void TwitterProto::SendSuccess(void *p)
{
- if (p == 0)
+ if (p == nullptr)
return;
send_direct *data = static_cast<send_direct*>(p);
@@ -213,7 +213,7 @@ INT_PTR TwitterProto::ReplyToTweet(WPARAM wParam, LPARAM) {
MCONTACT hContact = (MCONTACT) wParam;
// TODO: support replying to tweets instead of just users
- HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_TWEET), 0, tweet_proc, reinterpret_cast<LPARAM>(this));
+ HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_TWEET), nullptr, tweet_proc, reinterpret_cast<LPARAM>(this));
DBVARIANT dbv;
if (!getString(hContact, TWITTER_KEY_UN, &dbv)) {
@@ -292,7 +292,7 @@ INT_PTR TwitterProto::OnTweet(WPARAM, LPARAM) if (m_iStatus != ID_STATUS_ONLINE)
return 1;
- HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_TWEET), 0, tweet_proc, reinterpret_cast<LPARAM>(this));
+ HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_TWEET), nullptr, tweet_proc, reinterpret_cast<LPARAM>(this));
ShowWindow(hDlg, SW_SHOW);
return 0;
}
@@ -308,10 +308,10 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
nlu.szDescriptiveName.w = descr;
m_hNetlibUser = Netlib_RegisterUser(&nlu);
- if (m_hNetlibUser == NULL) {
+ if (m_hNetlibUser == nullptr) {
wchar_t error[200];
mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
- MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
// Create avatar network connection (TODO: probably remove this)
@@ -321,10 +321,10 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) mir_snwprintf(descr, TranslateT("%s avatar connection"), m_tszUserName);
nlu.szDescriptiveName.w = descr;
hAvatarNetlib_ = Netlib_RegisterUser(&nlu);
- if (hAvatarNetlib_ == NULL) {
+ if (hAvatarNetlib_ == nullptr) {
wchar_t error[200];
mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), TranslateT("Twitter (avatars)"));
- MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
twit_.set_handle(this, m_hNetlibUser);
@@ -357,7 +357,7 @@ int TwitterProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) int TwitterProto::ShowPinDialog()
{
- HWND hDlg = (HWND)DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_TWITTERPIN), 0, pin_proc, reinterpret_cast<LPARAM>(this));
+ HWND hDlg = (HWND)DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_TWITTERPIN), nullptr, pin_proc, reinterpret_cast<LPARAM>(this));
ShowWindow(hDlg, SW_SHOW);
return 0;
}
@@ -377,7 +377,7 @@ void TwitterProto::ShowPopup(const wchar_t *text, int Error) if (ServiceExists(MS_POPUP_ADDPOPUPT))
PUAddPopupT(&popup);
else
- MessageBox(0, popup.lptzText, popup.lptzContactName, 0);
+ MessageBox(nullptr, popup.lptzText, popup.lptzContactName, 0);
}
void TwitterProto::ShowPopup(const char *text, int Error)
@@ -394,14 +394,14 @@ void TwitterProto::ShowPopup(const char *text, int Error) if (ServiceExists(MS_POPUP_ADDPOPUPT))
PUAddPopupT(&popup);
else
- MessageBox(0, popup.lptzText, popup.lptzContactName, 0);
+ MessageBox(nullptr, popup.lptzText, popup.lptzContactName, 0);
}
// TODO: the more I think about it, the more I think all twit.* methods should
// be in MessageLoop
void TwitterProto::SendTweetWorker(void *p)
{
- if (p == 0)
+ if (p == nullptr)
return;
char *text = static_cast<char*>(p);
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index a32b8e6e46..68638dcfed 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -50,7 +50,7 @@ HANDLE GetIconHandle(const char *name) if (mir_strcmp(icons[i].szName, name) == 0)
return icons[i].hIcolib;
- return 0;
+ return nullptr;
}
// Contact List menu stuff
@@ -61,13 +61,13 @@ static TwitterProto* GetInstanceByHContact(MCONTACT hContact) {
char *proto = GetContactProto(hContact);
if (!proto)
- return 0;
+ return nullptr;
for (int i = 0; i < g_Instances.getCount(); i++)
if (!mir_strcmp(proto, g_Instances[i].m_szModuleName))
return &g_Instances[i];
- return 0;
+ return nullptr;
}
template<INT_PTR(__cdecl TwitterProto::*Fcn)(WPARAM, LPARAM)>
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index cbd0f18093..9f5d329e30 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -64,7 +64,7 @@ http::response mir_twitter::slurp(const std::string &url, http::method meth, OAu if (oauthAccessTokenSecret_.size() > 0) { ppro_->debugLogA("**SLURP::GET - we have a oauthAccessTokenSecret"); }
if (pin_.size() > 0) { ppro_->debugLogA("**SLURP::GET - we have a pin"); }
- auth = OAuthWebRequestSubmit(url_WSTR, L"GET", NULL, consumerKey_, consumerSecret_,
+ auth = OAuthWebRequestSubmit(url_WSTR, L"GET", nullptr, consumerKey_, consumerSecret_,
oauthAccessToken_, oauthAccessTokenSecret_, pin_);
}
else if (meth == http::post) {
@@ -122,7 +122,7 @@ http::response mir_twitter::slurp(const std::string &url, http::method meth, OAu Netlib_FreeHttpRequest(resp);
}
else {
- httpPOST_ = NULL;
+ httpPOST_ = nullptr;
ppro_->debugLogA("SLURP - there was no response!");
}
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 8821dad4fb..67c1ff428a 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -88,7 +88,7 @@ HANDLE GetIconHandle(int iCommand) if (iconList[i].defIconID == iCommand)
return iconList[i].hIcolib;
- return 0;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp index f2da23f78e..6eedc95793 100644 --- a/protocols/VKontakte/src/vk_captcha.cpp +++ b/protocols/VKontakte/src/vk_captcha.cpp @@ -27,7 +27,7 @@ bool CVkProto::RunCaptchaForm(LPCSTR szUrl, CMStringA &result) debugLogA("CVkProto::RunCaptchaForm: reading picture from %s", szUrl);
result.Empty();
- CAPTCHA_FORM_PARAMS param = { 0 };
+ CAPTCHA_FORM_PARAMS param = {};
if (getBool("UseCaptchaAssistant", false)) {
CMStringA szCaptchaAssistant(FORMAT, "http://ca.tiflohelp.ru/?link=%s", ptrA(ExpUrlEncode(szUrl)));
Utils_OpenUrl(szCaptchaAssistant);
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index 0df2946cf3..8e5dcc473a 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -23,7 +23,7 @@ HANDLE CVkProto::SendFile(MCONTACT hContact, const wchar_t *desc, wchar_t **file LONG userID = getDword(hContact, "ID", VK_INVALID_USER);
if (!IsOnline() || ((userID == VK_INVALID_USER || userID == VK_FEED_USER) && !isChatRoom(hContact)) || !files || !files[0])
- return (HANDLE)0;
+ return (HANDLE)nullptr;
CVkFileUploadParam *fup = new CVkFileUploadParam(hContact, desc, files);
@@ -31,7 +31,7 @@ HANDLE CVkProto::SendFile(MCONTACT hContact, const wchar_t *desc, wchar_t **file if (!fup->IsAccess()) {
SendFileFiled(fup, VKERR_FILE_NOT_EXIST);
- return (HANDLE)0;
+ return (HANDLE)nullptr;
}
AsyncHttpRequest *pReq;
@@ -47,7 +47,7 @@ HANDLE CVkProto::SendFile(MCONTACT hContact, const wchar_t *desc, wchar_t **file break;
default:
SendFileFiled(fup, VKERR_FTYPE_NOT_SUPPORTED);
- return (HANDLE)0;
+ return (HANDLE)nullptr;
}
pReq->pUserInfo = fup;
Push(pReq);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 99a0cdf0d0..85b403de7a 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -159,7 +159,7 @@ void CVkProto::InitMenus() CreateProtoService(PS_MARKMESSAGESASREAD, &CVkProto::SvcMarkMessagesAsRead);
for (int i = 0; i < PMI_COUNT; i++)
- m_hProtoMenuItems[i] = 0;
+ m_hProtoMenuItems[i] = nullptr;
CMenuItem mi;
mi.root = Menu_GetProtocolRoot(this);
diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index f26804e0ea..cd5df9ff05 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -47,7 +47,7 @@ int CVkProto::SetStatus(int iNewStatus) ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
debugLogA("CVkProto::SetStatus (2) iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d oldStatus = %d",
iNewStatus, m_iStatus, m_iDesiredStatus, oldStatus);
- m_hWorkerThread = ForkThreadEx(&CVkProto::WorkerThread, 0, nullptr);
+ m_hWorkerThread = ForkThreadEx(&CVkProto::WorkerThread, nullptr, nullptr);
}
else if (IsOnline()) {
debugLogA("CVkProto::SetStatus (3) iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d oldStatus = %d",
diff --git a/protocols/WhatsApp/src/WASocketConnection.cpp b/protocols/WhatsApp/src/WASocketConnection.cpp index 5ba6c781eb..316d8fb5af 100644 --- a/protocols/WhatsApp/src/WASocketConnection.cpp +++ b/protocols/WhatsApp/src/WASocketConnection.cpp @@ -1,7 +1,7 @@ #include "stdafx.h"
#include "WASocketConnection.h"
-HNETLIBUSER g_hNetlibUser = NULL;
+HNETLIBUSER g_hNetlibUser = nullptr;
void WASocketConnection::initNetwork(HNETLIBUSER hNetlibUser) throw (WAException)
{
@@ -19,7 +19,7 @@ WASocketConnection::WASocketConnection(const std::string &dir, int port) throw ( noc.wPort = port;
noc.flags = NLOCF_V2; // | NLOCF_SSL;
this->hConn = Netlib_OpenConnection(g_hNetlibUser, &noc);
- if (this->hConn == NULL)
+ if (this->hConn == nullptr)
throw WAException(getLastErrorMsg(), WAException::SOCKET_EX, WAException::SOCKET_EX_OPEN);
this->connected = true;
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp index bb163013d5..4a7bf6e310 100644 --- a/protocols/WhatsApp/src/avatars.cpp +++ b/protocols/WhatsApp/src/avatars.cpp @@ -14,7 +14,7 @@ INT_PTR WhatsAppProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) ptrA szAvatarId(getStringA(pai->hContact, WHATSAPP_KEY_AVATAR_ID));
if (szAvatarId == NULL || (wParam & GAIF_FORCE) != 0)
- if (pai->hContact != NULL && m_pConnection != NULL) {
+ if (pai->hContact != NULL && m_pConnection != nullptr) {
m_pConnection->sendGetPicture(id, "image");
return GAIR_WAITFOR;
}
@@ -70,34 +70,34 @@ INT_PTR WhatsAppProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) static std::vector<unsigned char>* sttFileToMem(const wchar_t *ptszFileName)
{
- HANDLE hFile = CreateFile(ptszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(ptszFileName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
- return NULL;
+ return nullptr;
DWORD upperSize, lowerSize = GetFileSize(hFile, &upperSize);
std::vector<unsigned char> *result = new std::vector<unsigned char>(lowerSize);
- ReadFile(hFile, (void*)result->data(), lowerSize, &upperSize, NULL);
+ ReadFile(hFile, (void*)result->data(), lowerSize, &upperSize, nullptr);
CloseHandle(hFile);
return result;
}
int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const wchar_t *ptszFileName)
{
- if (!isOnline() || ptszFileName == NULL)
+ if (!isOnline() || ptszFileName == nullptr)
return 1;
if (_waccess(ptszFileName, 4) != 0)
return errno;
ResizeBitmap resize = { 0 };
- if ((resize.hBmp = Bitmap_Load(ptszFileName)) == NULL)
+ if ((resize.hBmp = Bitmap_Load(ptszFileName)) == nullptr)
return 2;
resize.size = sizeof(resize);
resize.fit = RESIZEBITMAP_KEEP_PROPORTIONS;
resize.max_height = resize.max_width = 96;
HBITMAP hbmpPreview = (HBITMAP)CallService(MS_IMG_RESIZE, (LPARAM)&resize, 0);
- if (hbmpPreview == NULL)
+ if (hbmpPreview == nullptr)
return 3;
wchar_t tszTempFile[MAX_PATH], tszMyFile[MAX_PATH];
@@ -111,7 +111,7 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const wcsncpy_s(tszTempFile, (tszContactAva + L".preview").c_str(), _TRUNCATE);
}
- IMGSRVC_INFO saveInfo = { sizeof(saveInfo), 0 };
+ IMGSRVC_INFO saveInfo = { sizeof(saveInfo), nullptr };
saveInfo.hbm = hbmpPreview;
saveInfo.tszName = tszTempFile;
saveInfo.dwMask = IMGI_HBITMAP;
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 3fc47cb8f9..24cdc5a177 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -45,7 +45,7 @@ int WhatsAppProto::onGroupChatEvent(WPARAM, LPARAM lParam) std::string chat_id(T2Utf(gch->ptszID));
WAChatInfo *pInfo = SafeGetChat(chat_id);
- if (pInfo == NULL)
+ if (pInfo == nullptr)
return 0;
switch (gch->iType) {
@@ -63,7 +63,7 @@ int WhatsAppProto::onGroupChatEvent(WPARAM, LPARAM lParam) try {
int msgId = GetSerial();
- time_t now = time(NULL);
+ time_t now = time(nullptr);
std::string id = Utilities::intToStr(now) + "-" + Utilities::intToStr(msgId);
FMessage fmsg(chat_id, true, id);
@@ -101,14 +101,14 @@ int WhatsAppProto::onGroupChatEvent(WPARAM, LPARAM lParam) static gc_item sttLogListItems[] =
{
{ LPGENW("&Invite a user"), IDM_INVITE, MENU_ITEM },
- { NULL, 0, MENU_SEPARATOR },
+ { nullptr, 0, MENU_SEPARATOR },
{ LPGENW("&Room options"), 0, MENU_NEWPOPUP },
{ LPGENW("View/change &topic"), IDM_TOPIC, MENU_POPUPITEM },
{ LPGENW("&Quit chat session"), IDM_LEAVE, MENU_POPUPITEM },
#ifdef _DEBUG
{ LPGENW("Set &avatar"), IDM_AVATAR, MENU_POPUPITEM }, // doesn't work, therefore commented out
#endif
- { NULL, 0, MENU_SEPARATOR },
+ { nullptr, 0, MENU_SEPARATOR },
{ LPGENW("Copy room &JID"), IDM_CPY_RJID, MENU_ITEM },
{ LPGENW("Copy room topic"), IDM_CPY_TOPIC, MENU_ITEM },
};
@@ -171,7 +171,7 @@ void WhatsAppProto::SetChatAvatar(WAChatInfo *pInfo) OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.lpstrFilter = filter;
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = tszFileName;
ofn.nMaxFile = ofn.nMaxFileTitle = _countof(tszFileName);
ofn.Flags = OFN_HIDEREADONLY;
@@ -188,9 +188,9 @@ void WhatsAppProto::SetChatAvatar(WAChatInfo *pInfo) static gc_item sttNickListItems[] =
{
{ LPGENW("&Add to roster"), IDM_ADD_RJID, MENU_POPUPITEM },
- { NULL, 0, MENU_SEPARATOR },
+ { nullptr, 0, MENU_SEPARATOR },
{ LPGENW("&Kick"), IDM_KICK, MENU_ITEM },
- { NULL, 0, MENU_SEPARATOR },
+ { nullptr, 0, MENU_SEPARATOR },
{ LPGENW("Copy &nickname"), IDM_CPY_NICK, MENU_ITEM },
{ LPGENW("Copy real &JID"), IDM_CPY_RJID, MENU_ITEM },
};
@@ -267,7 +267,7 @@ int WhatsAppProto::OnDeleteChat(WPARAM hContact, LPARAM) int WhatsAppProto::OnChatMenu(WPARAM, LPARAM lParam)
{
GCMENUITEMS *gcmi = (GCMENUITEMS*)lParam;
- if (gcmi == NULL)
+ if (gcmi == nullptr)
return 0;
if (mir_strcmpi(gcmi->pszModule, m_szModuleName))
@@ -323,7 +323,7 @@ wchar_t* WhatsAppProto::GetChatUserNick(const std::string &jid) }
else tszNick = str2t(m_szNick);
- if (tszNick == NULL)
+ if (tszNick == nullptr)
tszNick = mir_wstrdup(TranslateT("Unknown user"));
return tszNick;
}
@@ -340,7 +340,7 @@ WAChatInfo* WhatsAppProto::SafeGetChat(const std::string &jid) void WhatsAppProto::onGroupInfo(const std::string &jid, const std::string &owner, const std::string &subject, const std::string &subject_owner, int time_subject, int)
{
WAChatInfo *pInfo = SafeGetChat(jid);
- if (pInfo == NULL) {
+ if (pInfo == nullptr) {
pInfo = InitChat(jid, subject);
pInfo->bActive = true;
time_subject = 0;
@@ -363,7 +363,7 @@ void WhatsAppProto::onGroupMessage(const FMessage &pMsg) }
WAChatInfo *pInfo = SafeGetChat(pMsg.key.remote_jid);
- if (pInfo == NULL) {
+ if (pInfo == nullptr) {
pInfo = InitChat(pMsg.key.remote_jid, "");
pInfo->bActive = true;
}
@@ -395,7 +395,7 @@ void WhatsAppProto::onGroupMessage(const FMessage &pMsg) void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string &author, const std::string &newSubject, int ts)
{
WAChatInfo *pInfo = SafeGetChat(gjid);
- if (pInfo == NULL)
+ if (pInfo == nullptr)
return;
ptrW tszText(str2t(newSubject));
@@ -420,7 +420,7 @@ void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string void WhatsAppProto::onGroupAddUser(const std::string &gjid, const std::string &ujid, int ts)
{
WAChatInfo *pInfo = SafeGetChat(gjid);
- if (pInfo == NULL || !pInfo->bActive)
+ if (pInfo == nullptr || !pInfo->bActive)
return;
ptrW tszUID(str2t(ujid));
@@ -437,7 +437,7 @@ void WhatsAppProto::onGroupAddUser(const std::string &gjid, const std::string &u void WhatsAppProto::onGroupRemoveUser(const std::string &gjid, const std::string &ujid, int ts)
{
WAChatInfo *pInfo = SafeGetChat(gjid);
- if (pInfo == NULL)
+ if (pInfo == nullptr)
return;
ptrW tszUID(str2t(ujid));
@@ -454,7 +454,7 @@ void WhatsAppProto::onGroupRemoveUser(const std::string &gjid, const std::string void WhatsAppProto::onLeaveGroup(const std::string &gjid)
{
WAChatInfo *pInfo = SafeGetChat(gjid);
- if (pInfo == NULL)
+ if (pInfo == nullptr)
return;
Chat_Terminate(m_szModuleName, pInfo->tszJid);
@@ -468,7 +468,7 @@ void WhatsAppProto::onGetParticipants(const std::string &gjid, const std::vector mir_cslock lck(m_csChats);
WAChatInfo *pInfo = m_chats[gjid];
- if (pInfo == NULL)
+ if (pInfo == nullptr)
return;
pInfo->bActive = true;
@@ -499,7 +499,7 @@ void WhatsAppProto::onGroupCreated(const std::string &gjid, const std::string &s void WhatsAppProto::onGroupMessageReceived(const FMessage &msg)
{
WAChatInfo *pInfo = SafeGetChat(msg.key.remote_jid);
- if (pInfo == NULL)
+ if (pInfo == nullptr)
return;
auto p = pInfo->m_unsentMsgs.find(msg.key.id);
@@ -513,7 +513,7 @@ void WhatsAppProto::onGroupMessageReceived(const FMessage &msg) gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
- gce.time = time(NULL);
+ gce.time = time(nullptr);
gce.ptszText = p->second.c_str();
gce.bIsMe = m_szJid == msg.remote_resource;
Chat_Event(&gce);
diff --git a/protocols/WhatsApp/src/connection.cpp b/protocols/WhatsApp/src/connection.cpp index 646a5b134f..a7fa47958f 100644 --- a/protocols/WhatsApp/src/connection.cpp +++ b/protocols/WhatsApp/src/connection.cpp @@ -34,16 +34,16 @@ void WhatsAppProto::stayConnectedLoop(void*) Mutex writerMutex;
bool error = false;
- m_pSocket = NULL;
+ m_pSocket = nullptr;
while (true) {
- if (m_pConnection != NULL) {
+ if (m_pConnection != nullptr) {
delete m_pConnection;
- m_pConnection = NULL;
+ m_pConnection = nullptr;
}
- if (m_pSocket != NULL) {
+ if (m_pSocket != nullptr) {
delete m_pSocket;
- m_pSocket = NULL;
+ m_pSocket = nullptr;
}
if (m_iDesiredStatus == ID_STATUS_OFFLINE || error) {
@@ -85,11 +85,11 @@ void WhatsAppProto::stayConnectedLoop(void*) ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus);
ToggleStatusMenuItems(true);
- ForkThread(&WhatsAppProto::ProcessBuddyList, NULL);
+ ForkThread(&WhatsAppProto::ProcessBuddyList, nullptr);
// #TODO Move out of try block. Exception is expected on disconnect
while (true) {
- m_tLastWriteTime = time(NULL);
+ m_tLastWriteTime = time(nullptr);
if (!m_pConnection->read())
break;
}
@@ -114,13 +114,13 @@ void WhatsAppProto::stayConnectedLoop(void*) void WhatsAppProto::sentinelLoop(void*)
{
while (WaitForSingleObjectEx(update_loop_lock_, 1000, true) == WAIT_TIMEOUT) {
- if (m_iStatus != ID_STATUS_OFFLINE && m_pConnection != NULL && m_iDesiredStatus == m_iStatus) {
+ if (m_iStatus != ID_STATUS_OFFLINE && m_pConnection != nullptr && m_iDesiredStatus == m_iStatus) {
// #TODO Quiet after pong or tree read?
- int quietInterval = difftime(time(NULL), m_tLastWriteTime);
+ int quietInterval = difftime(time(nullptr), m_tLastWriteTime);
if (quietInterval >= MAX_SILENT_INTERVAL) {
try {
debugLogA("send ping");
- m_tLastWriteTime = time(NULL);
+ m_tLastWriteTime = time(nullptr);
m_pConnection->sendPing();
}
catch (exception &e) {
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index f35fc5c565..7674985311 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -8,7 +8,7 @@ MCONTACT WhatsAppProto::AddToContactList(const std::string &jid, const char *new // First, check if this contact exists
MCONTACT hContact = ContactIDToHContact(jid);
if (hContact) {
- if (new_name != NULL) {
+ if (new_name != nullptr) {
DBVARIANT dbv;
string oldName;
if (db_get_utf(hContact, m_szModuleName, WHATSAPP_KEY_NICK, &dbv))
@@ -44,7 +44,7 @@ MCONTACT WhatsAppProto::AddToContactList(const std::string &jid, const char *new db_set_b(hContact, "CList", "NotOnList", 1);
db_set_ws(hContact, "CList", "Group", m_tszDefaultGroup);
- if (new_name != NULL)
+ if (new_name != nullptr)
db_set_utf(hContact, m_szModuleName, WHATSAPP_KEY_NICK, new_name);
return hContact;
@@ -110,7 +110,7 @@ void WhatsAppProto::onAvailable(const std::string ¶mString, bool paramBoolea if (hContact != NULL) {
if (paramBoolean) {
setWord(hContact, "Status", ID_STATUS_ONLINE);
- setDword(hContact, WHATSAPP_KEY_LAST_SEEN, time(NULL));
+ setDword(hContact, WHATSAPP_KEY_LAST_SEEN, time(nullptr));
}
else {
setWord(hContact, "Status", ID_STATUS_OFFLINE);
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 39e5e2831f..1083463564 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -164,7 +164,7 @@ class CInviteDialog : public CProtoDlgBase<WhatsAppProto> void ResetListOptions(CCtrlClc *)
{
- m_clc.SetBkBitmap(0, NULL);
+ m_clc.SetBkBitmap(0, nullptr);
m_clc.SetBkColor(GetSysColor(COLOR_WINDOW));
m_clc.SetGreyoutFlags(0);
m_clc.SetLeftMargin(4);
diff --git a/protocols/WhatsApp/src/media.cpp b/protocols/WhatsApp/src/media.cpp index 9b3bb6f5ff..f2f1fb3afe 100644 --- a/protocols/WhatsApp/src/media.cpp +++ b/protocols/WhatsApp/src/media.cpp @@ -2,26 +2,26 @@ HANDLE WhatsAppProto::SendFile(MCONTACT hContact, const wchar_t* desc, wchar_t **ppszFiles) {
if (!isOnline())
- return 0;
+ return nullptr;
ptrA jid(getStringA(hContact, "ID"));
if (jid == NULL)
- return 0;
+ return nullptr;
// input validation
char *name = mir_utf8encodeW(ppszFiles[0]);
string mime = MediaUploader::getMimeFromExtension(split(name, '.')[1]);
if (mime.empty()) {
mir_free(name);
- return 0;
+ return nullptr;
}
// get file size
FILE *hFile = _wfopen(ppszFiles[0], L"rb");
- if (hFile == NULL) {
+ if (hFile == nullptr) {
debugLogA(__FUNCTION__": cannot open file %s", ppszFiles[0]);
mir_free(name);
- return 0;
+ return nullptr;
}
_fseeki64(hFile, 0, SEEK_END);
uint64_t fileSize = _ftelli64(hFile);
@@ -35,28 +35,28 @@ HANDLE WhatsAppProto::SendFile(MCONTACT hContact, const wchar_t* desc, wchar_t * case FMessage::WA_TYPE_IMAGE:
if (fileSize >= 5 * 1024 * 1024) {
mir_free(name);
- return 0;
+ return nullptr;
}
break;
case FMessage::WA_TYPE_AUDIO:
if (fileSize >= 10 * 1024 * 1024) {
mir_free(name);
- return 0;
+ return nullptr;
}
break;
case FMessage::WA_TYPE_VIDEO:
if (fileSize >= 20 * 1024 * 1024) {
mir_free(name);
- return 0;
+ return nullptr;
}
break;
default:
mir_free(name);
- return 0;
+ return nullptr;
}
int msgId = GetSerial();
- time_t now = time(NULL);
+ time_t now = time(nullptr);
std::string msgid = Utilities::intToStr(now) + "-" + Utilities::intToStr(msgId);
FMessage * fmsg = new FMessage(std::string(jid), true, msgid);
fmsg->media_url = name;
diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp index 98bea34363..0d1ebff87e 100644 --- a/protocols/WhatsApp/src/messages.cpp +++ b/protocols/WhatsApp/src/messages.cpp @@ -34,7 +34,7 @@ void WhatsAppProto::onMessageForMe(const FMessage &pMsg) if (getByte(WHATSAPP_KEY_USE_REMOTE_TIME, 0))
recv.timestamp = pMsg.timestamp;
else
- recv.timestamp = time(NULL);
+ recv.timestamp = time(nullptr);
ProtoChainRecvMsg(hContact, &recv);
}
@@ -49,21 +49,21 @@ int WhatsAppProto::SendMsg(MCONTACT hContact, int, const char *msg) if (jid == NULL)
return 0;
- if (m_pConnection == NULL) {
+ if (m_pConnection == nullptr) {
debugLogA("No connection");
return 0;
}
int msgId = GetSerial();
try {
- time_t now = time(NULL);
+ time_t now = time(nullptr);
std::string id = Utilities::intToStr(now) + "-" + Utilities::intToStr(msgId);
FMessage fmsg(std::string(jid), true, id);
fmsg.timestamp = now;
fmsg.data = msg;
m_pConnection->sendMessage(&fmsg);
- utils::setStatusMessage(hContact, NULL);
+ utils::setStatusMessage(hContact, nullptr);
}
catch (exception &e) {
debugLogA("exception: %s", e.what());
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index 3d19f7fe72..6b048b33a4 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -16,7 +16,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) : PROTO<WhatsAppProto>(proto_name, username),
m_tszDefaultGroup(getWStringA(WHATSAPP_KEY_DEF_GROUP))
{
- update_loop_lock_ = CreateEvent(NULL, false, false, NULL);
+ update_loop_lock_ = CreateEvent(nullptr, false, false, nullptr);
db_set_resident(m_szModuleName, "StatusMsg");
@@ -40,10 +40,10 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) nlu.szSettingsModule = m_szModuleName;
nlu.szDescriptiveName.w = descr;
m_hNetlibUser = Netlib_RegisterUser(&nlu);
- if (m_hNetlibUser == NULL) {
+ if (m_hNetlibUser == nullptr) {
wchar_t error[200];
mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
- MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
WASocketConnection::initNetwork(m_hNetlibUser);
@@ -136,7 +136,7 @@ int WhatsAppProto::SetStatus(int new_status) }
if (m_iDesiredStatus == ID_STATUS_OFFLINE) {
- if (m_pSocket != NULL) {
+ if (m_pSocket != nullptr) {
SetEvent(update_loop_lock_);
m_pSocket->forceShutdown();
debugLogA("Forced shutdown");
@@ -145,15 +145,15 @@ int WhatsAppProto::SetStatus(int new_status) m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
}
- else if (m_pSocket == NULL && !IsStatusConnecting(m_iStatus)) {
+ else if (m_pSocket == nullptr && !IsStatusConnecting(m_iStatus)) {
m_iStatus = ID_STATUS_CONNECTING;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
ResetEvent(update_loop_lock_);
- ForkThread(&WhatsAppProto::sentinelLoop, 0);
- ForkThread(&WhatsAppProto::stayConnectedLoop, 0);
+ ForkThread(&WhatsAppProto::sentinelLoop, nullptr);
+ ForkThread(&WhatsAppProto::stayConnectedLoop, nullptr);
}
- else if (m_pConnection != NULL) {
+ else if (m_pConnection != nullptr) {
if (m_iDesiredStatus == ID_STATUS_ONLINE) {
m_pConnection->sendAvailableForChat();
m_iStatus = ID_STATUS_ONLINE;
@@ -173,7 +173,7 @@ int WhatsAppProto::SetStatus(int new_status) MCONTACT WhatsAppProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
{
- if (psr->id.w == NULL)
+ if (psr->id.w == nullptr)
return NULL;
std::string phone(T2Utf(psr->id.w));
@@ -209,7 +209,7 @@ void WhatsAppProto::SearchAckThread(void *targ) HANDLE WhatsAppProto::SearchBasic(const wchar_t* id)
{
if (isOffline())
- return 0;
+ return nullptr;
// fake - we always accept search
SearchParam *param = new SearchParam(id, GetSerial());
@@ -231,7 +231,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number, string idx;
DBVARIANT dbv;
- if (g_hNetlibUser == NULL) {
+ if (g_hNetlibUser == nullptr) {
NotifyEvent(m_tszUserName, TranslateT("Network connection error."), NULL, WHATSAPP_EVENT_CLIENT);
return false;
}
@@ -243,7 +243,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number, if (idx.empty()) {
std::stringstream tm;
- tm << time(NULL);
+ tm << time(nullptr);
BYTE idxBuf[16];
utils::md5string(tm.str(), idxBuf);
idx = std::string((const char*)idxBuf, 16);
@@ -264,7 +264,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number, NETLIBHTTPREQUEST* pnlhr = Netlib_HttpTransaction(g_hNetlibUser, &nlhr);
const wchar_t *ptszTitle = TranslateT("Registration");
- if (pnlhr == NULL) {
+ if (pnlhr == nullptr) {
NotifyEvent(ptszTitle, TranslateT("Registration failed. Invalid server response."), NULL, WHATSAPP_EVENT_CLIENT);
return false;
}
@@ -430,9 +430,9 @@ void WhatsAppProto::NotifyEvent(const wchar_t *title, const wchar_t *info, MCONT }
if (FLAG_CONTAINS(flags, WHATSAPP_EVENT_CLIENT))
- MessageBox(NULL, info, title, MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, info, title, MB_OK | MB_ICONINFORMATION);
exit:
- if (szUrl != NULL)
+ if (szUrl != nullptr)
mir_free(szUrl);
}
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp index 70ba827608..e280a623ec 100644 --- a/protocols/WhatsApp/src/theme.cpp +++ b/protocols/WhatsApp/src/theme.cpp @@ -19,7 +19,7 @@ HANDLE GetIconHandle(const char* name) if (mir_strcmp(icons[i].szName, name) == 0)
return icons[i].hIcolib;
- return 0;
+ return nullptr;
}
char* GetIconDescription(const char* name)
@@ -36,13 +36,13 @@ static WhatsAppProto* GetInstanceByHContact(MCONTACT hContact) {
char *proto = GetContactProto(hContact);
if (!proto)
- return 0;
+ return nullptr;
for (int i = 0; i < g_Instances.getCount(); i++)
if (!mir_strcmp(proto, g_Instances[i].m_szModuleName))
return &g_Instances[i];
- return 0;
+ return nullptr;
}
void WhatsAppProto::InitMenu()
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp index 7ae1c8fcfa..d335133912 100644 --- a/protocols/WhatsApp/src/utils.cpp +++ b/protocols/WhatsApp/src/utils.cpp @@ -2,8 +2,8 @@ wchar_t* utils::removeA(wchar_t *str)
{
- if (str == NULL)
- return NULL;
+ if (str == nullptr)
+ return nullptr;
wchar_t *p = wcschr(str, '@');
if (p) *p = 0;
@@ -34,11 +34,11 @@ std::string getLastErrorMsg() FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
+ nullptr,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&lpMsgBuf,
- 0, NULL);
+ 0, nullptr);
std::string ret((LPSTR)lpMsgBuf);
LocalFree(lpMsgBuf);
|