1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
// ---------------------------------------------------------------------------
// Contacts+ for Miranda Instant Messenger
// _______________________________________
//
// Copyright © 2002 Dominus Procellarum
// Copyright © 2004-2008 Joe Kucera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// ---------------------------------------------------------------------------
#ifndef __SEND_H
#define __SEND_H
#define TIMERID_MSGSEND 1024
#define TIMEOUT_MSGSEND 9000 //ms
#define HM_EVENTSENT (WM_USER+10)
#define DM_ERRORDECIDED (WM_USER+18)
#define DM_UPDATETITLE (WM_USER+11)
#define MSGERROR_CANCEL 0
#define MSGERROR_RETRY 1
#define MSGERROR_DONE 2
#define IDI_ADDCONTACT 210
#define IDI_USERDETAILS 160
#define IDI_HISTORY 174
#define IDI_DOWNARROW 264
struct TSendProcessList {
int Count;
HANDLE* Items;
CRITICAL_SECTION lock;
void Add(HANDLE hProcc);
void Remove(HANDLE hProcc);
TSendProcessList();
~TSendProcessList();
};
struct TSendContactsData { // hope uack is released automaticly, static property
HANDLE hHook; // hook to event
void HookProtoAck(HWND hwndDlg);
void UnhookProtoAck();
HANDLE* aContacts; // contacts to be sent
int nContacts; // now many UIDs shall we send?
void ClearContacts();
void AddContact(HANDLE hContact);
HANDLE hContact; // to whom shall we send?
TSendProcessList uacklist;// ackdata - necessary for errorbox
HWND hError; // handle of error box, if any
void ShowErrorDlg(HWND hwndDlg, char* szMsg, bool bAllowRetry);
int SendContactsPacket(HWND hwndDlg, HANDLE *phContacts, int nContacts);
int SendContacts(HWND hwndDlg);
HICON hIcons[4]; // icons for dialog
TSendContactsData(HANDLE contact);
~TSendContactsData();
};
struct TAckData {
HANDLE hContact; // to whom was it sent
HANDLE* aContacts; // obj
int nContacts; // how many
TAckData(HANDLE contact) { hContact = contact; aContacts = NULL; nContacts = 0;};
~TAckData() { if (nContacts) SAFE_FREE((void**)&aContacts); }
};
typedef TAckData* PAckData;
struct TCTSend {
char* mcaUIN;
unsigned char* mcaNick;
};
struct gAckItem { // some shit here
HANDLE hProcc;
PAckData ackData;
gAckItem(HANDLE procC, PAckData aData) { ackData=aData; hProcc=procC; };
~gAckItem() { /*delete ackData;*/ };
};
struct gAckList {
gAckItem** Items;
int Count;
TAckData* Get(HANDLE hProcc) { for (int i=0; i<Count; i++) if (Items[i]->hProcc==hProcc) { return Items[i]->ackData; }; return NULL; };
TAckData* Add(HANDLE hProcc, TAckData* ackData) { Items=(gAckItem**)realloc(Items, (Count+1)*sizeof(gAckItem*)); Items[Count]=new gAckItem(hProcc, ackData); Count++; return ackData; };
TAckData* Remove(HANDLE hProcc) { for (int i=0; i<Count; i++) if (Items[i]->hProcc==hProcc) { TAckData* data=Items[i]->ackData; delete Items[i]; memmove(Items+i, Items+i+1, (Count-i-1)*sizeof(gAckItem*)); Count--; return data; }; return NULL; };
gAckList() { Count = 0; Items = NULL; }
~gAckList() { if (Count) { for (int i=0; i<Count; i++) delete Items[i]; SAFE_FREE((void**)&Items); }; }
};
extern HANDLE ghSendWindowList;
extern gAckList gaAckData;
INT_PTR CALLBACK SendDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
#endif /* __SEND_H */
|