diff options
54 files changed, 160 insertions, 209 deletions
diff --git a/include/m_database.h b/include/m_database.h index 55e24ff97e..3533980641 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -83,13 +83,19 @@ EXTERN_C MIR_CORE_DLL(int) db_delete_module(MCONTACT hContact, const char *szMod EXTERN_C MIR_CORE_DLL(MCONTACT) db_add_contact(void);
// Deletes the contact hContact from the database and all events and settings associated with it.
+// The 'flags' parameter could be zero of any combination of CDF_* constants
// Returns 0 on success or nonzero if hContact was invalid
// Please don't try to delete the user contact (hContact = NULL)
// Triggers a db/contact/deleted event just *before* it removes anything
// Because all events are deleted, lots of people may end up with invalid event
// handles from this operation, which they should be prepared for.
-EXTERN_C MIR_CORE_DLL(int) db_delete_contact(MCONTACT hContact, bool bFromProto = false);
+#define CDF_FROM_SERVER 0x01 // delete operation requested from the server
+#define CDF_DEL_CONTACT 0x02 // delete server contact
+#define CDF_DEL_HISTORY 0x04 // delete server history (by default for me only)
+#define CDF_FOR_EVERYONE 0x08 // delete server history for everyone, not just for you
+
+EXTERN_C MIR_CORE_DLL(int) db_delete_contact(MCONTACT hContact, uint32_t flags = 0);
// Checks if a given value is a valid contact handle, note that due
// to the nature of multiple threading, a valid contact can still become
diff --git a/include/m_protoint.h b/include/m_protoint.h index 09f31ef992..a3df748937 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -259,8 +259,9 @@ public: virtual void OnContactAdded(MCONTACT);
// called when an account's contact is deleted
+ // flags is a combination of CDF_* constants
// returns true if deletion confirmed or false if not
- virtual bool OnContactDeleted(MCONTACT);
+ virtual bool OnContactDeleted(MCONTACT, uint32_t flags);
// called when the Account Manager needs to draw short account's options
virtual MWindow OnCreateAccMgrUI(MWindow hwndParent);
diff --git a/include/m_protosvc.h b/include/m_protosvc.h index 01eae97a2c..763534a509 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -127,6 +127,7 @@ static __inline unsigned long Proto_Status2Flag(int status) #define PFLAGNUM_4 4
#define PF4_FORCEAUTH 0x00000001 // forces auth requests to be sent when adding users
+#define PF4_DELETEFORALL 0x00000002 // events could be removed for everyone in the chat
#define PF4_NOCUSTOMAUTH 0x00000004 // protocol doesn't support custom auth text (doesn't show auth text box)
#define PF4_SUPPORTTYPING 0x00000008 // protocol supports user is typing messages
#define PF4_SUPPORTIDLE 0x00000010 // protocol understands idle
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 2289b8521d..44b1917175 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 1e742b6513..2054a5d1c6 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp b/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp index 989ae7bd37..f4558d2d17 100644 --- a/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp +++ b/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp @@ -912,7 +912,7 @@ bool CCurrencyRatesProviderBase::WatchForRate(const TRateInfo &ri, bool bWatch) } } else if (!bWatch && hContact) { - db_delete_contact(hContact, true); + db_delete_contact(hContact, CDF_FROM_SERVER); return true; } diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 48b496db7d..e2f0658819 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -626,7 +626,7 @@ int CDiscordProto::OnAccountChanged(WPARAM iAction, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-bool CDiscordProto::OnContactDeleted(MCONTACT hContact)
+bool CDiscordProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
CDiscordUser *pUser = FindUser(getId(hContact, DB_KEY_ID));
if (pUser == nullptr || !m_bOnline)
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index bb99d2efbc..1bc7c04444 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -444,7 +444,7 @@ public: int SetStatus(int iNewStatus) override;
void OnBuildProtoMenu() override;
- bool OnContactDeleted(MCONTACT) override;
+ bool OnContactDeleted(MCONTACT, uint32_t flags) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 3e39833635..e7ed33b01b 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1193,7 +1193,7 @@ void GaduProto::broadcastnewstatus(int newStatus) ////////////////////////////////////////////////////////////
// When contact is deleted
-bool GaduProto::OnContactDeleted(MCONTACT hContact)
+bool GaduProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index f7387f789c..c02dc9a0cb 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -56,7 +56,7 @@ struct GaduProto : public PROTO<GaduProto> int UserIsTyping(MCONTACT hContact, int type) override;
void OnBuildProtoMenu(void) override;
- bool OnContactDeleted(MCONTACT) override;
+ bool OnContactDeleted(MCONTACT, uint32_t flags) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnModulesLoaded() override;
void OnShutdown() override;
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index cb2ca4684a..08a18cbe1e 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -126,7 +126,7 @@ int GaduProto::gc_event(WPARAM, LPARAM lParam) list_remove(&chats, chat, 1);
// Remove contact from contact list (duh!) should be done by chat.dll !!
- db_delete_contact(gch->si->hContact, true);
+ db_delete_contact(gch->si->hContact, CDF_FROM_SERVER);
return 1;
}
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 392e9b0d66..b5e9ae144f 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -376,7 +376,7 @@ INT_PTR GaduProto::getmyawaymsg(WPARAM wParam, LPARAM lParam) INT_PTR GaduProto::leavechat(WPARAM hContact, LPARAM)
{
if (hContact)
- db_delete_contact(hContact, true);
+ db_delete_contact(hContact, CDF_FROM_SERVER);
return 0;
}
diff --git a/protocols/GmailNotifier/src/options.cpp b/protocols/GmailNotifier/src/options.cpp index 14d44e609e..4283f646f6 100644 --- a/protocols/GmailNotifier/src/options.cpp +++ b/protocols/GmailNotifier/src/options.cpp @@ -202,7 +202,7 @@ public: Account &acc = g_accs[curIndex]; DeleteResults(acc.results.next); - db_delete_contact(acc.hContact, true); + db_delete_contact(acc.hContact, CDF_FROM_SERVER); g_accs.remove(curIndex); m_combo.SetCurSel(curIndex = 0); diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index de01c7ebfa..e4048a7211 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -157,7 +157,7 @@ void CIcqProto::OnContactAdded(MCONTACT hContact) }
}
-bool CIcqProto::OnContactDeleted(MCONTACT hContact)
+bool CIcqProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
CMStringW szId(GetUserId(hContact));
if (!isChatRoom(hContact)) {
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index 027747b562..d5d1720d85 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -441,7 +441,7 @@ class CIcqProto : public PROTO<CIcqProto> void OnBuildProtoMenu(void) override;
void OnContactAdded(MCONTACT) override;
- bool OnContactDeleted(MCONTACT) override;
+ bool OnContactDeleted(MCONTACT, uint32_t flags) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnEventDeleted(MCONTACT, MEVENT) override;
void OnEventEdited(MCONTACT, MEVENT, const DBEVENTINFO &dbei) override;
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index b67df41639..ae12f8de57 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -335,7 +335,7 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact, boo pUser->m_bInList = true;
}
else if (bIgnored) {
- db_delete_contact(hContact, true);
+ db_delete_contact(hContact, CDF_FROM_SERVER);
return INVALID_CONTACT_ID;
}
diff --git a/protocols/IRCG/src/ircproto.h b/protocols/IRCG/src/ircproto.h index bcaad1cf56..eaec1fd525 100644 --- a/protocols/IRCG/src/ircproto.h +++ b/protocols/IRCG/src/ircproto.h @@ -70,7 +70,7 @@ struct CIrcProto : public PROTO<CIrcProto> int SetAwayMsg(int m_iStatus, const wchar_t *msg) override; void OnBuildProtoMenu(void) override; - bool OnContactDeleted(MCONTACT) override; + bool OnContactDeleted(MCONTACT, uint32_t flags) override; MWindow OnCreateAccMgrUI(MWindow) override; void OnModulesLoaded() override; void OnShutdown() override; diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 9d2d5a8cb2..2fccbe141d 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -165,7 +165,7 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam) return 0;
}
-bool CIrcProto::OnContactDeleted(MCONTACT hContact)
+bool CIrcProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
if (!hContact)
return false;
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 15969c1b41..f32a001092 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -26,7 +26,7 @@ void CIrcProto::CheckUpdate() if (getByte("Compatibility") < 1) {
for (auto &cc : AccContacts()) {
if (getByte(cc, "ChatRoom") == GCW_SERVER)
- db_delete_contact(cc, true);
+ db_delete_contact(cc, CDF_FROM_SERVER);
else {
ptrA szNick(getUStringA(cc, "Nick"));
if (szNick)
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 6f5aec66ac..cf3c2f92a7 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
// OnContactDeleted - processes a contact deletion
-bool CJabberProto::OnContactDeleted(MCONTACT hContact)
+bool CJabberProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
if (!m_bJabberOnline) // should never happen
return false;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index fb350691f8..f2d6d3b8a9 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -513,7 +513,7 @@ void CJabberProto::OnIqResultGetRoster(const TiXmlElement *iqNode, CJabberIqInfo auto *item = ListGetItemPtrFromIndex(i);
if (item && item->hContact && !item->bRealContact) {
debugLogA("Syncing roster: preparing to delete %s (hContact=0x%x)", item->jid, item->hContact);
- db_delete_contact(item->hContact, true);
+ db_delete_contact(item->hContact, CDF_FROM_SERVER);
}
}
}
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 920e1a4e29..74265aca85 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -149,7 +149,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface int UserIsTyping(MCONTACT hContact, int type) override;
void OnBuildProtoMenu(void) override;
- bool OnContactDeleted(MCONTACT) override;
+ bool OnContactDeleted(MCONTACT, uint32_t flags) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 92f490d104..27fe3246a9 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1370,7 +1370,7 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info) else if (!mir_strcmp(action, "delete")) {
MCONTACT cc = HContactFromJID(jid);
if (cc)
- db_delete_contact(cc, true);
+ db_delete_contact(cc, CDF_FROM_SERVER);
}
}
}
diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index 808cd87fe2..d0488ec451 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -141,7 +141,7 @@ void MinecraftDynmapProto::OnShutdown() SetStatus(ID_STATUS_OFFLINE);
}
-bool MinecraftDynmapProto::OnContactDeleted(MCONTACT)
+bool MinecraftDynmapProto::OnContactDeleted(MCONTACT, uint32_t)
{
OnLeaveChat(NULL, NULL);
return true;
diff --git a/protocols/MinecraftDynmap/src/proto.h b/protocols/MinecraftDynmap/src/proto.h index ba00677bc8..5c3f5e0ce1 100644 --- a/protocols/MinecraftDynmap/src/proto.h +++ b/protocols/MinecraftDynmap/src/proto.h @@ -46,7 +46,7 @@ public: INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override;
int SetStatus(int iNewStatus) override;
- bool OnContactDeleted(MCONTACT) override;
+ bool OnContactDeleted(MCONTACT, uint32_t) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnShutdown() override;
diff --git a/protocols/NewsAggregator/Src/Options.cpp b/protocols/NewsAggregator/Src/Options.cpp index 4caf6ce6eb..856ac9fe02 100644 --- a/protocols/NewsAggregator/Src/Options.cpp +++ b/protocols/NewsAggregator/Src/Options.cpp @@ -127,7 +127,7 @@ public: if (mir_wstrcmp(dbURL, url)) continue; - db_delete_contact(hContact, true); + db_delete_contact(hContact, CDF_FROM_SERVER); m_feeds.DeleteItem(isel); break; } diff --git a/protocols/Non-IM Contact/src/dialog.cpp b/protocols/Non-IM Contact/src/dialog.cpp index ab1d7e4dcd..3f76b3ae5b 100644 --- a/protocols/Non-IM Contact/src/dialog.cpp +++ b/protocols/Non-IM Contact/src/dialog.cpp @@ -290,7 +290,7 @@ INT_PTR addContact(WPARAM, LPARAM) g_plugin.setWString(hContact, "Nick", TranslateT("New Non-IM Contact")); DoPropertySheet(hContact); if (db_get_static(hContact, MODNAME, "Name", tmp, _countof(tmp))) - db_delete_contact(hContact, true); + db_delete_contact(hContact, CDF_FROM_SERVER); replaceAllStrings(hContact); return 0; } @@ -307,7 +307,7 @@ INT_PTR editContact(WPARAM wParam, LPARAM) } DoPropertySheet(hContact); if (db_get_static(hContact, MODNAME, "Name", tmp, _countof(tmp))) - db_delete_contact(hContact, true); + db_delete_contact(hContact, CDF_FROM_SERVER); replaceAllStrings(hContact); return 0; } diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index bb247ccdaa..27fa124bb6 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -128,7 +128,7 @@ void CSametimeProto::OnShutdown() LogOut();
}
-bool CSametimeProto::OnContactDeleted(MCONTACT hContact)
+bool CSametimeProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
ContactDeleted(hContact);
ChatDeleted(hContact);
@@ -141,7 +141,7 @@ void CSametimeProto::SetAllOffline() for (auto &hContact : AccContacts()) {
if (Contact::IsGroupChat(hContact, m_szModuleName)) {
- db_delete_contact(hContact, true);
+ db_delete_contact(hContact, CDF_FROM_SERVER);
continue;
}
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index 159dfa36e8..44f6bcd3a8 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -38,7 +38,7 @@ struct CSametimeProto : public PROTO<CSametimeProto> int UserIsTyping(MCONTACT hContact, int type) override;
void OnShutdown() override;
- bool OnContactDeleted(MCONTACT hContact) override;
+ bool OnContactDeleted(MCONTACT hContact, uint32_t flags) override;
// sametime.cpp
INT_PTR __cdecl GetName(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index e569b3a8d4..ddd627f46d 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -233,7 +233,7 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM) PushRequest(new KickUserRequest(_T2A(idT), m_szSkypename));
- db_delete_contact(hContact, true);
+ db_delete_contact(hContact, CDF_FROM_SERVER);
}
return 0;
}
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index ed9225c6d9..52b04369fd 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -235,7 +235,7 @@ INT_PTR CSkypeProto::OnGrantAuth(WPARAM hContact, LPARAM) return 0;
}
-bool CSkypeProto::OnContactDeleted(MCONTACT hContact)
+bool CSkypeProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
if (IsOnline() && hContact) {
if (isChatRoom(hContact))
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 68ecab3b07..11d91a6aa0 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -68,7 +68,7 @@ public: int SetAwayMsg(int m_iStatus, const wchar_t *msg) override;
void OnBuildProtoMenu(void) override;
- bool OnContactDeleted(MCONTACT) override;
+ bool OnContactDeleted(MCONTACT, uint32_t flags) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 5cf5c5908c..f41698b34b 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -332,7 +332,7 @@ HANDLE CSteamProto::GetAwayMsg(MCONTACT hContact) return (HANDLE)1;
}
-bool CSteamProto::OnContactDeleted(MCONTACT hContact)
+bool CSteamProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
// remove only authorized contacts
if (!getByte(hContact, "Auth", 0)) {
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index ed7978e890..8cb7fdf0c0 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -284,7 +284,7 @@ public: int UserIsTyping(MCONTACT hContact, int type) override;
- bool OnContactDeleted(MCONTACT) override;
+ bool OnContactDeleted(MCONTACT, uint32_t flags) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnModulesLoaded() override;
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 30b096813b..48bb212951 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -116,7 +116,7 @@ void CTelegramProto::OnContactAdded(MCONTACT hContact) } } -bool CTelegramProto::OnContactDeleted(MCONTACT hContact) +bool CTelegramProto::OnContactDeleted(MCONTACT hContact, uint32_t) { TD::int53 id = GetId(hContact); if (id == 0) diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index a963e17119..62b23d2f8e 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -367,7 +367,7 @@ public: void OnBuildProtoMenu() override; void OnContactAdded(MCONTACT hContact) override; - bool OnContactDeleted(MCONTACT hContact) override; + bool OnContactDeleted(MCONTACT hContact, uint32_t flags) override; MWindow OnCreateAccMgrUI(MWindow hwndParent) override; void OnErase() override; void OnEventDeleted(MCONTACT, MEVENT) override; diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 52dc634705..7a59341212 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -548,7 +548,7 @@ void CTelegramProto::ProcessChatLastMessage(TD::updateChatLastMessage *pObj) if (Contact::OnList(pUser->hContact))
CallService(MS_HISTORY_EMPTY, pUser->hContact, TRUE);
else
- db_delete_contact(pUser->hContact, true);
+ db_delete_contact(pUser->hContact, CDF_FROM_SERVER);
}
}
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index fffe9633ef..db472e3ed0 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -201,7 +201,7 @@ INT_PTR CToxProto::OnGrantAuth(WPARAM hContact, LPARAM) return 0;
}
-bool CToxProto::OnContactDeleted(MCONTACT hContact)
+bool CToxProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
if (!IsOnline())
return false;
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 0c9f98f1b2..f5969c8f5e 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -67,7 +67,7 @@ public: int UserIsTyping(MCONTACT hContact, int type) override;
void OnBuildProtoMenu(void) override;
- bool OnContactDeleted(MCONTACT) override;
+ bool OnContactDeleted(MCONTACT, uint32_t flags) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnErase() override;
void OnModulesLoaded() override;
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index daf6fd33ca..1f9488e69a 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -154,7 +154,7 @@ HANDLE CTwitterProto::GetAwayMsg(MCONTACT hContact) return (HANDLE)1;
}
-bool CTwitterProto::OnContactDeleted(MCONTACT hContact)
+bool CTwitterProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
if (m_iStatus != ID_STATUS_ONLINE)
return false;
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 60e57f45aa..064497ee3a 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -306,7 +306,7 @@ void CTwitterProto::UpdateSettings() for (MCONTACT hContact = db_find_first(m_szModuleName); hContact;) {
MCONTACT hNext = db_find_next(hContact, m_szModuleName);
if (isChatRoom(hContact))
- db_delete_contact(hContact, true);
+ db_delete_contact(hContact, CDF_FROM_SERVER);
hContact = hNext;
}
}
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index 6195e650f2..6a5b0e93bb 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -183,7 +183,7 @@ public: HANDLE GetAwayMsg(MCONTACT) override;
- bool OnContactDeleted(MCONTACT) override;
+ bool OnContactDeleted(MCONTACT, uint32_t flags) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index e76f8787d9..9af11685b2 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -1868,7 +1868,7 @@ MEVENT CVkProto::GetMessageFromDb(const char *szMessageId, time_t& tTimeStamp, C int CVkProto::DeleteContact(MCONTACT hContact)
{
setByte(hContact, "SilentDelete", 1);
- return db_delete_contact(hContact, true);
+ return db_delete_contact(hContact, CDF_FROM_SERVER);
}
bool CVkProto::IsMessageExist(VKMessageID_t iMessageId, VKMesType vkType)
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index e974236fb1..8bd1c362c4 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -749,7 +749,7 @@ int CVkProto::GetInfo(MCONTACT hContact, int) return 0;
}
-bool CVkProto::OnContactDeleted(MCONTACT hContact)
+bool CVkProto::OnContactDeleted(MCONTACT hContact, uint32_t)
{
ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick"));
debugLogW(L"CVkProto::OnContactDeleted %s", pwszNick.get());
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 8bee1672c3..ecfec1c4eb 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -73,7 +73,7 @@ struct CVkProto : public PROTO<CVkProto> int UserIsTyping(MCONTACT hContact, int type) override;
void OnBuildProtoMenu() override;
- bool OnContactDeleted(MCONTACT) override;
+ bool OnContactDeleted(MCONTACT, uint32_t flags) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
diff --git a/protocols/YAMN/src/proto/pop3/pop3opt.cpp b/protocols/YAMN/src/proto/pop3/pop3opt.cpp index b90138c4c2..624376d757 100644 --- a/protocols/YAMN/src/proto/pop3/pop3opt.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3opt.cpp @@ -681,7 +681,7 @@ public: DlgSetItemTextW(m_hwnd, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
if (ActualAccount->hContact != NULL)
- db_delete_contact(ActualAccount->hContact, true);
+ db_delete_contact(ActualAccount->hContact, CDF_FROM_SERVER);
DeleteAccount(POP3Plugin, ActualAccount);
diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc index b683748fde..2df21d5287 100644 --- a/src/mir_app/res/resource.rc +++ b/src/mir_app/res/resource.rc @@ -58,19 +58,19 @@ BEGIN EDITTEXT IDC_AUTHREQ,13,95,204,29,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
END
-IDD_DELETECONTACT DIALOGEX 0, 0, 294, 101
+IDD_DELETECONTACT DIALOGEX 0, 0, 294, 99
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
CAPTION "Delete contact"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- PUSHBUTTON "&Yes",IDYES,58,38,65,14
- DEFPUSHBUTTON "&No",IDNO,172,38,65,14
- CONTROL "Hide from list only, in order to keep their history and ignore/visibility settings",IDC_HIDE,
- "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,65,280,9
- LTEXT "Use Options -> Contacts -> Ignore to unhide contacts.",IDC_STATIC,20,78,257,16
CONTROL "Are you sure you want to delete %s?",IDC_TOPLINE,"Static",SS_SIMPLE | SS_NOPREFIX | WS_GROUP,7,7,270,8
LTEXT "This will erase all history and settings for this contact!",IDC_STATIC,7,18,239,16
+ CONTROL "Remove contact from server too",IDC_DELSERVERCONTACT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,37,280,8
+ CONTROL "Remove server history", IDC_DELSERVERHISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,50,280,8
+ CONTROL "Remove history for everyone",IDC_BOTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,63,260,8
+ PUSHBUTTON "&Yes",IDOK,149,78,65,14
+ DEFPUSHBUTTON "&No",IDCANCEL,221,78,65,14
END
IDD_OPT_CONTACT DIALOGEX 0, 0, 313, 242
@@ -1185,7 +1185,7 @@ BEGIN LEFTMARGIN, 7
RIGHTMARGIN, 286
TOPMARGIN, 7
- BOTTOMMARGIN, 88
+ BOTTOMMARGIN, 79
END
IDD_OPT_CONTACT, DIALOG
@@ -1270,12 +1270,6 @@ BEGIN VERTGUIDE, 305
END
- IDD_OPT_VISIBILITY, DIALOG
- BEGIN
- VERTGUIDE, 8
- VERTGUIDE, 305
- END
-
IDD_ICONINDEX, DIALOG
BEGIN
LEFTMARGIN, 4
@@ -1757,77 +1751,10 @@ BEGIN END
END
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// AFX_DIALOG_LAYOUT
-//
-
-IDD_OPT_SRMMLOG AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_OPT_CLIST AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_OPT_CHAT_EVENTS AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_OPT_SOUND AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_NETLIBLOGOPTS AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_OPT_GENMENU AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_OPT_POPUPOPTION AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_OPT_FILESECURITY AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_OPT_FILEGENERAL AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_NEWPASS AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_CHANGEPASS AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
-IDD_PROFILE_NEW AFX_DIALOG_LAYOUT
-BEGIN
- 0
-END
-
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
-
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index ff352246f2..9f4d32e9a6 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -134,8 +134,8 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) if (caps & PF1_SERVERCLIST) {
for (MCONTACT hContact = db_find_first(ack->szModule); hContact; ) {
MCONTACT hNext = db_find_next(hContact, ack->szModule);
- if (db_get_b(hContact, "CList", "Delete", 0))
- db_delete_contact(hContact);
+ if (int options = db_get_b(hContact, "CList", "Delete"))
+ db_delete_contact(hContact, options);
hContact = hNext;
}
}
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index e46368d640..7efc4404be 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -126,93 +126,106 @@ static INT_PTR MenuItem_RenameContact(WPARAM, LPARAM) return 0;
}
-static INT_PTR CALLBACK AskForConfirmationDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hWnd);
- {
- LOGFONT lf;
- HFONT hFont = (HFONT)SendDlgItemMessage(hWnd, IDYES, WM_GETFONT, 0, 0);
- GetObject(hFont, sizeof(lf), &lf);
- lf.lfWeight = FW_BOLD;
- SendDlgItemMessage(hWnd, IDC_TOPLINE, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), 0);
-
- wchar_t szFormat[256], szFinal[256];
- GetDlgItemText(hWnd, IDC_TOPLINE, szFormat, _countof(szFormat));
- mir_snwprintf(szFinal, szFormat, Clist_GetContactDisplayName(lParam));
- SetDlgItemText(hWnd, IDC_TOPLINE, szFinal);
- }
- SetFocus(GetDlgItem(hWnd, IDNO));
- SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDYES:
- if (IsDlgButtonChecked(hWnd, IDC_HIDE)) {
- EndDialog(hWnd, IDC_HIDE);
- break;
- }
- __fallthrough;
+/////////////////////////////////////////////////////////////////////////////////////////
- case IDCANCEL:
- case IDNO:
- EndDialog(hWnd, LOWORD(wParam));
- break;
- }
- break;
+class CDeleteDlg : public CDlgBase
+{
+ MCONTACT m_hContact;
+ CCtrlCheck chkDelContact, chkDelHistory, chkForEveryone;
+
+public:
+ char *szProto;
+ bool bDelContact, bDelHistory, bForEveryone;
+
+ CDeleteDlg(MCONTACT hContact) :
+ CDlgBase(g_plugin, IDD_DELETECONTACT),
+ m_hContact(hContact),
+ chkDelContact(this, IDC_DELSERVERCONTACT),
+ chkDelHistory(this, IDC_DELETEHISTORY),
+ chkForEveryone(this, IDC_BOTH)
+ {
+ szProto = Proto_GetBaseAccountName(hContact);
+ bDelContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_SERVERCLIST) != 0;
+ bDelHistory = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SERVERMSGID) != 0;
+ bForEveryone = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_DELETEFORALL) != 0;
+ }
- case WM_CLOSE:
- SendMessage(hWnd, WM_COMMAND, MAKEWPARAM(IDNO, BN_CLICKED), 0);
- break;
+ bool OnInitDialog() override
+ {
+ chkDelContact.SetState(bDelContact);
+ chkDelHistory.Enable(bDelHistory);
+ chkDelHistory.SetState(bDelHistory);
+ chkForEveryone.Enable(bDelHistory && bForEveryone);
+ chkForEveryone.SetState(bForEveryone);
+
+ LOGFONT lf;
+ HFONT hFont = (HFONT)SendDlgItemMessage(m_hwnd, IDYES, WM_GETFONT, 0, 0);
+ GetObject(hFont, sizeof(lf), &lf);
+ lf.lfWeight = FW_BOLD;
+ SendDlgItemMessage(m_hwnd, IDC_TOPLINE, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), 0);
+
+ wchar_t szFormat[256], szFinal[256];
+ GetDlgItemText(m_hwnd, IDC_TOPLINE, szFormat, _countof(szFormat));
+ mir_snwprintf(szFinal, szFormat, Clist_GetContactDisplayName(m_hContact));
+ SetDlgItemText(m_hwnd, IDC_TOPLINE, szFinal);
+
+ SetFocus(GetDlgItem(m_hwnd, IDNO));
+ SetWindowPos(m_hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ return true;
+ }
- case WM_DESTROY:
- DeleteObject((HFONT)SendDlgItemMessage(hWnd, IDC_TOPLINE, WM_GETFONT, 0, 0));
- break;
+ bool OnApply() override
+ {
+ bDelContact = chkDelContact.IsChecked();
+ bDelHistory = chkDelHistory.IsChecked();
+ bForEveryone = chkForEveryone.IsChecked();
+ return true;
}
- return FALSE;
-}
+ void OnDestroy() override
+ {
+ DeleteObject((HFONT)SendDlgItemMessage(m_hwnd, IDC_TOPLINE, WM_GETFONT, 0, 0));
+ }
+};
-static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam)
+static INT_PTR MenuItem_DeleteContact(WPARAM hContact, LPARAM lParam)
{
- //see notes about deleting contacts on PF1_SERVERCLIST servers in m_protosvc.h
- UINT_PTR action;
+ CDeleteDlg dlg(hContact);
+ if (dlg.szProto == nullptr)
+ return 0;
- if (Clist::ConfirmDelete && !(GetKeyState(VK_SHIFT) & 0x8000))
+ int action;
+ if (Clist::ConfirmDelete && !(GetKeyState(VK_SHIFT) & 0x8000)) {
// Ask user for confirmation, and if the contact should be archived (hidden, not deleted)
- action = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DELETECONTACT), (HWND)lParam, AskForConfirmationDlgProc, wParam);
- else
- action = IDYES;
-
- switch (action) {
- case IDC_HIDE: // Archive contact
- Contact::Hide(wParam);
- break;
+ dlg.SetParent((HWND)lParam);
+ action = dlg.DoModal();
+ }
+ else action = IDOK;
- case IDYES: // Delete contact
- char *szProto = Proto_GetBaseAccountName(wParam);
- if (szProto != nullptr) {
- // Check if protocol uses server side lists
- uint32_t caps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- if (caps & PF1_SERVERCLIST) {
- int status = Proto_GetStatus(szProto);
- if (status == ID_STATUS_OFFLINE || IsStatusConnecting(status)) {
- // Set a flag so we remember to delete the contact when the protocol goes online the next time
- db_set_b(wParam, "CList", "Delete", 1);
- MessageBoxW(nullptr,
- TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."),
- TranslateT("Delete contact"), MB_ICONINFORMATION | MB_OK);
- return 0;
- }
- }
- }
+ if (action != IDOK)
+ return 0;
- db_delete_contact(wParam);
- break;
+ int options = 0;
+ if (!dlg.bDelContact)
+ Contact::Hide(hContact);
+ else
+ options |= CDF_DEL_CONTACT;
+
+ // Check if protocol uses server side lists
+ if (dlg.bDelHistory)
+ options |= CDF_DEL_HISTORY;
+ if (dlg.bForEveryone)
+ options |= CDF_FOR_EVERYONE;
+
+ int status = Proto_GetStatus(dlg.szProto);
+ if (status == ID_STATUS_OFFLINE || IsStatusConnecting(status)) {
+ // Set a flag so we remember to delete the contact when the protocol goes online the next time
+ db_set_b(hContact, "CList", "Delete", options);
+ MessageBoxW(nullptr,
+ TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."),
+ TranslateT("Delete contact"), MB_ICONINFORMATION | MB_OK);
}
-
+ else db_delete_contact(hContact, options);
return 0;
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 1fa9ad6573..7ebde24f72 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -486,7 +486,7 @@ Proto_GetStatus @601 ?OnModulesLoaded@PROTO_INTERFACE@@UAEXXZ @607 NONAME
?OnShutdown@PROTO_INTERFACE@@UAEXXZ @608 NONAME
?GetStatus@Contact@@YGHI@Z @609 NONAME
-?OnContactDeleted@PROTO_INTERFACE@@UAE_NI@Z @610 NONAME
+?OnContactDeleted@PROTO_INTERFACE@@UAE_NII@Z @610 NONAME
?OnBuildProtoMenu@PROTO_INTERFACE@@UAEXXZ @611 NONAME
?OnErase@PROTO_INTERFACE@@UAEXXZ @612 NONAME
?getMStringA@CMPluginBase@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD0@Z @613 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 6b2391f2cb..6de004a53d 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -486,7 +486,7 @@ Proto_GetStatus @601 ?OnModulesLoaded@PROTO_INTERFACE@@UEAAXXZ @607 NONAME
?OnShutdown@PROTO_INTERFACE@@UEAAXXZ @608 NONAME
?GetStatus@Contact@@YAHI@Z @609 NONAME
-?OnContactDeleted@PROTO_INTERFACE@@UEAA_NI@Z @610 NONAME
+?OnContactDeleted@PROTO_INTERFACE@@UEAA_NII@Z @610 NONAME
?OnBuildProtoMenu@PROTO_INTERFACE@@UEAAXXZ @611 NONAME
?OnErase@PROTO_INTERFACE@@UEAAXXZ @612 NONAME
?getMStringA@CMPluginBase@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD0@Z @613 NONAME
diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp index 31f04aaf0d..76b7b17778 100644 --- a/src/mir_app/src/proto_interface.cpp +++ b/src/mir_app/src/proto_interface.cpp @@ -72,7 +72,7 @@ void PROTO_INTERFACE::OnBuildProtoMenu() void PROTO_INTERFACE::OnContactAdded(MCONTACT)
{}
-bool PROTO_INTERFACE::OnContactDeleted(MCONTACT)
+bool PROTO_INTERFACE::OnContactDeleted(MCONTACT, uint32_t)
{
return true;
}
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h index 5d7c3e08d0..d526e2c4f2 100644 --- a/src/mir_app/src/resource.h +++ b/src/mir_app/src/resource.h @@ -496,6 +496,9 @@ #define IDC_ASK 1516
#define IDC_HIDE 1534
#define IDC_TOPLINE 1535
+#define IDC_BOTH 1536
+#define IDC_DELSERVERCONTACT 1537
+#define IDC_DELSERVERHISTORY 1538
#define IDC_MYHANDLE 1540
#define IDC_GROUP 1541
#define IDC_AUTH 1543
@@ -687,7 +690,7 @@ //
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 338
+#define _APS_NEXT_RESOURCE_VALUE 339
#define _APS_NEXT_COMMAND_VALUE 40018
#define _APS_NEXT_CONTROL_VALUE 1761
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index 9678415494..57b22754c3 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -98,7 +98,7 @@ MIR_CORE_DLL(MCONTACT) db_add_contact(void) return hNew;
}
-MIR_CORE_DLL(int) db_delete_contact(MCONTACT hContact, bool bFromProto)
+MIR_CORE_DLL(int) db_delete_contact(MCONTACT hContact, uint32_t flags)
{
ptrW wszPhoto(db_get_wsa(hContact, "ContactPhoto", "File"));
if (wszPhoto != nullptr) {
@@ -109,9 +109,9 @@ MIR_CORE_DLL(int) db_delete_contact(MCONTACT hContact, bool bFromProto) #endif
}
- if (!bFromProto)
+ if (!(flags & CDF_FROM_SERVER))
if (auto *ppro = Proto_GetInstance(hContact))
- if (!ppro->OnContactDeleted(hContact))
+ if (!ppro->OnContactDeleted(hContact, flags))
return 1;
Netlib_Logf(nullptr, "Contact deleted: %d", hContact);
|