summaryrefslogtreecommitdiff
path: root/protocols/Sametime/src/sametime.h
blob: ccf1c920e8cc8cc91463f555d4191fea81240d86 (plain)
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
111
112
113
114
115
116
117
118
119
120
121
#ifndef _SAMETIME_H
#define _SAMETIME_H


//sametime defines

#define FILE_BUFF_SIZE					(1024 * 32)

#define MS_SAMETIME_MENULEAVECHAT		"/LeaveChat"
#define MS_SAMETIME_MENUCREATECHAT		"/CreateChat"

#define MAX_MESSAGE_SIZE				(10 * 1024)				// verified limit in official client, thx Periferral

#define LSTRINGLEN						256

#define DEFAULT_PORT					1533

#define WMU_STORECOMPLETE				(WM_USER + 110)



typedef enum {SAMETIME_POPUP_ERROR = 1, SAMETIME_POPUP_INFO = 2 } SametimePopupEnum;
typedef enum {ED_MB = 1, ED_POP = 2, ED_BAL = 3} ErrorDisplay;
typedef enum {CPT_USER, CPT_ANSI, CPT_UTF8, CPT_OEM, CPT_UTF7} CodePageType;



//stl typedef's
typedef std::queue<std::string> InviteQueue;					///for conference.cpp
typedef std::queue<std::string> MessageQueue;					///for messaging.cpp
typedef std::map<MCONTACT, MessageQueue> ContactMessageQueue;	///for messaging.cpp


//protocol includes
#include "resource.h"


//methods
INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK CALLBACK SearchDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code, GList* results, gpointer data);

void SametimeInitIcons(void);
HANDLE GetIconHandle(int iconId);
HICON LoadIconEx(const char* name, bool big);
void ReleaseIconEx(const char* name, bool big);


// services (async thread functions)
struct TFakeAckParams
{
	struct CSametimeProto* proto;
	MCONTACT hContact;
	LPARAM lParam;
};

void __cdecl sttFakeAckInfoSuccessThread(TFakeAckParams* tParam);
void __cdecl sttFakeAckMessageFailedThread(TFakeAckParams* tParam);
void __cdecl sttFakeAckMessageSuccessThread(TFakeAckParams* tParam);
void __cdecl sttRecvAwayThread(TFakeAckParams* tParam);


//sametime structs

typedef struct Options_tag {
	char server_name[LSTRINGLEN]; // utf8
	char id[LSTRINGLEN];          // utf8
	char pword[LSTRINGLEN];       // utf8
	int port;
	bool get_server_contacts;
	int client_id;
	int client_versionMajor;
	int client_versionMinor;
	ErrorDisplay err_method;
	bool add_contacts;
	bool encrypt_session;
	bool idle_as_away;
} SametimeOptions;

struct MYPROTOSEARCHRESULT : public PROTOSEARCHRESULT
{
	char name[256];
	char stid[256];
	bool group;
};

struct MYCUSTOMSEARCHRESULTS : public CUSTOMSEARCHRESULTS
{
	char name[256];
	char stid[256];
	bool group;
};

typedef struct FileTransferClientData_tag {
	char* save_path;
	HANDLE hFile;
	bool sending;
	MCONTACT hContact;
	struct FileTransferClientData_tag* first;
	struct FileTransferClientData_tag* next;
	HANDLE hFt;
	char* buffer;
	int ft_number;
	int ft_count;	// number of nodes in list - only valid in first node
	int totalSize;	// total for all files in the list - only valid in first node
	int sizeToHere;	// in a link list of file transfers, the sum of the filesizes of all prior nodes in the list
	mwFileTransfer* ft;
} FileTransferClientData;



// Global variables
struct CSametimeProto;

extern PLUGININFOEX pluginInfo;

#include "sametime_proto.h"


#endif //#ifndef _SAMETIME_H