diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-07 12:16:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-07 12:16:37 +0000 |
commit | 2c62996eab8f006e64978ada3b48b8a26578bab4 (patch) | |
tree | 8ec36ff744dc4ca7bbce2237609cec3ccf780a9a /protocols/MRA | |
parent | 03a0b643b94d5aa7f9c129fe73eea314d099cf56 (diff) |
MRA:
- r/o server groups' support
- extensive use of CMStringA
- further code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@5995 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA')
-rw-r--r-- | protocols/MRA/src/Mra.h | 13 | ||||
-rw-r--r-- | protocols/MRA/src/MraFilesQueue.h | 18 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.cpp | 12 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.h | 20 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 7 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_proto.cpp | 118 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_svcs.cpp | 2 |
7 files changed, 102 insertions, 88 deletions
diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h index 38e7276a76..b3d2e5f521 100644 --- a/protocols/MRA/src/Mra.h +++ b/protocols/MRA/src/Mra.h @@ -106,8 +106,6 @@ struct MRA_GUID DWORD id[4];
};
-
-
struct MRA_ADDR_LIST_ITEM
{
DWORD dwPort;
@@ -147,6 +145,17 @@ __forceinline BinBuffer& operator >>(BinBuffer& buf, CMStringW &sVar) { buf.get /////////////////////////////////////////////////////////////////////////////
+BOOL DB_GetStaticStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
+BOOL DB_GetStaticStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPWSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
+
+BOOL DB_GetStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringA &Ret);
+BOOL DB_GetStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringW &Ret);
+
+BOOL DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringA &value);
+BOOL DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringW &value);
+
+BOOL DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
+
#include "MraConstans.h"
#include "MraProto.h"
diff --git a/protocols/MRA/src/MraFilesQueue.h b/protocols/MRA/src/MraFilesQueue.h index 5c55c5b8ad..dbcba782cf 100644 --- a/protocols/MRA/src/MraFilesQueue.h +++ b/protocols/MRA/src/MraFilesQueue.h @@ -1,23 +1,17 @@ #if !defined(AFX_MRA_FILESQUEUE_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
#define AFX_MRA_FILESQUEUE_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_
-
-#if _MSC_VER > 1000
#pragma once
-#endif // _MSC_VER > 1000
-
INT_PTR CALLBACK MraFilesQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-DWORD MraFilesQueueInitialize (DWORD dwFilesTimeOutInterval, HANDLE *phFilesQueueHandle);
-void MraFilesQueueDestroy (HANDLE hFilesQueueHandle);
-
-void MraFilesQueueConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra);
-
-HANDLE MraFilesQueueItemProxyByID (HANDLE hFilesQueueHandle, DWORD dwIDRequest);
-DWORD MraFilesQueueStartMrimProxy (HANDLE hFilesQueueHandle, DWORD dwIDRequest);
-DWORD MraFilesQueueFree (HANDLE hFilesQueueHandle, DWORD dwCMDNum);
+DWORD MraFilesQueueInitialize(DWORD dwFilesTimeOutInterval, HANDLE *phFilesQueueHandle);
+void MraFilesQueueDestroy(HANDLE hFilesQueueHandle);
+void MraFilesQueueConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra);
+HANDLE MraFilesQueueItemProxyByID(HANDLE hFilesQueueHandle, DWORD dwIDRequest);
+DWORD MraFilesQueueStartMrimProxy(HANDLE hFilesQueueHandle, DWORD dwIDRequest);
+DWORD MraFilesQueueFree(HANDLE hFilesQueueHandle, DWORD dwCMDNum);
#endif // !defined(AFX_MRA_FILESQUEUE_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index a6e05e5c3e..a42d404bfa 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -9,7 +9,8 @@ static int MraExtraIconsApplyAll(WPARAM, LPARAM) CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
PROTO<CMraProto>(_module, _displayName),
- m_bLoggedIn(false)
+ m_bLoggedIn(false),
+ m_groups(5, NumericKeySortT)
{
InitializeCriticalSectionAndSpinCount(&csCriticalSectionSend, 0);
MraSendQueueInitialize(0, &hSendQueueHandle);
@@ -99,7 +100,7 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM) HookProtoEvent(ME_WAT_NEWSTATUS, &CMraProto::MraMusicChanged);
// всех в offline // тк unsaved values сохраняются их нужно инициализировать
- for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact != NULL; hContact = db_find_next(hContact, m_szModuleName))
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, 0, 0, 0);
// unsaved values
@@ -527,11 +528,10 @@ int CMraProto::SetStatus(int iNewStatus) dwOldStatusMode = InterlockedExchange((volatile LONG*)&m_iStatus, m_iDesiredStatus);
// всех в offline, только если мы бывали подключены
- if (dwOldStatusMode > ID_STATUS_OFFLINE) {
- // функция сама проверяет принадлежность контакта к MRA
- for (HANDLE hContact = db_find_first();hContact != NULL;hContact = db_find_next(hContact))
+ if (dwOldStatusMode > ID_STATUS_OFFLINE)
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, 0, 0, 0);
- }
+
Netlib_CloseHandle(m_hConnection);
}
else {
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 79fd39359b..cbd3d8d064 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -18,16 +18,18 @@ struct MRA_FILES_QUEUE_ITEM;
-BOOL DB_GetStaticStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
-BOOL DB_GetStaticStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPWSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
-
-BOOL DB_GetStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringA &Ret);
-BOOL DB_GetStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringW &Ret);
+struct MraGroupItem
+{
+ MraGroupItem(DWORD id, DWORD flags, const CMStringW &name) :
+ m_id(id), m_flags(flags), m_name(name)
+ {}
-BOOL DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringA &value);
-BOOL DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringW &value);
+ ~MraGroupItem()
+ {}
-BOOL DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
+ DWORD m_id, m_flags;
+ CMStringW m_name;
+};
struct CMraProto : public PROTO<CMraProto>
{
@@ -179,6 +181,8 @@ struct CMraProto : public PROTO<CMraProto> DWORD m_dwThreadWorkerRunning;
DWORD dwCMDNum;
+ OBJLIST<MraGroupItem> m_groups;
+
HANDLE hAvatarsQueueHandle;
HGENMENU hMainMenuItems[MAIN_MENU_ITEMS_COUNT+4];
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 8d3c419bd8..66d71e5966 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -414,9 +414,14 @@ DWORD CMraProto::SetContactBasicInfoW(HANDLE hContact, DWORD dwSetInfoFlags, DWO mraSetStringExA(hContact, "e-mail", *szEmail);
// поля изменения которых отслеживаются
- if (dwFlags & SCBIF_GROUP_ID)
+ if (dwFlags & SCBIF_GROUP_ID) {
setDword(hContact, "GroupID", dwGroupID);
+ MraGroupItem *grp = m_groups.find((MraGroupItem*)&dwGroupID);
+ if (grp)
+ db_set_ts(hContact, "CList", "Group", grp->m_name);
+ }
+
if ((dwFlags & SCBIF_NICK) && wszNick != NULL && !wszNick->IsEmpty()) {
if ((dwFlags & SCBIF_FLAG) && ((dwContactFlag & CONTACT_FLAG_UNICODE_NAME) == 0))
DB_SetStringExA(hContact, "CList", "MyHandle", CMStringA(*wszNick));
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 24594ffff9..bba5f38854 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -494,19 +494,19 @@ bool CMraProto::CmdUserInfo(BinBuffer &buf) CMStringW szStringW;
while (!buf.eof()) {
buf >> szString;
- if ( !_strnicmp(szString, "MESSAGES.TOTAL", 14)) {
+ if (szString == "MESSAGES.TOTAL") {
buf >> szString;
dwEmailMessagesTotal = atoi(szString);
}
- else if ( !_strnicmp(szString, "MESSAGES.UNREAD", 15)) {
+ else if (szString == "MESSAGES.UNREAD") {
buf >> szString;
m_dwEmailMessagesUnread = atoi(szString);
}
- else if ( !_strnicmp(szString, "MRIM.NICKNAME", 13)) {
+ else if (szString == "MRIM.NICKNAME") {
buf >> szStringW;
mraSetStringW(NULL, "Nick", szStringW);
}
- else if ( !_strnicmp(szString, "client.endpoint", 15)) {
+ else if (szString == "client.endpoint") {
buf >> szStringW;
szString = szStringW;
int lpszDelimiter = szString.Find(':');
@@ -515,48 +515,48 @@ bool CMraProto::CmdUserInfo(BinBuffer &buf) setDword("IP", ntohl(inet_addr(szAddr.c_str())));
}
}
- else if ( !_strnicmp(szString, "connect.xml", 11)) {
+ else if (szString == "connect.xml") {
DebugPrintA(szString);
buf >> szStringW;
DebugPrintCRLFW(szStringW);
}
- else if ( !_strnicmp(szString, "micblog.show_title", 18)) {
+ else if (szString == "micblog.show_title") {
DebugPrintA(szString);
buf >> szStringW;
DebugPrintCRLFW(szStringW);
}
- else if ( !_strnicmp(szString, "micblog.status.id", 17)) {
+ else if (szString == "micblog.status.id") {
buf >> szString;
DWORDLONG dwBlogStatusID = _atoi64(szString);
mraWriteContactSettingBlob(NULL, DBSETTING_BLOGSTATUSID, &dwBlogStatusID, sizeof(DWORDLONG));
}
- else if ( !_strnicmp(szString, "micblog.status.time", 19)) {
+ else if (szString == "micblog.status.time") {
buf >> szString;
setDword(DBSETTING_BLOGSTATUSTIME, atoi(szString));
}
- else if ( !_strnicmp(szString, "micblog.status.text", 19)) {
+ else if (szString == "micblog.status.text") {
buf >> szStringW;
mraSetStringW(NULL, DBSETTING_BLOGSTATUS, szStringW);
}
- else if ( !_strnicmp(szString, "HAS_MYMAIL", 10)) {
+ else if (szString == "HAS_MYMAIL") {
buf >> szString;
}
- else if ( !_strnicmp(szString, "mrim.status.open_search", 23)) {
+ else if (szString == "mrim.status.open_search") {
buf >> szString;
}
- else if ( !_strnicmp(szString, "rb.target.cookie", 16)) {
+ else if (szString == "rb.target.cookie") {
buf >> szString;
}
- else if ( !_strnicmp(szString, "show_web_history_link", 21)) {
+ else if (szString == "show_web_history_link") {
buf >> szString;
}
- else if ( !_strnicmp(szString, "friends_suggest", 15)) {
+ else if (szString == "friends_suggest") {
buf >> szString;
}
- else if ( !_strnicmp(szString, "timestamp", 9)) {
+ else if (szString == "timestamp") {
buf >> szString;
}
- else if ( !_strnicmp(szString, "trusted_update", 14)) {
+ else if (szString == "trusted_update") {
buf >> szString;
}
else {
@@ -1090,25 +1090,23 @@ bool CMraProto::CmdGame(BinBuffer &buf) bool CMraProto::CmdClist2(BinBuffer &buf)
{
- DWORD dwTemp; buf >> dwTemp;
+ DWORD dwTemp = buf.getDword();
if (dwTemp == GET_CONTACTS_OK) { // received contact list
- BOOL bAdded;
- DWORD dwID, dwGroupsCount, dwGroupFlags, dwContactFlag, dwGroupID, dwContactSeverFlags, dwStatus, dwXStatus, dwFutureFlags, dwBlogStatusTime;
- size_t i, j, dwControlParam;
+ m_groups.destroy();
+
+ DWORD dwGroupsCount, dwContactFlag, dwGroupID, dwContactSeverFlags, dwStatus, dwXStatus, dwFutureFlags, dwBlogStatusTime;
ULARGE_INTEGER dwBlogStatusID;
-
CMStringA szGroupMask, szContactMask, szEmail, szString;
CMStringA szCustomPhones, szSpecStatusUri, szUserAgentFormatted;
CMStringW wszNick, wszString, wszGroupName, wszStatusTitle, wszStatusDesc, wszBlogStatus, wszBlogStatusMusic;
buf >> dwGroupsCount >> szGroupMask >> szContactMask;
- char szBuff[200];
DebugPrintCRLFW(L"Groups:");
DebugPrintCRLFA(szGroupMask);
- dwID = 0;
- for (i = 0; i < dwGroupsCount; i++) { //groups handle
- dwControlParam = 0;
- for (j = 0; j < szGroupMask.GetLength(); j++) { //enumerating parameters
+ DWORD dwID = 0;
+ for (DWORD i = 0; i < dwGroupsCount; i++) { //groups handle
+ DWORD dwControlParam = 0, dwGroupFlags;
+ for (int j = 0; j < szGroupMask.GetLength(); j++) { //enumerating parameters
switch (szGroupMask[j]) {
case 's'://LPS
buf >> wszString;
@@ -1130,9 +1128,12 @@ bool CMraProto::CmdClist2(BinBuffer &buf) // add/modify group
if (dwControlParam > 1) { // все параметры правильно инициализированны!
+ m_groups.insert( new MraGroupItem(dwID, dwGroupFlags, wszGroupName));
+ Clist_CreateGroup(0, wszGroupName);
#ifdef _DEBUG
DebugPrintW(wszGroupName);
+ char szBuff[200];
mir_snprintf(szBuff, SIZEOF(szBuff), ": flags: %lu (", dwGroupFlags);
DebugPrintA(szBuff);
@@ -1156,105 +1157,102 @@ bool CMraProto::CmdClist2(BinBuffer &buf) DebugPrintCRLFA(szContactMask);
dwID = 20;
while (!buf.eof()) {
- dwControlParam = 0;
- for (j = 0; j < szContactMask.GetLength(); j++) { //enumerating parameters
- switch (szContactMask[j]) {
- case 's'://LPS
- break;
- case 'u'://UL
+ DWORD dwControlParam = 0;
+ for (int j = 0; j < szContactMask.GetLength(); j++) { //enumerating parameters
+ BYTE fieldType = szContactMask[j];
+ if (fieldType == 'u')
buf >> dwTemp;
- break;
- }
- if (j == 0 && szContactMask[j] == 'u') { // Flags
+ if (j == 0 && fieldType == 'u') { // Flags
dwContactFlag = dwTemp;
dwControlParam++;
}
- else if (j == 1 && szContactMask[j] == 'u') { // Group id
+ else if (j == 1 && fieldType == 'u') { // Group id
dwGroupID = dwTemp;
dwControlParam++;
}
- else if (j == 2 && szContactMask[j] == 's') { // Email
+ else if (j == 2 && fieldType == 's') { // Email
buf >> szEmail;
dwControlParam++;
}
- else if (j == 3 && szContactMask[j] == 's') { // Nick
+ else if (j == 3 && fieldType == 's') { // Nick
buf >> wszNick;
dwControlParam++;
}
- else if (j == 4 && szContactMask[j] == 'u') { // Server flags
+ else if (j == 4 && fieldType == 'u') { // Server flags
dwContactSeverFlags = dwTemp;
dwControlParam++;
}
- else if (j == 5 && szContactMask[j] == 'u') { // Status
+ else if (j == 5 && fieldType == 'u') { // Status
dwStatus = dwTemp;
dwControlParam++;
}
- else if (j == 6 && szContactMask[j] == 's') { // Custom Phone number,
+ else if (j == 6 && fieldType == 's') { // Custom Phone number,
buf >> szCustomPhones;
dwControlParam++;
}
- else if (j == 7 && szContactMask[j] == 's') { // spec_status_uri
+ else if (j == 7 && fieldType == 's') { // spec_status_uri
buf >> szSpecStatusUri;
dwControlParam++;
}
- else if (j == 8 && szContactMask[j] == 's') { // status_title
+ else if (j == 8 && fieldType == 's') { // status_title
buf >> wszStatusTitle;
dwControlParam++;
}
- else if (j == 9 && szContactMask[j] == 's') { // status_desc
+ else if (j == 9 && fieldType == 's') { // status_desc
buf >> wszStatusDesc;
dwControlParam++;
}
- else if (j == 10 && szContactMask[j] == 'u') { // com_support (future flags)
+ else if (j == 10 && fieldType == 'u') { // com_support (future flags)
dwFutureFlags = dwTemp;
dwControlParam++;
}
- else if (j == 11 && szContactMask[j] == 's') { // user_agent (formated string)
+ else if (j == 11 && fieldType == 's') { // user_agent (formated string)
buf >> szUserAgentFormatted;
dwControlParam++;
}
- else if (j == 12 && szContactMask[j] == 'u') { // BlogStatusID
+ else if (j == 12 && fieldType == 'u') { // BlogStatusID
dwBlogStatusID.LowPart = dwTemp;
dwControlParam++;
}
- else if (j == 13 && szContactMask[j] == 'u') { // BlogStatusID
+ else if (j == 13 && fieldType == 'u') { // BlogStatusID
dwBlogStatusID.HighPart = dwTemp;
dwControlParam++;
}
- else if (j == 14 && szContactMask[j] == 'u') { // BlogStatusTime
+ else if (j == 14 && fieldType == 'u') { // BlogStatusTime
dwBlogStatusTime = dwTemp;
dwControlParam++;
}
- else if (j == 15 && szContactMask[j] == 's') { // BlogStatus
+ else if (j == 15 && fieldType == 's') { // BlogStatus
buf >> wszBlogStatus;
dwControlParam++;
}
- else if (j == 16 && szContactMask[j] == 's') { // BlogStatusMusic
+ else if (j == 16 && fieldType == 's') { // BlogStatusMusic
buf >> wszBlogStatusMusic;
dwControlParam++;
}
- else if (j == 17 && szContactMask[j] == 's') { // BlogStatusSender // ignory
+ else if (j == 17 && fieldType == 's') { // BlogStatusSender // ignory
buf >> szString;
dwControlParam++;
}
- else if (j == 18 && szContactMask[j] == 's') { // geo data ?
+ else if (j == 18 && fieldType == 's') { // geo data ?
buf >> szString;
dwControlParam++;
}
- else if (j == 19 && szContactMask[j] == 's') { // ?????? ?
+ else if (j == 19 && fieldType == 's') { // ?????? ?
buf >> szString;
dwControlParam++;
DebugBreakIf(szString.GetLength());
}
else {
- if (szContactMask[j] == 's') {
+ if (fieldType == 's') {
buf >> szString;
if (szString.GetLength()) {
DebugPrintCRLFA(szString);
}
}
- else if (szContactMask[j] == 'u') {
+ else if (fieldType == 'u') {
+ char szBuff[50];
mir_snprintf(szBuff, SIZEOF(szBuff), "%lu, ", dwTemp);//;
DebugPrintCRLFA(szBuff);
}
@@ -1263,6 +1261,8 @@ bool CMraProto::CmdClist2(BinBuffer &buf) }
#ifdef _DEBUG
+ {
+ char szBuff[200];
mir_snprintf(szBuff, SIZEOF(szBuff), "ID: %lu, Group id: %lu, ", dwID, dwGroupID);
DebugPrintA(szBuff);
DebugPrintA(szEmail);
@@ -1286,6 +1286,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) if (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED)
DebugPrintA("CONTACT_INTFLAG_NOT_AUTHORIZED, ");
DebugPrintCRLFA(")");
+ }
#endif
// add/modify contact
@@ -1293,6 +1294,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) if ( _strnicmp(szEmail, "phone", 5))
if (dwControlParam>5)// все параметры правильно инициализированны!
if ((dwContactFlag & (CONTACT_FLAG_GROUP | CONTACT_FLAG_REMOVED)) == 0) {
+ BOOL bAdded;
HANDLE hContact = MraHContactFromEmail(szEmail, TRUE, FALSE, &bAdded);
if (hContact) {
// already in list, remove the duplicate
@@ -1355,7 +1357,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) if (mraGetStringW(NULL, "AuthMessage", wszAuthMessage) == FALSE) // def auth message
wszAuthMessage = TranslateW(MRA_DEFAULT_AUTH_MESSAGE);
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (GetContactBasicInfoW(hContact, &dwID, NULL, NULL, NULL, NULL, &szEmail, NULL, NULL) == NO_ERROR)
if (dwID == -1) {
if (IsEMailChatAgent(szEmail)) {// чат: ещё раз запросим авторизацию, пометим как видимый в списке, постоянный
@@ -1384,7 +1386,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) }
else { // контакт лист почемуто не получили
// всех в offline и id в нестандарт
- for (HANDLE hContact = db_find_first();hContact != NULL;hContact = db_find_next(hContact)) {
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS),
-1, -2, 0, 0, ID_STATUS_OFFLINE, 0, 0, 0);
// request user info from server
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 2301c50c24..73eabd9c5b 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -239,7 +239,7 @@ INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM wParam, LPARAM lParam) INT_PTR CMraProto::MraRequestAuthForAll(WPARAM wParam, LPARAM lParam)
{
if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateW(MRA_REQ_AUTH_FOR_ALL_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
DWORD dwContactSeverFlags;
if (GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL) == NO_ERROR)
if (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED && dwContactSeverFlags != -1)
|