diff options
Diffstat (limited to 'protocols/MSN/src')
27 files changed, 513 insertions, 513 deletions
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;
}
|