diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-08 20:01:45 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-08 20:01:45 +0000 |
commit | b3ac2b8aa5e0357325d6a8c31869cfac31424c43 (patch) | |
tree | e8025f1045a59bada4edafd26a38d697a5fc3553 /protocols | |
parent | f90c2d591aec8d0f7c4c41b420a3e1b54fc082de (diff) |
- group processing moved after contact's addition
- fixed misprint in variable name (it's resident anyway)
git-svn-id: http://svn.miranda-ng.org/main/trunk@6026 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/MRA/src/MraProto.cpp | 44 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 4 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_proto.cpp | 25 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_svcs.cpp | 25 |
4 files changed, 53 insertions, 45 deletions
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 8617309fe0..b2252970ac 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -110,7 +110,7 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM) db_set_resident(m_szModuleName, "ContactID");
db_set_resident(m_szModuleName, "GroupID");
db_set_resident(m_szModuleName, "ContactFlags");
- db_set_resident(m_szModuleName, "ContactSeverFlags");
+ db_set_resident(m_szModuleName, "ContactServerFlags");
db_set_resident(m_szModuleName, "HooksLocked");
db_set_resident(m_szModuleName, DBSETTING_CAPABILITIES);
db_set_resident(m_szModuleName, DBSETTING_XSTATUSNAME);
@@ -151,21 +151,35 @@ HANDLE CMraProto::AddToListByEmail(LPCTSTR plpsEMail, LPCTSTR plpsNick, LPCTSTR BOOL bAdded;
HANDLE hContact = MraHContactFromEmail(plpsEMail, TRUE, TRUE, &bAdded);
- if (hContact) {
- if (plpsNick)
- mraSetStringW(hContact, "Nick", plpsNick);
- if (plpsFirstName)
- mraSetStringW(hContact, "FirstName", plpsFirstName);
- if (plpsLastName)
- mraSetStringW(hContact, "LastName", plpsLastName);
-
- if (dwFlags & PALF_TEMPORARY)
- db_set_b(hContact, "CList", "Hidden", 1);
- else
- db_unset(hContact, "CList", "NotOnList");
+ if (hContact == NULL)
+ return NULL;
+
+ if (plpsNick)
+ mraSetStringW(hContact, "Nick", plpsNick);
+ if (plpsFirstName)
+ mraSetStringW(hContact, "FirstName", plpsFirstName);
+ if (plpsLastName)
+ mraSetStringW(hContact, "LastName", plpsLastName);
+
+ if (dwFlags & PALF_TEMPORARY)
+ db_set_b(hContact, "CList", "Hidden", 1);
+ else {
+ db_unset(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "NotOnList");
+ }
+
+ if (bAdded) {
+ CMStringW wszAuthMessage;
+ if ( !mraGetStringW(NULL, "AuthMessage", wszAuthMessage))
+ wszAuthMessage = TranslateW(MRA_DEFAULT_AUTH_MESSAGE);
+
+ CMStringA szEmail;
+ CMStringW wszNick;
+ DWORD dwContactFlag;
+ GetContactBasicInfoW(hContact, NULL, NULL, &dwContactFlag, NULL, NULL, &szEmail, &wszNick, NULL);
+ MraAddContact(hContact, dwContactFlag, 0, szEmail, wszNick, NULL, &wszAuthMessage);
- if (bAdded)
- MraUpdateContactInfo(hContact);
+ MraUpdateContactInfo(hContact); // request info update
}
return hContact;
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 2982d45da8..edb2426f00 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -402,7 +402,7 @@ DWORD CMraProto::GetContactBasicInfoW(HANDLE hContact, DWORD *pdwID, DWORD *pdwG if (pdwGroupID)
*pdwGroupID = getDword(hContact, "GroupID", -1);
if (pdwContactSeverFlags)
- *pdwContactSeverFlags = getDword(hContact, "ContactSeverFlags", 0);
+ *pdwContactSeverFlags = getDword(hContact, "ContactServerFlags", 0);
if (pdwStatus)
*pdwStatus = MraGetContactStatus(hContact);
if (pdwContactFlag)
@@ -477,7 +477,7 @@ DWORD CMraProto::SetContactBasicInfoW(HANDLE hContact, DWORD dwSetInfoFlags, DWO SetContactFlags(hContact, dwContactFlag);
if (dwFlags & SCBIF_SERVER_FLAG)
- setDword(hContact, "ContactSeverFlags", dwContactSeverFlags);
+ setDword(hContact, "ContactServerFlags", dwContactSeverFlags);
if (dwFlags & SCBIF_STATUS)
MraSetContactStatus(hContact, dwStatus);
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 4a6aa1952e..9af85b3299 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -612,13 +612,13 @@ bool CMraProto::CmdAuthAck(BinBuffer &buf) db_event_add(0, &dbei);
}
- DWORD dwTemp;
- GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwTemp, NULL, NULL, NULL, NULL);
- dwTemp &= ~CONTACT_INTFLAG_NOT_AUTHORIZED;
- SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, SCBIF_SERVER_FLAG, 0, 0, 0, dwTemp, 0, 0, 0, 0);
- setDword(hContact, "HooksLocked", TRUE);
+ DWORD dwFlags = getDword(hContact, "ContactServerFlags", 0);
+ if (dwFlags & CONTACT_INTFLAG_NOT_AUTHORIZED) {
+ dwFlags &= ~CONTACT_INTFLAG_NOT_AUTHORIZED;
+ setDword(hContact, "ContactServerFlags", dwFlags);
+ }
+
db_unset(hContact, "CList", "NotOnList");
- setDword(hContact, "HooksLocked", FALSE);
return true;
}
@@ -752,8 +752,15 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) DWORD dwTemp = buf.getDword();
switch (dwTemp) {
case CONTACT_OPER_SUCCESS:// ## добавление произведено успешно
- if (cmd == MRIM_CS_ADD_CONTACT_ACK)
- SetContactBasicInfoW(hContact, 0, (SCBIF_ID|SCBIF_SERVER_FLAG), buf.getDword(), 0, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, 0, 0, 0, 0);
+ if (cmd == MRIM_CS_ADD_CONTACT_ACK) {
+ DWORD dwFlags = SCBIF_ID | SCBIF_SERVER_FLAG, dwGroupID = 0;
+ ptrT grpName( db_get_tsa(hContact, "CList", "Group"));
+ if (grpName) {
+ dwFlags |= SCBIF_GROUP_ID;
+ dwGroupID = MraMoveContactToGroup(hContact, -1, grpName);
+ }
+ SetContactBasicInfoW(hContact, 0, dwFlags, buf.getDword(), dwGroupID, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, 0, 0, 0, 0);
+ }
break;
case CONTACT_OPER_ERROR:// ## переданные данные были некорректны
ShowFormattedErrorMessage(L"Data been sent are invalid", NO_ERROR);
@@ -1316,7 +1323,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) // request user info from server
MraUpdateContactInfo(hContact);
}
- else { //****deb - check group ID param
+ else {
if (iGroupMode == 100) { // first start
ptrT tszGroup( db_get_tsa(hContact, "CList", "Group"));
if (tszGroup)
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 999a6ba551..670a8ae86f 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -440,8 +440,6 @@ int CMraProto::MraDbSettingChanged(WPARAM wParam, LPARAM lParam) // это наш контакт, он не временный (есть в списке на сервере) и его обновление разрешено
if ( IsContactMra(hContact) && !db_get_b(hContact, "CList", "NotOnList", 0) && getDword(hContact, "HooksLocked", FALSE) == FALSE) {
- DWORD dwContactFlag;
-
if ( !strcmp(cws->szModule, "CList")) {
// MyHandle setting
if ( !strcmp(cws->szSetting, "MyHandle")) {
@@ -482,27 +480,15 @@ int CMraProto::MraDbSettingChanged(WPARAM wParam, LPARAM lParam) wszGroup = ptrW( mir_a2u_cp(cws->value.pszVal, MRA_CODE_PAGE));
break;
}
- if (wszGroup.GetLength())
- MraMoveContactToGroup(hContact, getDword("GroupID", -1), wszGroup);
- }
- // NotOnList setting. Has a temporary contact just been added permanently?
- else if ( !strcmp(cws->szSetting, "NotOnList")) {
- if (cws->value.type == DBVT_DELETED || (cws->value.type == DBVT_BYTE && cws->value.bVal == 0)) {
- CMStringW wszAuthMessage;
- if ( !mraGetStringW(NULL, "AuthMessage", wszAuthMessage))
- wszAuthMessage = TranslateW(MRA_DEFAULT_AUTH_MESSAGE);
-
- db_unset(hContact, "CList", "Hidden");
-
- CMStringA szEmail, szPhones;
- CMStringW wszNick;
- DWORD dwGroupID, dwContactFlag;
- GetContactBasicInfoW(hContact, NULL, &dwGroupID, &dwContactFlag, NULL, NULL, &szEmail, &wszNick, &szPhones);
- MraAddContact(hContact, dwContactFlag, dwGroupID, szEmail, wszNick, &szPhones, &wszAuthMessage);
+ if (wszGroup.GetLength()) {
+ DWORD dwGroupID = getDword("GroupID", -1);
+ if (dwGroupID != -1)
+ MraMoveContactToGroup(hContact, dwGroupID, wszGroup);
}
}
// Hidden setting
else if ( !strcmp(cws->szSetting, "Hidden")) {
+ DWORD dwContactFlag = GetContactFlags(hContact);
if (cws->value.type == DBVT_DELETED || (cws->value.type == DBVT_BYTE && cws->value.bVal == 0))
dwContactFlag &= ~CONTACT_FLAG_SHADOW;
else
@@ -514,6 +500,7 @@ int CMraProto::MraDbSettingChanged(WPARAM wParam, LPARAM lParam) // Ignore section
else if ( !strcmp(cws->szModule, "Ignore")) {
if ( !strcmp(cws->szSetting, "Mask1")) {
+ DWORD dwContactFlag = GetContactFlags(hContact);
if (cws->value.type == DBVT_DELETED || (cws->value.type == DBVT_DWORD && cws->value.dVal&IGNOREEVENT_MESSAGE) == 0)
dwContactFlag &= ~CONTACT_FLAG_IGNORE;
else
|