summaryrefslogtreecommitdiff
path: root/messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'messages.cpp')
-rw-r--r--messages.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/messages.cpp b/messages.cpp
index 38205cb..c4a890d 100644
--- a/messages.cpp
+++ b/messages.cpp
@@ -29,15 +29,25 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
return CallService(MS_PROTO_CHAINRECV, w, l);
bool unicode = (bool)(pre->flags&PREF_UNICODE);
- { //check for public key
- string str = msg;
- string::size_type s1, s2;
- if(((s2 = str.find("-----END PGP PUBLIC KEY BLOCK-----")) != string::npos) && ((s1 = str.find("-----BEGIN PGP PUBLIC KEY BLOCK-----")) != string::npos))
+ { //check for gpg related data
+ wchar_t *tmp = mir_utf8decodeW(msg);
+ wstring str = tmp;
+ mir_free(tmp);
+ wstring::size_type s1, s2;
+
+ if(((s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) != wstring::npos) && ((s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) != wstring::npos))
{ //this is public key
}
- else if(((s2 = str.find("-/ENCRYPTED-")) != string::npos) && ((s1 = str.find("-ENCRYPTED-")) != string::npos))
- { //this is encrypted data block
+ else if(((s2 = str.find(_T("-/ENCRYPTED-"))) != wstring::npos) && ((s1 = str.find(_T("-ENCRYPTED-"))) != wstring::npos))
+ { //this is generic encrypted data block
+ }
+ else if(((s1 = str.find(_T("<body>This message is encrypted.</body>"))) != wstring::npos))
+ { //this is jabber encrypted data
}
+
+ char *utf = mir_utf8encodeW(str.c_str()); //for later usage
+ mir_free(utf);
+
}
return CallService(MS_PROTO_CHAINRECV, w, l);
@@ -48,10 +58,23 @@ int SendMsgSvc(WPARAM w, LPARAM l)
CCSDATA *ccs = (CCSDATA*)l;
if (!ccs)
return CallService(MS_PROTO_CHAINSEND, w, l);
+ if(!DBGetContactSettingByte(ccs->hContact, szModuleName, "GPGEncryption", 0))
+ return CallService(MS_PROTO_CHAINSEND, w, l);
+
char *msg = (char*)(ccs->lParam);
if (!msg)
return CallService(MS_PROTO_CHAINSEND, w, l);
bool unicode = (bool)(ccs->wParam&PREF_UNICODE);
+ { //encrypt data here
+ wchar_t *tmp = mir_utf8decodeW(msg);
+ wstring str = tmp;
+ mir_free(tmp);
+ wstring::size_type s1, s2;
+
+ char *utf = mir_utf8encodeW(str.c_str()); //for later usage
+ mir_free(utf);
+ }
+
return CallService(MS_PROTO_CHAINSEND, w, l);
} \ No newline at end of file