diff options
Diffstat (limited to 'protocols/MRA/src')
-rw-r--r-- | protocols/MRA/src/MraProto.cpp | 20 | ||||
-rw-r--r-- | protocols/MRA/src/MraSendCommand.cpp | 12 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_proto.cpp | 12 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_svcs.cpp | 16 |
4 files changed, 31 insertions, 29 deletions
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index b2252970ac..9e1a5b104c 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -163,25 +163,11 @@ HANDLE CMraProto::AddToListByEmail(LPCTSTR plpsEMail, LPCTSTR plpsNick, LPCTSTR if (dwFlags & PALF_TEMPORARY)
db_set_b(hContact, "CList", "Hidden", 1);
- else {
- db_unset(hContact, "CList", "Hidden");
+ else
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);
-
- MraUpdateContactInfo(hContact); // request info update
- }
+ if (bAdded)
+ MraUpdateContactInfo(hContact);
return hContact;
}
diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 6f279c6e49..cd6b204a0d 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -190,6 +190,8 @@ DWORD CMraProto::MraAddContact(HANDLE hContact, DWORD dwContactFlag, DWORD dwGro return 0;
dwContactFlag |= CONTACT_FLAG_UNICODE_NAME;
+ if (dwGroupID == -1)
+ dwGroupID = 0;
OutBuffer buf;
buf.SetUL(dwContactFlag);
@@ -213,9 +215,6 @@ DWORD CMraProto::MraAddContact(HANDLE hContact, DWORD dwContactFlag, DWORD dwGro // change contact
DWORD CMraProto::MraModifyContact(HANDLE hContact, DWORD *pdwID, DWORD *pdwContactFlag, DWORD *pdwGroupID, const CMStringA *pszEmail, const CMStringW *pwszCustomName, const CMStringA *pszPhones)
{
- if (pdwID && *pdwID == -1)
- return 0;
-
CMStringA szEmail, szPhones;
CMStringW wszNick, wszCustomName;
DWORD dwID, dwGroupID, dwContactFlag;
@@ -225,17 +224,18 @@ DWORD CMraProto::MraModifyContact(HANDLE hContact, DWORD *pdwID, DWORD *pdwConta dwID = dwGroupID = dwContactFlag = 0;
if (pdwID) dwID = *pdwID;
+ if (dwID == -1)
+ return 0;
+
if (pszEmail) szEmail = *pszEmail;
if (pszPhones) szPhones = *pszPhones;
if (pdwGroupID) dwGroupID = *pdwGroupID;
if (pdwContactFlag) dwContactFlag = *pdwContactFlag;
if (pwszCustomName) wszCustomName = *pwszCustomName;
- dwContactFlag |= CONTACT_FLAG_UNICODE_NAME;
-
OutBuffer buf;
buf.SetUL(dwID);
- buf.SetUL(dwContactFlag);
+ buf.SetUL(dwContactFlag | CONTACT_FLAG_UNICODE_NAME);
buf.SetUL(dwGroupID);
buf.SetLPSLowerCase(szEmail);
buf.SetLPSW(wszCustomName);
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 9af85b3299..a7ac12db4f 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 dwFlags = getDword(hContact, "ContactServerFlags", 0);
- if (dwFlags & CONTACT_INTFLAG_NOT_AUTHORIZED) {
- dwFlags &= ~CONTACT_INTFLAG_NOT_AUTHORIZED;
- setDword(hContact, "ContactServerFlags", dwFlags);
- }
-
+ 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);
db_unset(hContact, "CList", "NotOnList");
+ setDword(hContact, "HooksLocked", FALSE);
return true;
}
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 670a8ae86f..33c7084157 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -486,6 +486,22 @@ int CMraProto::MraDbSettingChanged(WPARAM wParam, LPARAM lParam) MraMoveContactToGroup(hContact, dwGroupID, 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);
+ }
+ }
// Hidden setting
else if ( !strcmp(cws->szSetting, "Hidden")) {
DWORD dwContactFlag = GetContactFlags(hContact);
|