diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-09 06:06:01 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-09 06:06:01 +0300 |
commit | 5b66750e1759aef824fab28d8e36f349bc060f20 (patch) | |
tree | c2497c4cc8a78c493015b768e4ffa389c85fc807 | |
parent | fc6b9e74816401ad364ff0e675767a30c84d9896 (diff) |
metacontacts ....
-rw-r--r-- | constants.h | 1 | ||||
-rw-r--r-- | messages.cpp | 104 | ||||
-rw-r--r-- | metacontacts.cpp | 33 | ||||
-rw-r--r-- | metacontacts.h | 7 | ||||
-rw-r--r-- | new_gpg.rc | 3 | ||||
-rw-r--r-- | options.cpp | 22 | ||||
-rw-r--r-- | srmm.cpp | 2 | ||||
-rw-r--r-- | utilities.cpp | 75 |
8 files changed, 203 insertions, 44 deletions
diff --git a/constants.h b/constants.h index 8d853d1..be76946 100644 --- a/constants.h +++ b/constants.h @@ -1,4 +1,5 @@ #ifndef CONSTANTS_H #define CONSTANTS_H #define szGPGModuleName "GPG" +#define PREF_METANODB 0x2000 #endif diff --git a/messages.cpp b/messages.cpp index ed2108f..6513867 100644 --- a/messages.cpp +++ b/messages.cpp @@ -22,7 +22,6 @@ HANDLE new_key_hcnt = NULL; boost::mutex new_key_hcnt_mutex; bool _terminate = false; -BOOL isProtoMetaContacts(HANDLE hContact); int RecvMsgSvc(WPARAM w, LPARAM l) { @@ -36,8 +35,8 @@ int RecvMsgSvc(WPARAM w, LPARAM l) if (!msg) return CallService(MS_PROTO_CHAINRECV, w, l); HANDLE hContact = ccs->hContact; - if(isProtoMetaContacts(hContact)) - hContact = metaGetMostOnline(hContact); +// if(isProtoMetaContacts(hContact)) +// hContact = metaGetMostOnline(hContact); { //check for gpg related data @@ -92,7 +91,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) void setSrmmIcon(HANDLE); void setClistIcon(HANDLE); bool isContactHaveKey(HANDLE hContact); - if(!DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)) + if(!DBGetContactSettingByte(metaGetCurrent(hContact), szGPGModuleName, "GPGEncryption", 0)) { debuglog<<"info: "<<"received message from: "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)<<" whith tyrned off encryption\n"; if(MessageBox(0, _T("We received encrypted message from contact with encryption turned off.\nDo you want turn on encryption for this contact ?"), _T("Warning"), MB_YESNO) == IDYES) @@ -108,13 +107,13 @@ int RecvMsgSvc(WPARAM w, LPARAM l) } else { - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); + DBWriteContactSettingByte(metaGetCurrent(hContact), szGPGModuleName, "GPGEncryption", 1); setSrmmIcon(hContact); setClistIcon(hContact); } if(isContactHaveKey(hContact)) { - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); + DBWriteContactSettingByte(metaGetCurrent(hContact), szGPGModuleName, "GPGEncryption", 1); setSrmmIcon(hContact); setClistIcon(hContact); } @@ -144,7 +143,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) wstring cmd; cmd += _T("--batch "); { - char *inkeyid = UniGetContactSettingUtf(hContact, szGPGModuleName, "InKeyID", ""); + char *inkeyid = UniGetContactSettingUtf(metaGetCurrent(hContact), szGPGModuleName, "InKeyID", ""); TCHAR *pass = NULL; if(strlen(inkeyid) > 0) { @@ -221,7 +220,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) s = out.find(" ID ", s); s += strlen(" ID "); string::size_type s2 = out.find(",",s); - DBWriteContactSettingString(hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); + DBWriteContactSettingString(metaGetCurrent(hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); } void ShowLoadKeyPasswordWindow(); new_key_hcnt_mutex.lock(); @@ -341,14 +340,27 @@ int RecvMsgSvc(WPARAM w, LPARAM l) str.append(inclosetag); } pre->szMessage = mir_utf8encodeW(str.c_str()); + if(metaIsSubcontact(hContact)) + { + char *msg = mir_utf8encodeW(str.c_str()); + HistoryLog(hContact, msg, EVENTTYPE_MESSAGE, DBEF_UTF); + mir_free(msg); + return 1; + } return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs); } } } } } - if(DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)) + if(DBGetContactSettingByte(metaGetCurrent(hContact), szGPGModuleName, "GPGEncryption", 0)) { + if(metaIsSubcontact(hContact)) + { + HistoryLog(hContact, msg, EVENTTYPE_MESSAGE, DBEF_UTF); + mir_free(msg); + return 1; + } wchar_t *tmp = mir_utf8decodeW(msg); wstring str = tmp; mir_free(tmp); @@ -358,7 +370,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) } return CallService(MS_PROTO_CHAINRECV, w, l); } - +list<string*> msgs_to_ignore; int SendMsgSvc(WPARAM w, LPARAM l) { CCSDATA *ccs = (CCSDATA*)l; @@ -368,11 +380,14 @@ int SendMsgSvc(WPARAM w, LPARAM l) char *msg = (char*)(ccs->lParam); if (!msg) return CallService(MS_PROTO_CHAINSEND, w, l); + if(strstr(msg,"-----BEGIN PGP MESSAGE-----")) //metecontacts .... %) + return CallService(MS_PROTO_CHAINSEND, w, l); HANDLE hContact = ccs->hContact; - if(isProtoMetaContacts(hContact)) - hContact = metaGetMostOnline(hContact); + if(metaIsProtoMetaContacts(hContact)) + return CallService(MS_PROTO_CHAINSEND, w, l); +// hContact = metaGetCurrent(hContact); if(!DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)) - return CallService(MS_PROTO_CHAINSEND, w, l); + return CallService(MS_PROTO_CHAINSEND, w, l); { //encrypt data here @@ -386,13 +401,13 @@ int SendMsgSvc(WPARAM w, LPARAM l) wstring path; extern bool bJabberAPI, bIsMiranda09; char *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", ""); - if(strlen(tmp) < 2) + if(!tmp[0]) { mir_free(tmp); HistoryLog(hContact, "Failed to encrypt message with GPG", EVENTTYPE_MESSAGE, DBEF_SENT); return CallService(MS_PROTO_CHAINSEND, w, l); } - if(!bJabberAPI || !bIsMiranda09) + if(!bJabberAPI || !bIsMiranda09) //force jabber to handle encrypted message by itself cmd += _T("--comment \"\" --no-version "); if(DBGetContactSettingByte(hContact, szGPGModuleName, "bAlwaysTrust", 0)) cmd += _T("--trust-model always "); @@ -466,6 +481,12 @@ int SendMsgSvc(WPARAM w, LPARAM l) else return 0; } + if(out.find("usage: ") != string::npos) + { + MessageBox(0, _T("Something wrong, gpg does not understand us, aborting encrypting."), _T("Warning"), MB_OK); + DeleteFile(path.c_str()); + return CallService(MS_PROTO_CHAINSEND, w, l); + } DeleteFile(path.c_str()); path.append(_T(".asc")); wfstream f(path.c_str(), std::ios::in | std::ios::ate | std::ios::binary); @@ -488,9 +509,31 @@ int SendMsgSvc(WPARAM w, LPARAM l) debuglog<<"info: Failed to encrypt message with GPG"; return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs); } + if(metaIsSubcontact(hContact)) + { //dirty hack to avoid metacontacts problem ..., this also broke filters chain + int returnNoError(HANDLE hContact); + string str_event = (char*)ccs->lParam; + msgs_to_ignore.push_back(new string(str_event)); + if(bAppendTags) + { + char *opentag = mir_utf8encodeW(outopentag); + str_event.insert(0, opentag); + mir_free(opentag); + char *closetag = mir_utf8encodeW(outclosetag); + str_event.append(closetag); + mir_free(closetag); + } + HistoryLog(hContact, (char*)str_event.c_str(), EVENTTYPE_MESSAGE, DBEF_SENT | DBEF_UTF); + HistoryLog(metaGetContact(hContact), (char*)str_event.c_str(), EVENTTYPE_MESSAGE, DBEF_SENT | DBEF_UTF); + DBWriteContactSettingByte(metaGetContact(hContact), szGPGModuleName, "MsgsForTagging", DBGetContactSettingByte(metaGetContact(hContact), szGPGModuleName, "MsgsForTagging", 0) + 1); + char *data = mir_utf8encodeW(str.c_str()); + CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)data); + mir_free(data); + return returnNoError(hContact); + } ccs->lParam = (LPARAM)mir_utf8encodeW(str.c_str()); if(bAppendTags) - DBWriteContactSettingByte(hContact, szGPGModuleName, "MsgsForTagging", DBGetContactSettingByte(ccs->hContact, szGPGModuleName, "MsgsForTagging", 0) + 1); + DBWriteContactSettingByte(hContact, szGPGModuleName, "MsgsForTagging", DBGetContactSettingByte(hContact, szGPGModuleName, "MsgsForTagging", 0) + 1); } } return CallService(MS_PROTO_CHAINSEND, w, l); @@ -498,20 +541,39 @@ int SendMsgSvc(WPARAM w, LPARAM l) int HookSendMsg(WPARAM w, LPARAM l) { + if(!l) + return 0; + DBEVENTINFO * dbei = (DBEVENTINFO*)l; + if((dbei->eventType == EVENTTYPE_MESSAGE) && (dbei->flags & DBEF_SENT)) + { + if(strstr((char*)dbei->pBlob, "-----BEGIN PGP MESSAGE-----")) //grrrr! + return 1; + if(!msgs_to_ignore.empty()) + { + for(list<string*>::iterator p = msgs_to_ignore.begin(); p != msgs_to_ignore.end(); p++) + { + if(!strcmp((*p)->c_str(), (char*)dbei->pBlob)) + { + delete *p; + msgs_to_ignore.remove(*p); + return 1; + } + } + } + } HANDLE hContact = (HANDLE)w; - if(isProtoMetaContacts(hContact)) - hContact = metaGetMostOnline(hContact); + + + if(metaIsProtoMetaContacts(hContact)) + hContact = metaGetCurrent(hContact); if(!DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)) return 0; if(bAppendTags) { - if(!l) - return 0; BYTE Msgs = DBGetContactSettingByte(hContact, szGPGModuleName, "MsgsForTagging", 0); if(!Msgs) return 0; - DBEVENTINFO * dbei = (DBEVENTINFO*)l; if((dbei->eventType == EVENTTYPE_MESSAGE) && (dbei->flags & DBEF_SENT)) { char *msg = (char*)dbei->pBlob; diff --git a/metacontacts.cpp b/metacontacts.cpp index 6c49411..b0eb8bf 100644 --- a/metacontacts.cpp +++ b/metacontacts.cpp @@ -18,7 +18,7 @@ extern bool bMetaContacts; -BOOL isProtoMetaContacts(HANDLE hContact) +bool metaIsProtoMetaContacts(HANDLE hContact) { if(bMetaContacts) { LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); @@ -30,7 +30,7 @@ BOOL isProtoMetaContacts(HANDLE hContact) } -BOOL metaIsDefaultSubContact(HANDLE hContact) +bool metaIsDefaultSubContact(HANDLE hContact) { if(bMetaContacts) @@ -45,6 +45,12 @@ HANDLE metaGetContact(HANDLE hContact) return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0); return 0; } +bool metaIsSubcontact(HANDLE hContact) +{ + if(bMetaContacts) + return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0); + return false; +} HANDLE metaGetMostOnline(HANDLE hContact) @@ -54,6 +60,29 @@ HANDLE metaGetMostOnline(HANDLE hContact) return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0); return 0; } +HANDLE metaGetDefault(HANDLE hContact) +{ + + if(bMetaContacts) + return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)hContact,0); + return 0; +} + +HANDLE metaGetCurrent(HANDLE hContact) +{ + bool IsOnline(HANDLE hContact); + if(bMetaContacts) + { + if(!metaIsProtoMetaContacts(hContact)) + return hContact; + HANDLE hcnt = metaGetDefault(hContact); + if(!IsOnline(hcnt)) + hcnt = metaGetMostOnline(hContact); + return hcnt; + } + return hContact; +} + DWORD metaGetContactsNum(HANDLE hContact) { diff --git a/metacontacts.h b/metacontacts.h index 8dadd81..0ac825e 100644 --- a/metacontacts.h +++ b/metacontacts.h @@ -14,9 +14,12 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -BOOL isProtoMetaContacts(HANDLE hContact); -BOOL metaIsDefaultSubContact(HANDLE hContact) ; +bool metaIsProtoMetaContacts(HANDLE hContact); +bool metaIsDefaultSubContact(HANDLE hContact) ; HANDLE metaGetContact(HANDLE hContact); +bool metaIsSubcontact(HANDLE hContact); HANDLE metaGetMostOnline(HANDLE hContact); +HANDLE metaGetDefault(HANDLE hContact); +HANDLE metaGetCurrent(HANDLE hContact); DWORD metaGetContactsNum(HANDLE hContact); HANDLE metaGetSubcontact(HANDLE hContact, int num);
\ No newline at end of file @@ -325,8 +325,7 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,175,181,10
LTEXT "Статический",IDC_CURRENT_KEY,97,196,116,8
CONTROL "Encrypt file transfers",IDC_FILE_TRANSFERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,185,137,10
- PUSHBUTTON "*Remove filters",IDC_REMOVE_FILTERS,155,135,59,14
- LTEXT "* - need restart",IDC_STATIC,222,137,52,8
+ PUSHBUTTON "Remove filters",IDC_REMOVE_FILTERS,155,135,59,14
END
IDD_OPT_GPG_BIN DIALOGEX 0, 0, 282, 214
diff --git a/options.cpp b/options.cpp index 15dffb5..7061f39 100644 --- a/options.cpp +++ b/options.cpp @@ -207,7 +207,7 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA bool ismetacontact = false; HANDLE meta = NULL; HANDLE hContact = user_data[item_num+1]; - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) { meta = hContact; hContact = metaGetMostOnline(hContact); @@ -601,7 +601,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP case WM_INITDIALOG: { HANDLE hcnt = hContact; - if(isProtoMetaContacts(hcnt)) + if(metaIsProtoMetaContacts(hcnt)) hcnt = metaGetMostOnline(hcnt); TranslateDialogDefault(hwndDlg); bool isContactSecured(HANDLE); @@ -747,7 +747,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP ws2 += _tcslen(end); bool allsubcontacts = false; { - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) { HANDLE hcnt = NULL; if(MessageBox(0, _T("Do you want load key for all subcontacts ?"), _T("Metacontact detected"), MB_YESNO) == IDYES) @@ -777,7 +777,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP DWORD exitcode; { HANDLE hcnt = hContact; - if(isProtoMetaContacts(hcnt)) + if(metaIsProtoMetaContacts(hcnt)) hcnt = metaGetMostOnline(hcnt); ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); _tcscpy(tmp2, ptmp); @@ -824,7 +824,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP mir_free(end); if(hContact) { - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) { HANDLE hcnt = NULL; if(allsubcontacts) @@ -858,7 +858,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP strcpy(tmp2, output.substr(s,s2-s).c_str()); mir_utf8decode(tmp2, 0); { - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) { HANDLE hcnt = NULL; if(allsubcontacts) @@ -899,7 +899,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP mir_utf8decode(tmp2, 0); if(hContact) { - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) { HANDLE hcnt = NULL; if(allsubcontacts) @@ -935,7 +935,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP mir_utf8decode(tmp2, 0); if(hContact) { - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) { HANDLE hcnt = NULL; if(allsubcontacts) @@ -962,7 +962,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP mir_utf8decode(tmp2, 0); if(hContact) { - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) { HANDLE hcnt = NULL; if(allsubcontacts) @@ -994,7 +994,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP mir_utf8decode(tmp2, 0); if(hContact) { - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) { HANDLE hcnt = NULL; if(allsubcontacts) @@ -1075,7 +1075,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP void setClistIcon(HANDLE); if(hContact) { - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) { HANDLE hcnt = NULL; if(allsubcontacts) @@ -34,7 +34,7 @@ int __cdecl onWindowEvent(WPARAM wParam, LPARAM lParam) { int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; - if( isProtoMetaContacts(hContact) ) + if(metaIsProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); // возьмем тот, через который пойдет сообщение StatusIconClickData *sicd = (StatusIconClickData *)lParam; diff --git a/utilities.cpp b/utilities.cpp index 70bb870..e4563ef 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -193,7 +193,7 @@ int LoadKey(WPARAM w, LPARAM l) int SendKey(WPARAM w, LPARAM l) { HANDLE hContact = (HANDLE)w; - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); char *szMessage = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); if(strlen(szMessage) > 1) @@ -214,12 +214,12 @@ int ToggleEncryption(WPARAM w, LPARAM l) { HANDLE hContact = (HANDLE)w; BYTE enc = 0; - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) enc = DBGetContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0); else enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); { - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) { HANDLE hcnt = NULL; if(MessageBox(0, _T("Do you want to toggle encryption for all subcontacts ?"), _T("Metacontact detected"), MB_YESNO) == IDYES) @@ -252,7 +252,7 @@ int ToggleEncryption(WPARAM w, LPARAM l) int OnPreBuildContactMenu(WPARAM w, LPARAM l) { HANDLE hContact = (HANDLE)w; - if(isProtoMetaContacts(hContact)) + if(metaIsProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); CLISTMENUITEM mi = {0}; mi.cbSize=sizeof(mi); @@ -767,4 +767,69 @@ void SecureIM_cleanup() if(CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)"GnuPGPlugin"))
CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)"GnuPGPlugin");
}
-}
\ No newline at end of file +}
+
+bool IsOnline(HANDLE hContact)
+{
+ if(DBGetContactSettingByte(hContact, szGPGModuleName, "Status", 0) == ID_STATUS_OFFLINE)
+ return false;
+ return true;
+}
+
+//from secureim
+#include <process.h>
+
+struct TFakeAckParams {
+ inline TFakeAckParams( HANDLE p1, HANDLE p2, LONG p3, LPCSTR p4 ) :
+ hEvent( p1 ),
+ hContact( p2 ),
+ id( p3 ),
+ msg( p4 )
+ {}
+
+ HANDLE hEvent;
+ HANDLE hContact;
+ LONG id;
+ LPCSTR msg;
+};
+
+int SendBroadcast( HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam ) {
+ ACKDATA ack;
+ memset(&ack,0,sizeof(ack));
+ ack.cbSize = sizeof( ACKDATA );
+ ack.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ ack.hContact = hContact;
+ ack.type = type;
+ ack.result = result;
+ ack.hProcess = hProcess;
+ ack.lParam = lParam;
+ return CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack );
+}
+
+
+
+unsigned __stdcall sttFakeAck( LPVOID param ) {
+
+ TFakeAckParams* tParam = ( TFakeAckParams* )param;
+ WaitForSingleObject( tParam->hEvent, INFINITE );
+
+ Sleep( 100 );
+ if ( tParam->msg == NULL )
+ SendBroadcast( tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, ( HANDLE )tParam->id, 0 );
+ else
+ SendBroadcast( tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, ( HANDLE )tParam->id, LPARAM( tParam->msg ));
+
+ CloseHandle( tParam->hEvent );
+ delete tParam;
+
+ return 0;
+}
+
+
+int returnNoError(HANDLE hContact) {
+ HANDLE hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
+ unsigned int tID;
+ CloseHandle( (HANDLE) _beginthreadex(NULL, 0, sttFakeAck, new TFakeAckParams(hEvent,hContact,777,0), 0, &tID) );
+ SetEvent( hEvent );
+ return 777;
+}
|