diff options
Diffstat (limited to 'plugins/MirOTR/src')
-rw-r--r-- | plugins/MirOTR/src/dbfilter.cpp | 28 | ||||
-rw-r--r-- | plugins/MirOTR/src/dialogs.cpp | 26 | ||||
-rw-r--r-- | plugins/MirOTR/src/dllmain.cpp | 2 | ||||
-rw-r--r-- | plugins/MirOTR/src/entities.cpp | 6 | ||||
-rw-r--r-- | plugins/MirOTR/src/mirotrmenu.cpp | 16 | ||||
-rw-r--r-- | plugins/MirOTR/src/options.cpp | 18 | ||||
-rw-r--r-- | plugins/MirOTR/src/otr.cpp | 24 | ||||
-rw-r--r-- | plugins/MirOTR/src/striphtml.cpp | 4 | ||||
-rw-r--r-- | plugins/MirOTR/src/svcs_proto.cpp | 14 | ||||
-rw-r--r-- | plugins/MirOTR/src/svcs_srmm.cpp | 2 | ||||
-rw-r--r-- | plugins/MirOTR/src/utils.cpp | 34 |
11 files changed, 87 insertions, 87 deletions
diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index 0791b761e0..4c6108f6d0 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -14,16 +14,16 @@ struct DeleteEventHead { DeleteEventNode *first; DeleteEventNode *last; }; -static DeleteEventHead DeleteEvents = {0,0}; +static DeleteEventHead DeleteEvents = {nullptr,nullptr}; void CALLBACK DeleteTimerProc(HWND, UINT, UINT_PTR, DWORD) { if (!DeleteEvents.first) return; mir_cslock lck(RemoveChainCS); - DeleteEventNode *prev =0, *current, *next; + DeleteEventNode *prev =nullptr, *current, *next; DBEVENTINFO info = {}; next = DeleteEvents.first; while (current = next) { - if (difftime(time(0), current->timestamp) < 1) break; + if (difftime(time(nullptr), current->timestamp) < 1) break; if (!db_event_get(current->hDbEvent, &info)) // && info.flags&DBEF_READ) { db_event_delete(current->hContact, current->hDbEvent); @@ -37,7 +37,7 @@ void CALLBACK DeleteTimerProc(HWND, UINT, UINT_PTR, DWORD) { next = current->next; } } - if (!DeleteEvents.first) DeleteEvents.last = 0; + if (!DeleteEvents.first) DeleteEvents.last = nullptr; } @@ -51,7 +51,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) if ((dbei->eventType != EVENTTYPE_MESSAGE) || !(dbei->flags & DBEF_SENT) || (dbei->flags & DBEF_OTR_PREFIXED)) return 0; - if (dbei->cbBlob == 0 || dbei->pBlob == 0) + if (dbei->cbBlob == 0 || dbei->pBlob == nullptr) return 0; // just to be safe const char *proto = GetContactProto(hContact); @@ -133,8 +133,8 @@ int OnDatabaseEventAdded(WPARAM hContact, LPARAM lParam) DeleteEventNode *node = new DeleteEventNode(); node->hContact = hContact; node->hDbEvent = lParam; - node->timestamp = time(0); - node->next = 0; + node->timestamp = time(nullptr); + node->next = nullptr; mir_cslock lck(RemoveChainCS); if (DeleteEvents.last) DeleteEvents.last->next = node; @@ -201,7 +201,7 @@ int StatusModeChange(WPARAM wParam, LPARAM lParam) ConnContext *context = otr_user_state->context_root; while (context) { - if (context->msgstate == OTRL_MSGSTATE_ENCRYPTED && (proto == 0 || mir_strcmp(proto, context->protocol) == 0)) { + if (context->msgstate == OTRL_MSGSTATE_ENCRYPTED && (proto == nullptr || mir_strcmp(proto, context->protocol) == 0)) { MCONTACT hContact = (UINT_PTR)context->app_data; if (hContact) { @@ -257,17 +257,17 @@ void InitDBFilter() hDBEventPreAdd = HookEvent(ME_DB_EVENT_FILTER_ADD, OnDatabaseEventPreAdd); hDBEventAdded = HookEvent(ME_DB_EVENT_ADDED, OnDatabaseEventAdded); hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged); - timerId = SetTimer(0, 0, 1000, DeleteTimerProc); + timerId = SetTimer(nullptr, 0, 1000, DeleteTimerProc); } void DeinitDBFilter() { UnhookEvent(hDBEventPreAdd); - hDBEventPreAdd = 0; + hDBEventPreAdd = nullptr; UnhookEvent(hDBEventAdded); - hDBEventAdded = 0; + hDBEventAdded = nullptr; UnhookEvent(hContactSettingChanged); - hContactSettingChanged = 0; - if (timerId) KillTimer(0, timerId); - DeleteTimerProc(0, 0, 0, 0); + hContactSettingChanged = nullptr; + if (timerId) KillTimer(nullptr, timerId); + DeleteTimerProc(nullptr, 0, 0, 0); } diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp index 98d0d5edef..7bd50fefbd 100644 --- a/plugins/MirOTR/src/dialogs.cpp +++ b/plugins/MirOTR/src/dialogs.cpp @@ -52,7 +52,7 @@ static INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, // Move window to screen center // Get the owner window and dialog box rectangles. HWND hwndOwner; RECT rcOwner, rcDlg, rc; - if ((hwndOwner = GetParent(hwndDlg)) == NULL) { + if ((hwndOwner = GetParent(hwndDlg)) == nullptr) { hwndOwner = GetDesktopWindow(); } @@ -153,7 +153,7 @@ static void SMPInitUpdateDialog(ConnContext *context, bool responder) data->context = context; data->oldlevel = otr_context_get_trust(context); data->responder = responder; - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_PROGRESS), 0, DlgSMPUpdateProc, (LPARAM)data); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_PROGRESS), nullptr, DlgSMPUpdateProc, (LPARAM)data); } static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -233,7 +233,7 @@ static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam // Move window to screen center // Get the owner window and dialog box rectangles. HWND hwndOwner = GetParent(hwndDlg); - if (hwndOwner == NULL) + if (hwndOwner == nullptr) hwndOwner = GetDesktopWindow(); RECT rcOwner, rcDlg, rc; @@ -336,7 +336,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam // Move window to screen center // Get the owner window and dialog box rectangles. HWND hwndOwner = GetParent(hwndDlg); - if (hwndOwner == NULL) + if (hwndOwner == nullptr) hwndOwner = GetDesktopWindow(); RECT rcOwner, rcDlg, rc; @@ -452,7 +452,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam delete[] answer; SMPInitUpdateDialog(context, false); - otr_start_smp(context, NULL, (const unsigned char*)ans, mir_strlen(ans)); + otr_start_smp(context, nullptr, (const unsigned char*)ans, mir_strlen(ans)); } } @@ -570,7 +570,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam void SMPInitDialog(ConnContext *context) { if (context) - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgProcSMPInitProc, (LPARAM)context); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgProcSMPInitProc, (LPARAM)context); } void SMPDialogUpdate(ConnContext *context, int percent) @@ -608,8 +608,8 @@ void SMPDialogReply(ConnContext *context, const char* question) data->context = context; data->oldlevel = TRUST_NOT_PRIVATE; data->responder = true; - data->question = (question) ? mir_utf8decodeW(question) : NULL; - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgSMPResponseProc, (LPARAM)data); + data->question = (question) ? mir_utf8decodeW(question) : nullptr; + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgSMPResponseProc, (LPARAM)data); /* ShowError(L"SMP requires user password (NOT IMPL YET)"); otr_abort_smp(context); @@ -634,7 +634,7 @@ static INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM w // Move window to screen center // Get the owner window and dialog box rectangles. HWND hwndOwner = GetParent(hwndDlg); - if (hwndOwner == NULL) + if (hwndOwner == nullptr) hwndOwner = GetDesktopWindow(); RECT rcOwner, rcDlg, rc; @@ -723,13 +723,13 @@ static INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM w static unsigned int CALLBACK verify_context_thread(void *param) { - Thread_Push(0); + Thread_Push(nullptr); if (param) { ConnContext *context = (ConnContext *)param; MCONTACT hContact = (UINT_PTR)context->app_data; wchar_t msg[1024]; - switch (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgBoxProcVerifyContext, (LPARAM)param)) { + switch (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgBoxProcVerifyContext, (LPARAM)param)) { case IDOK: case IDYES: lib_cs_lock(); @@ -742,7 +742,7 @@ static unsigned int CALLBACK verify_context_thread(void *param) case IDNO: lib_cs_lock(); - otrl_context_set_trust(context->active_fingerprint, NULL); + otrl_context_set_trust(context->active_fingerprint, nullptr); otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); mir_snwprintf(msg, TranslateW(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact)); ShowMessage(hContact, msg); @@ -758,5 +758,5 @@ static unsigned int CALLBACK verify_context_thread(void *param) void VerifyContextDialog(ConnContext* context) { if (!context) return; - CloseHandle((HANDLE)_beginthreadex(0, 0, verify_context_thread, context, 0, 0)); + CloseHandle((HANDLE)_beginthreadex(nullptr, 0, verify_context_thread, context, 0, nullptr)); } diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp index 1de567c0cb..936bca86c9 100644 --- a/plugins/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/src/dllmain.cpp @@ -51,7 +51,7 @@ int ModulesLoaded(WPARAM, LPARAM) db_set_b(0, MODULENAME, "sim_warned", 1);
options.default_policy = OTRL_POLICY_MANUAL_MOD;
SaveOptions();
- MessageBox(0, TranslateW(LANG_OTR_SECUREIM_TEXT), TranslateW(LANG_OTR_SECUREIM_TITLE), 0x30);
+ MessageBox(nullptr, TranslateW(LANG_OTR_SECUREIM_TEXT), TranslateW(LANG_OTR_SECUREIM_TITLE), 0x30);
}
return 0;
}
diff --git a/plugins/MirOTR/src/entities.cpp b/plugins/MirOTR/src/entities.cpp index f049ad0b88..62b0865b73 100644 --- a/plugins/MirOTR/src/entities.cpp +++ b/plugins/MirOTR/src/entities.cpp @@ -277,7 +277,7 @@ static const char *get_named_entity(const char *name) sizeof(named_entities) / sizeof(*named_entities), sizeof(*named_entities), cmp); - return entity ? entity[1] : NULL; + return entity ? entity[1] : nullptr; } static size_t putc_utf8(unsigned long cp, char *buffer) @@ -325,7 +325,7 @@ static bool parse_entity(const char *current, char **to, if(current[1] == '#') { - char *tail = NULL; + char *tail = nullptr; errno = 0; bool hex = current[2] == 'x' || current[2] == 'X'; @@ -395,7 +395,7 @@ char* encode_html_entities_utf8(const char *src) { const char *pos = strpbrk(src, "&<>\"\r"); if (!pos) - return NULL; + return nullptr; const char *start = src; std::string buf; diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index 4babd970d7..21ae10a7f9 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -41,11 +41,11 @@ INT_PTR MirOTRMenuExecService(WPARAM wParam, LPARAM lParam) INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) { TCheckProcParam *pcpp = (TCheckProcParam*)wParam; - if (pcpp == NULL) + if (pcpp == nullptr) return FALSE; lpMirOTRMenuExecParam cmep = (lpMirOTRMenuExecParam)pcpp->MenuItemOwnerData; - if (cmep == NULL) //this is rootsection...build it + if (cmep == nullptr) //this is rootsection...build it return TRUE; MCONTACT hContact = (MCONTACT)pcpp->wParam, hSub; @@ -94,7 +94,7 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) INT_PTR FreeOwnerDataMirOTRMenu(WPARAM, LPARAM lParam) { lpMirOTRMenuExecParam cmep = (lpMirOTRMenuExecParam)lParam; - if (cmep != NULL) { + if (cmep != nullptr) { if (cmep->szServiceName) mir_free(cmep->szServiceName); mir_free(cmep); } @@ -141,7 +141,7 @@ void ShowOTRMenu(MCONTACT hContact, POINT pt) SetWindowLongPtr(hDummyPaintWin, GWLP_USERDATA, (LONG_PTR)hContact); - TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hDummyPaintWin, 0); + TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hDummyPaintWin, nullptr); DestroyMenu(hMenu); } @@ -152,7 +152,7 @@ void InitMirOTRMenu(void) wc.lpfnWndProc = PopupMenuWndProc; wc.lpszClassName = L"MirOTRPopupMenuProcessor"; RegisterClass(&wc); - hDummyPaintWin = CreateWindowEx(0, L"MirOTRPopupMenuProcessor", NULL, 0, 0, 0, 1, 1, 0, 0, hInst, 0); + hDummyPaintWin = CreateWindowEx(0, L"MirOTRPopupMenuProcessor", nullptr, 0, 0, 0, 1, 1, nullptr, nullptr, hInst, nullptr); CreateServiceFunction("MirOTRMenuExecService", MirOTRMenuExecService); CreateServiceFunction("MirOTRMenuCheckService", MirOTRMenuCheckService); @@ -170,7 +170,7 @@ void InitMirOTRMenu(void) mi.flags = CMIF_DISABLED | CMIF_UNICODE; mi.name.w = LPGENW("OTR Status"); mi.position = 0; - hStatusInfoItem = AddMirOTRMenuItem(&mi, NULL); + hStatusInfoItem = AddMirOTRMenuItem(&mi, nullptr); mi.flags = CMIF_UNICODE | CMIF_NOTPRIVATE | CMIF_NOTUNVERIFIED; mi.name.w = LANG_MENU_START; @@ -199,14 +199,14 @@ void InitMirOTRMenu(void) mi.flags = CMIF_UNICODE | CMIF_CHECKED; mi.name.w = LANG_MENU_TOGGLEHTML; mi.position = 300001; - mi.hIcolibItem = 0; + mi.hIcolibItem = nullptr; hHTMLConvMenuItem = AddMirOTRMenuItem(&mi, MS_OTR_MENUTOGGLEHTML); } void UninitMirOTRMenu(void) { DestroyWindow(hDummyPaintWin); - hDummyPaintWin = 0; + hDummyPaintWin = nullptr; UnregisterClass(L"MirOTRPopupMenuProcessor", hInst); diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index 09d8a7f64a..33b1ee0d35 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -122,7 +122,7 @@ void ReadPrivkeyFiles() DEBUGOUTA("READ privkey"); lib_cs_lock(); otrl_privkey_read(otr_user_state, _T2A(g_private_key_filename)); - otrl_privkey_read_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename), set_context_contact, 0); + otrl_privkey_read_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename), set_context_contact, nullptr); otrl_instag_read(otr_user_state, _T2A(g_instag_filename)); } @@ -233,7 +233,7 @@ static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, static unsigned int CALLBACK regen_key_thread(void* param) { - Thread_Push(0); + Thread_Push(nullptr); PROTOREGENKEYOPTIONS *opts = (PROTOREGENKEYOPTIONS *)param; wchar_t buff[512]; @@ -241,7 +241,7 @@ static unsigned int CALLBACK regen_key_thread(void* param) EnableWindow(opts->refresh, FALSE); if (IDYES == MessageBox(opts->refresh, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION|MB_YESNO)) { char* proto = mir_u2a(opts->proto); - otr_gui_create_privkey(0, proto, proto); + otr_gui_create_privkey(nullptr, proto, proto); mir_free(proto); SendMessage(opts->refresh, WMU_REFRESHPROTOLIST, 0, 0); } @@ -256,7 +256,7 @@ static char* GetProtoName(HWND lv, int iItem) LV_ITEM item; item.iItem = iItem; item.mask = LVIF_PARAM; - return (ListView_GetItem(lv, &item) == -1) ? NULL : (char*)item.lParam; + return (ListView_GetItem(lv, &item) == -1) ? nullptr : (char*)item.lParam; } static void ChangeContactSetting(HWND hwndDlg, int iItem, bool changeHtml) @@ -401,7 +401,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP PROTOREGENKEYOPTIONS *opts = new PROTOREGENKEYOPTIONS(); opts->refresh = hwndDlg; ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, opts->proto, _countof(opts->proto)); - CloseHandle((HANDLE)_beginthreadex(0, 0, regen_key_thread, opts, 0, 0)); + CloseHandle((HANDLE)_beginthreadex(nullptr, 0, regen_key_thread, opts, 0, nullptr)); } break; @@ -414,7 +414,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP mir_snwprintf(buff, TranslateW(LANG_OTR_ASK_REMOVEKEY), buff_proto); if (IDYES == MessageBox(hwndDlg, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION | MB_YESNO)) { char *proto = GetProtoName(lv, sel); - if (proto == NULL) + if (proto == nullptr) break; OtrlPrivKey *key = otrl_privkey_find(otr_user_state, proto, proto); @@ -473,7 +473,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP wchar_t policy[64]; for (int i = 0; i < cnt; ++i) { char *proto = GetProtoName(lv, i); - if (proto == NULL) + if (proto == nullptr) continue; ListView_GetItemText(lv, i, 1, policy, _countof(policy)); @@ -800,7 +800,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w break; case FPM_NOTRUST: - otrl_context_set_trust(it->first, NULL); + otrl_context_set_trust(it->first, nullptr); if (it->first == it->first->context->active_fingerprint) VerifyFingerprint(it->first->context, false); break; @@ -808,7 +808,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w } if (!fpm->empty()) - otr_gui_write_fingerprints(0); + otr_gui_write_fingerprints(nullptr); fpm->clear(); SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0); return TRUE; diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp index ccc723812a..5350bca1bb 100644 --- a/plugins/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/src/otr.cpp @@ -17,17 +17,17 @@ OtrlMessageAppOps ops = { max_message_size,//max_message_size account_name,//account_name account_name_free,//account_name_free - NULL,//received_symkey (optional) - NULL,//otr_error_message (optional, send to remote party so we could send them errors in a language they know) - NULL,//otr_error_message_free (optional) + nullptr,//received_symkey (optional) + nullptr,//otr_error_message (optional, send to remote party so we could send them errors in a language they know) + nullptr,//otr_error_message_free (optional) resent_msg_prefix,//resent_msg_prefix (optional) resent_msg_prefix_free,//resent_msg_prefix_free (optional) handle_smp_event,//handle_smp_event (optional) handle_msg_event,//handle_msg_event (optional) otr_create_instag,//create_instag (optional) - NULL,//convert_msg (optional) - NULL,//convert_free (optional) - NULL,//timer_control (optional) // @todo : implement security timers + nullptr,//convert_msg (optional) + nullptr,//convert_free (optional) + nullptr,//timer_control (optional) // @todo : implement security timers }; struct GenKeyData{ @@ -37,7 +37,7 @@ struct GenKeyData{ static unsigned int CALLBACK generate_key_thread(void* param) { - Thread_Push(0); + Thread_Push(nullptr); GenKeyData *data = (GenKeyData *)param; otrl_privkey_generate(otr_user_state, _T2A(g_private_key_filename), data->proto, data->proto); PostMessage(data->dialog, WMU_ENDDIALOG, 0, 0); @@ -64,7 +64,7 @@ INT_PTR CALLBACK GenKeyDlgBoxProc(HWND hWndDlg, UINT msg, WPARAM, LPARAM lParam) GenKeyData *data = (GenKeyData *)mir_calloc(sizeof(GenKeyData)); data->dialog = hWndDlg; data->proto = (char*)lParam; - CloseHandle((HANDLE)_beginthreadex(0, 0, generate_key_thread, data, 0, 0)); + CloseHandle((HANDLE)_beginthreadex(nullptr, 0, generate_key_thread, data, 0, nullptr)); }break; case WMU_ENDDIALOG: EndDialog(hWndDlg, 0); @@ -108,7 +108,7 @@ extern "C" { protocol = GetContactProto((UINT_PTR)opdata); } if (!protocol) return; - DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), 0, GenKeyDlgBoxProc, (LPARAM)protocol); + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), nullptr, GenKeyDlgBoxProc, (LPARAM)protocol); } @@ -152,12 +152,12 @@ extern "C" { /* A new fingerprint for the given user has been received. */ void otr_gui_new_fingerprint(void *opdata, OtrlUserState us, const char *accountname, const char *protocol, const char *username, unsigned char fingerprint[20]) { DEBUGOUTA("OTR_GUI_NEW_FINGERPRINT\n"); - ConnContext *context = otrl_context_find(us, username, accountname, protocol, OTRL_INSTAG_BEST, TRUE, 0, add_appdata, opdata); - Fingerprint *fp = otrl_context_find_fingerprint(context, fingerprint, TRUE, 0); + ConnContext *context = otrl_context_find(us, username, accountname, protocol, OTRL_INSTAG_BEST, TRUE, nullptr, add_appdata, opdata); + Fingerprint *fp = otrl_context_find_fingerprint(context, fingerprint, TRUE, nullptr); //CloseHandle((HANDLE)_beginthreadex(0, 0, trust_fp_thread, (void *)fp, 0, 0)); - otrl_context_set_trust(fp, NULL); + otrl_context_set_trust(fp, nullptr); otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); } diff --git a/plugins/MirOTR/src/striphtml.cpp b/plugins/MirOTR/src/striphtml.cpp index a7d84b69c4..1401ac9a02 100644 --- a/plugins/MirOTR/src/striphtml.cpp +++ b/plugins/MirOTR/src/striphtml.cpp @@ -102,8 +102,8 @@ char * striphtml(char *html) { ekhtml_parser_t *parser = ekhtml_parser_new(&data);
ekhtml_parser_datacb_set(parser, &data_cb);
- ekhtml_parser_startcb_add(parser, NULL, &starttag_cb);
- ekhtml_parser_endcb_add(parser, NULL, &endtag_cb);
+ ekhtml_parser_startcb_add(parser, nullptr, &starttag_cb);
+ ekhtml_parser_endcb_add(parser, nullptr, &endtag_cb);
ekhtml_parser_feed(parser, &ekstring);
ekhtml_parser_flush(parser, 1);
diff --git a/plugins/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/src/svcs_proto.cpp index 4dd0ca4f59..147d79b1e7 100644 --- a/plugins/MirOTR/src/svcs_proto.cpp +++ b/plugins/MirOTR/src/svcs_proto.cpp @@ -38,9 +38,9 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ oldmessage = tmpencode; } - char *newmessage = NULL; + char *newmessage = nullptr; char *username = contact_get_id(ccs->hContact); - gcry_error_t err = otrl_message_sending(otr_user_state, &ops, (void*)ccs->hContact, proto, proto, username, OTRL_INSTAG_BEST, oldmessage, NULL, &newmessage, OTRL_FRAGMENT_SEND_ALL_BUT_LAST, NULL, add_appdata, (void*)ccs->hContact); + gcry_error_t err = otrl_message_sending(otr_user_state, &ops, (void*)ccs->hContact, proto, proto, username, OTRL_INSTAG_BEST, oldmessage, nullptr, &newmessage, OTRL_FRAGMENT_SEND_ALL_BUT_LAST, nullptr, add_appdata, (void*)ccs->hContact); mir_free(username); if (err) { /* Be *sure* not to send out plaintext */ @@ -50,7 +50,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ return 1; } - if (newmessage == NULL) + if (newmessage == nullptr) return Proto_ChainSend(wParam, ccs); if(!newmessage[0]){ @@ -96,10 +96,10 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam) if (!oldmessage) return 1; - ConnContext* context=NULL; + ConnContext* context=nullptr; char *uname = contact_get_id(ccs->hContact); - char *newmessage = NULL; - OtrlTLV *tlvs = NULL; + char *newmessage = nullptr; + OtrlTLV *tlvs = nullptr; lib_cs_lock(); int ignore_msg = otrl_message_receiving(otr_user_state, &ops, (void*)ccs->hContact, @@ -122,7 +122,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam) otrl_message_free(newmessage); return 1; // discard internal protocol messages } - if (newmessage == NULL) + if (newmessage == nullptr) return Proto_ChainRecv(wParam, ccs); DWORD oldflags = pre->flags; diff --git a/plugins/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/src/svcs_srmm.cpp index f0d23e5357..66e34d6aaf 100644 --- a/plugins/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/src/svcs_srmm.cpp @@ -149,7 +149,7 @@ void DeinitSRMM() IcoLib_Release(ICON_FINISHED, 0); IcoLib_Release(ICON_PRIVATE, 0); IcoLib_Release(ICON_UNVERIFIED, 0); - hIconNotSecure = hIconFinished = hIconPrivate = hIconUnverified =0; + hIconNotSecure = hIconFinished = hIconPrivate = hIconUnverified =nullptr; UninitMirOTRMenu(); } diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index 26b4f82bdf..00d34f226c 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -33,7 +33,7 @@ ConnContext * otrl_context_find_miranda(OtrlUserState us, MCONTACT hContact) { const char *proto = GetContactProto(hContact); char *username = contact_get_id(hContact); - ConnContext* ret = otrl_context_find(us, username, proto, proto, OTRL_INSTAG_BEST, 0, NULL, NULL, NULL); + ConnContext* ret = otrl_context_find(us, username, proto, proto, OTRL_INSTAG_BEST, 0, nullptr, nullptr, nullptr); mir_free(username); return ret; } @@ -58,7 +58,7 @@ TrustLevel otr_context_get_trust(ConnContext *context) /* Set verification of fingerprint */ void VerifyFingerprint(ConnContext *context, bool verify) { lib_cs_lock(); - otrl_context_set_trust(context->active_fingerprint, (verify)?"verified":NULL); + otrl_context_set_trust(context->active_fingerprint, (verify)?"verified":nullptr); otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); VerifyFingerprintMessage(context, verify); } @@ -106,7 +106,7 @@ __inline const wchar_t* contact_get_nameT(MCONTACT hContact) { wchar_t* ProtoGetNickname(const char* proto) { wchar_t *p = Contact_GetInfo(CNF_NICK, NULL, proto); - return (p != NULL) ? p : mir_wstrdup(L""); + return (p != nullptr) ? p : mir_wstrdup(L""); } void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MCONTACT hContact) { @@ -120,12 +120,12 @@ void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MC int size = int(mir_wstrlen(line1) + mir_wstrlen(line2) + 3); wchar_t *message = new wchar_t[size]; // newline and null terminator mir_snwprintf(message, size, L"%s\r\n%s", line1, line2); - MessageBox( NULL, message, title, MB_OK | MB_ICONINFORMATION ); + MessageBox( nullptr, message, title, MB_OK | MB_ICONINFORMATION ); delete[] message; } else if(line1) { - MessageBox( NULL, line1, title, MB_OK | MB_ICONINFORMATION ); + MessageBox( nullptr, line1, title, MB_OK | MB_ICONINFORMATION ); } else if(line2) { - MessageBox( NULL, line2, title, MB_OK | MB_ICONINFORMATION ); + MessageBox( nullptr, line2, title, MB_OK | MB_ICONINFORMATION ); } return; } @@ -134,7 +134,7 @@ void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MC //memset((void *)&ppd, 0, sizeof(POPUPDATAT)); ppd.lchContact = hContact; - ppd.lchIcon = NULL; + ppd.lchIcon = nullptr; if(line1 && line2) { wcsncpy( ppd.lptzContactName, line1, MAX_CONTACTNAME-1 ); @@ -146,8 +146,8 @@ void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MC ppd.iSeconds = timeout; - ppd.PluginWindowProc = NULL; - ppd.PluginData = NULL; + ppd.PluginWindowProc = nullptr; + ppd.PluginData = nullptr; PUAddPopupT(&ppd); @@ -174,7 +174,7 @@ void ShowWarning(wchar_t *msg) { } break; case ED_MB: - MessageBox(0, msg, buffer, MB_OK | MB_ICONWARNING); + MessageBox(nullptr, msg, buffer, MB_OK | MB_ICONWARNING); break; case ED_BAL: Clist_TrayNotifyW(MODULENAME, buffer, msg, NIIF_WARNING, 10000); @@ -204,7 +204,7 @@ void ShowError(wchar_t *msg) { } break; case ED_MB: - MessageBox(0, msg, buffer, MB_OK | MB_ICONERROR); + MessageBox(nullptr, msg, buffer, MB_OK | MB_ICONERROR); break; case ED_BAL: Clist_TrayNotifyW(MODULENAME, buffer, msg, NIIF_ERROR, 10000); @@ -214,20 +214,20 @@ void ShowError(wchar_t *msg) { void ShowPopupUtf(const char* line1, const char* line2, int timeout, const MCONTACT hContact) { - wchar_t* l1 = (line1) ? mir_utf8decodeW(line1) : NULL; - wchar_t* l2 = (line2) ? mir_utf8decodeW(line2) : NULL; + wchar_t* l1 = (line1) ? mir_utf8decodeW(line1) : nullptr; + wchar_t* l2 = (line2) ? mir_utf8decodeW(line2) : nullptr; ShowPopup(l1, l2, timeout, hContact); if (l1) mir_free(l1); if (l2) mir_free(l2); } void ShowWarningUtf(char* msg) { - wchar_t* m = (msg) ? mir_utf8decodeW(msg) : NULL; + wchar_t* m = (msg) ? mir_utf8decodeW(msg) : nullptr; ShowWarning(m); if (m) mir_free(m); } void ShowErrorUtf(char* msg) { - wchar_t* m = (msg) ? mir_utf8decodeW(msg) : NULL; + wchar_t* m = (msg) ? mir_utf8decodeW(msg) : nullptr; ShowError(m); if (m) mir_free(m); } @@ -238,7 +238,7 @@ void ShowMessageInline(const MCONTACT hContact, const wchar_t *msg) { T2Utf utf(buff); PROTORECVEVENT pre = {0}; - pre.timestamp = time(0); + pre.timestamp = time(nullptr); pre.szMessage = utf; pre.flags = PREF_BYPASS_OTR; ProtoChainRecvMsg(hContact, &pre); @@ -249,7 +249,7 @@ void ShowMessageInlineUtf(const MCONTACT hContact, const char *msg) { mir_snprintf(buff, "%s%s", LANG_INLINE_PREFIX, msg); PROTORECVEVENT pre = {0}; - pre.timestamp = time(0); + pre.timestamp = time(nullptr); pre.szMessage = buff; pre.flags = PREF_BYPASS_OTR; ProtoChainRecvMsg(hContact, &pre); |