From 9885bf54f788e831a80c76001340aa68d31d2aaa Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 25 Jan 2023 18:34:51 +0300 Subject: Group chats: ChatRoomID setting replaced with real protocol id --- protocols/Sametime/sametime.vcxproj.filters | 101 +++++++++++++----------- protocols/Sametime/src/conference.cpp | 4 +- protocols/Sametime/src/options.cpp | 37 +++++---- protocols/Sametime/src/session_announce_win.cpp | 2 +- protocols/Sametime/src/userlist.cpp | 34 ++++---- 5 files changed, 91 insertions(+), 87 deletions(-) (limited to 'protocols/Sametime') diff --git a/protocols/Sametime/sametime.vcxproj.filters b/protocols/Sametime/sametime.vcxproj.filters index 4d89fb680e..96d0377694 100644 --- a/protocols/Sametime/sametime.vcxproj.filters +++ b/protocols/Sametime/sametime.vcxproj.filters @@ -8,92 +8,92 @@ Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile - - Source Files + + Source Files\meanwhile @@ -121,4 +121,9 @@ Resource Files + + + {425f78cf-1344-45bb-89f5-cfe3510ea8ac} + + \ No newline at end of file diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index 27c490c388..6d1783958d 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -323,7 +323,7 @@ int CSametimeProto::ChatDeleted(MCONTACT hContact) { debugLogW(L"CSametimeProto::ChatDeleted() hContact=[%x]", hContact); DBVARIANT dbv; - if (!db_get_s(hContact, m_szModuleName, "ChatRoomID", &dbv)) { + if (!getUString(hContact, "stid", &dbv)) { TerminateConference(dbv.pszVal); db_free(&dbv); } @@ -384,7 +384,7 @@ int CSametimeProto::PrebuildContactMenu(WPARAM wParam, LPARAM) // if user is already in our meeting, bool not_present = true; DBVARIANT dbv; - if (my_conference && !db_get_utf(hContact, m_szModuleName, "stid", &dbv)) { + if (my_conference && !getUString(hContact, "stid", &dbv)) { char* user_id = dbv.pszVal; GList *members, *mem; diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index e96404360a..d34b6b5505 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -350,15 +350,15 @@ void CSametimeProto::LoadOptions() { DBVARIANT dbv; - if (!db_get_utf(0, m_szModuleName, "ServerName", &dbv)) { + if (!getUString(0, "ServerName", &dbv)) { strncpy(options.server_name, dbv.pszVal, LSTRINGLEN); db_free(&dbv); } - if (!db_get_utf(0, m_szModuleName, "stid", &dbv)) { + if (!getUString(0, "stid", &dbv)) { strncpy(options.id, dbv.pszVal, LSTRINGLEN); db_free(&dbv); } - if (!db_get_utf(0, m_szModuleName, "Password", &dbv)) { + if (!getUString(0, "Password", &dbv)) { strncpy(options.pword, dbv.pszVal, LSTRINGLEN); db_free(&dbv); } @@ -398,20 +398,19 @@ void CSametimeProto::LoadOptions() void CSametimeProto::SaveOptions() { - db_set_utf(0, m_szModuleName, "ServerName", options.server_name); - - db_set_utf(0, m_szModuleName, "stid", options.id); - //db_set_s(0, m_szModuleName, "Nick", options.id); - db_set_utf(0, m_szModuleName, "Password", options.pword); - - db_set_dw(0, m_szModuleName, "ServerPort", options.port); - db_set_b(0, m_szModuleName, "GetServerContacts", options.get_server_contacts ? 1 : 0); - db_set_dw(0, m_szModuleName, "ClientID", options.client_id); - db_set_dw(0, m_szModuleName, "ClientVersionMajor", options.client_versionMajor); - db_set_dw(0, m_szModuleName, "ClientVersionMinor", options.client_versionMinor); - db_set_b(0, m_szModuleName, "ErrorDisplay", options.err_method); - - db_set_b(0, m_szModuleName, "AutoAddContacts", options.add_contacts ? 1 : 0); - db_set_b(0, m_szModuleName, "EncryptSession", options.encrypt_session ? 1 : 0); - db_set_b(0, m_szModuleName, "IdleAsAway", options.idle_as_away ? 1 : 0); + setUString("ServerName", options.server_name); + + setUString("stid", options.id); + setUString("Password", options.pword); + + setDword("ServerPort", options.port); + setByte("GetServerContacts", options.get_server_contacts ? 1 : 0); + setDword("ClientID", options.client_id); + setDword("ClientVersionMajor", options.client_versionMajor); + setDword("ClientVersionMinor", options.client_versionMinor); + + setByte("ErrorDisplay", options.err_method); + setByte("AutoAddContacts", options.add_contacts ? 1 : 0); + setByte("EncryptSession", options.encrypt_session ? 1 : 0); + setByte("IdleAsAway", options.idle_as_away ? 1 : 0); } diff --git a/protocols/Sametime/src/session_announce_win.cpp b/protocols/Sametime/src/session_announce_win.cpp index 11ff040c7f..ab4d7bb495 100644 --- a/protocols/Sametime/src/session_announce_win.cpp +++ b/protocols/Sametime/src/session_announce_win.cpp @@ -102,7 +102,7 @@ INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara lvI.mask = LVIF_PARAM; ListView_GetItem(GetDlgItem(hwndDlg, IDC_LST_ANTO), &lvI); - if (!db_get_utf((MCONTACT)lvI.lParam, proto->m_szModuleName, "stid", &dbv)) { + if (!proto->getUString((MCONTACT)lvI.lParam, "stid", &dbv)) { safArg->recipients = g_list_prepend(safArg->recipients, _strdup(dbv.pszVal)); mir_strcpy(p, dbv.pszVal); safArg->recipients = g_list_prepend(safArg->recipients, _strdup(id)); diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index 1bc5102fff..cc64094d40 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -5,7 +5,7 @@ MCONTACT CSametimeProto::FindContactByUserId(const char* id) { DBVARIANT dbv; for (auto &hContact : AccContacts()) { - if (!db_get_utf(hContact, m_szModuleName, "stid", &dbv)) { + if (!getUString(hContact, "stid", &dbv)) { if (dbv.pszVal && mir_strcmp(id, dbv.pszVal) == 0) { db_free(&dbv); return hContact; @@ -21,7 +21,7 @@ bool CSametimeProto::GetAwareIdFromContact(MCONTACT hContact, mwAwareIdBlock* id char *proto = Proto_GetBaseAccountName(hContact); DBVARIANT dbv; if (proto && !mir_strcmp(m_szModuleName, proto)) { - if (!db_get_utf(hContact, m_szModuleName, "stid", &dbv)) { + if (!getUString(hContact, "stid", &dbv)) { if (dbv.pszVal) { id_block->type = mwAware_USER; id_block->user = _strdup(dbv.pszVal); @@ -73,21 +73,21 @@ MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary) Contact::Hide(hContact, false); } - // add to miranda - if (new_contact) db_set_utf(hContact, m_szModuleName, "stid", id); + if (new_contact) + setUString(hContact, "stid", id); if (name && mir_strlen(name)) - db_set_utf(hContact, m_szModuleName, "Name", name); + setUString(hContact, "Name", name); - if (nick && mir_strlen(nick)) { - db_set_utf(hContact, m_szModuleName, "Nick", nick); + if (mir_strlen(nick)) { + setUString(hContact, "Nick", nick); } - else if (name && mir_strlen(name)) { - db_set_utf(hContact, m_szModuleName, "Nick", name); + else if (mir_strlen(name)) { + setUString(hContact, "Nick", name); } else { - db_set_utf(hContact, m_szModuleName, "Nick", id); + setUString(hContact, "Nick", id); } db_set_b(hContact, m_szModuleName, "type", (uint8_t)type); @@ -196,7 +196,7 @@ void CSametimeProto::ExportContactsToList(mwSametimeList* user_list) mwIdBlock uid; for (auto &hContact : AccContacts()) { - if (!db_get_utf(hContact, m_szModuleName, "stid", &dbv)) { + if (!getUString(hContact, "stid", &dbv)) { if (dbv.pszVal) { if (GetAwareIdFromContact(hContact, &id_block)) { if (!db_get_utf(hContact, "CList", "Group", &dbv2)) { @@ -250,7 +250,7 @@ void CSametimeProto::ExportContactsToList(mwSametimeList* user_list) free(group_name); free(group_alias); - if (!db_get_utf(hContact, m_szModuleName, "Name", &dbv2)) { + if (!getUString(hContact, "Name", &dbv2)) { user_shortName = _strdup(dbv2.pszVal); db_free(&dbv2); } @@ -451,7 +451,7 @@ void mwAwareList_on_aware(mwAwareList* list, mwAwareSnapshot* aware) DBVARIANT dbv; // update self - necessary for some servers - if (aware->online && !db_get_utf(0, proto->m_szModuleName, "stid", &dbv) && mir_strcmp(aware->id.user, dbv.pszVal) == 0) { + if (aware->online && !proto->getUString("stid", &dbv) && mir_strcmp(aware->id.user, dbv.pszVal) == 0) { int new_status = ID_STATUS_OFFLINE; switch (aware->status.status) { @@ -587,7 +587,7 @@ void CSametimeProto::UserListCreate() for (auto &hContact : AccContacts()) { if (!Contact::IsGroupChat(hContact, m_szModuleName) /*&& proto && !mir_strcmp( PROTO, proto)*/) { - if (!db_get_utf(hContact, m_szModuleName, "stid", &dbv)) { + if (!getUString(hContact, "stid", &dbv)) { if (dbv.pszVal) { if (GetAwareIdFromContact(hContact, &id_block)) { // add user to aware list @@ -603,7 +603,7 @@ void CSametimeProto::UserListCreate() } // add self - might be necessary for some servers - if (!db_get_utf(0, m_szModuleName, "stid", &dbv)) { + if (!getUString("stid", &dbv)) { id_block.type = mwAware_USER; id_block.user = dbv.pszVal; id_block.community = nullptr; @@ -710,8 +710,8 @@ void mwResolve_handler_details_callback(mwServiceResolve* srvc, guint32, guint32 if (hContact) { char* name = ((mwResolveMatch*)mri->data)->name; if (name && mir_strlen(name)) { - db_set_utf(hContact, proto->m_szModuleName, "Name", name); - db_set_utf(hContact, proto->m_szModuleName, "Nick", name); + proto->setUString(hContact, "Name", name); + proto->setUString(hContact, "Nick", name); db_set_utf(hContact, "CList", "MyHandle", name); } } -- cgit v1.2.3