summaryrefslogtreecommitdiff
path: root/utilities.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2012-02-29 04:51:39 +0200
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2012-02-29 04:51:39 +0200
commitd35323eee127f7bbf3d76952f8640a996101284d (patch)
tree52bf01d260e2d34ab04160e65b37713f50c046f2 /utilities.cpp
parenta45e3de7abee4256f415b9bb6b21d8c313d39390 (diff)
psi gpg error handling code (not working)
Diffstat (limited to 'utilities.cpp')
-rwxr-xr-xutilities.cpp57
1 files changed, 56 insertions, 1 deletions
diff --git a/utilities.cpp b/utilities.cpp
index b651558..efebcfb 100755
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -970,6 +970,61 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi
static JABBER_HANDLER_FUNC MessageHandler(IJabberInterface *ji, HXML node, void *pUserData)
{
+ HXML local_node = node;
+ HANDLE hContact = NULL;
+ for(int n = 0; n <= xi.getChildCount(node); n++)
+ {
+ LPCTSTR str = xi.getText(local_node);
+ LPCTSTR nodename = xi.getName(local_node);
+ if(nodename)
+ {
+ if(!_tcscmp(nodename, _T("message")))
+ {
+ for(int n = 0; n < xi.getAttrCount(local_node); n++)
+ {
+ LPCTSTR name = xi.getAttrName(local_node, n);
+ LPCTSTR value = xi.getAttrValue(local_node, name);
+ if(!_tcscmp(name, _T("from")))
+ {
+ hContact = ji->Sys()->ContactFromJID(value);
+ if(!hContact)
+ return FALSE;
+ }
+ if(!_tcscmp(name, _T("type")))
+ {
+ if(_tcscmp(value, _T("error")))
+ return FALSE;
+ }
+ }
+ }
+ if(!_tcscmp(nodename, _T("error")))
+ {
+ for(int n = 0; n < xi.getAttrCount(local_node); n++)
+ {
+ LPCTSTR name = xi.getAttrName(local_node, n);
+ LPCTSTR value = xi.getAttrValue(local_node, name);
+ if(!_tcscmp(name, _T("type")))
+ {
+ if(_tcscmp(value, _T("modify")))
+ return FALSE;
+ }
+ if(!_tcscmp(name, _T("code")))
+ {
+ if(_tcscmp(value, _T("406")))
+ return FALSE;
+ }
+ }
+ }
+ if(!_tcscmp(nodename, _T("text")))
+ {
+ LPCTSTR msg = xi.getText(local_node);
+ if(hContact)
+ HistoryLog(hContact, (char*)toUTF8(msg).c_str());
+ return FALSE;
+ }
+ }
+ local_node = xi.getChild(node, n);
+ }
return FALSE;
}
@@ -989,7 +1044,7 @@ void AddHandlers()
if((*p)->getPrescenseHandler() == INVALID_HANDLE_VALUE)
(*p)->setPrescenseHandler((*p)->getJabberInterface()->Net()->AddPresenceHandler((JABBER_HANDLER_FUNC)PrescenseHandler));
if((*p)->getMessageHandler() == INVALID_HANDLE_VALUE)
- (*p)->setMessageHandler((*p)->getJabberInterface()->Net()->AddMessageHandler((JABBER_HANDLER_FUNC)MessageHandler, JABBER_MESSAGE_TYPE_ERROR,0 ,0));
+ (*p)->setMessageHandler((*p)->getJabberInterface()->Net()->AddMessageHandler((JABBER_HANDLER_FUNC)MessageHandler, JABBER_MESSAGE_TYPE_ANY ,NULL,NULL));
if(bAutoExchange)
{
(*p)->getJabberInterface()->Net()->RegisterFeature(_T("GPG_Key_Auto_Exchange:0"), _T("Indicates that gpg installed and configured to public key auto exchange (currently implemented in new_gpg Miranda IM plugin)"));