diff options
Diffstat (limited to 'protocols/Gadu-Gadu/gg.h')
-rw-r--r-- | protocols/Gadu-Gadu/gg.h | 194 |
1 files changed, 16 insertions, 178 deletions
diff --git a/protocols/Gadu-Gadu/gg.h b/protocols/Gadu-Gadu/gg.h index 7f247c553f..2b1157092b 100644 --- a/protocols/Gadu-Gadu/gg.h +++ b/protocols/Gadu-Gadu/gg.h @@ -34,10 +34,6 @@ #include <m_stdhdr.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
// Windows headers
// Visual C++ .NET tries to include winsock.h
// which is very ver bad
@@ -56,6 +52,7 @@ extern "C" { // Miranda IM headers
#include <newpluginapi.h>
#include <m_system.h>
+#include <m_system_cpp.h>
#include <m_database.h>
#include <m_netlib.h>
#include <m_protocols.h>
@@ -101,77 +98,26 @@ extern "C" { #include "resource.h"
// libgadu headers
+extern "C" {
#include "libgadu/libgadu.h"
#include "dynstuff.h"
+};
// Search
// Extended search result structure, used for all searches
-typedef struct
+struct GGSEARCHRESULT : public PROTOSEARCHRESULT
{
- PROTOSEARCHRESULT hdr;
uin_t uin;
-} GGSEARCHRESULT;
+};
typedef struct
{
HANDLE hThread;
- DWORD dwThreadId;
+ UINT dwThreadId;
} GGTHREAD;
typedef struct
{
- PROTO_INTERFACE proto;
- LPTSTR name;
- CRITICAL_SECTION ft_mutex, sess_mutex, img_mutex, modemsg_mutex, avatar_mutex, sessions_mutex;
- list_t watches, transfers, requests, chats, imagedlgs, avatar_requests, avatar_transfers, sessions;
- int gc_enabled, gc_id, list_remove, unicode_core, check_first_conn;
- uin_t next_uin;
- unsigned long last_crc;
- GGTHREAD pth_dcc;
- GGTHREAD pth_sess;
- GGTHREAD pth_avatar;
- struct gg_session *sess;
- struct gg_dcc *dcc;
- HANDLE event;
- HANDLE hConnStopEvent;
- SOCKET sock;
- UINT_PTR timer;
- struct
- {
- char *online;
- char *away;
- char *dnd;
- char *freechat;
- char *invisible;
- char *offline;
- } modemsg;
- HANDLE netlib,
- hookOptsInit,
- hookUserInfoInit,
- hookGCUserEvent,
- hookGCMenuBuild;
- HGENMENU hMenuRoot;
- HGENMENU hMainMenu[7];
- HANDLE hPrebuildMenuHook;
- HANDLE hBlockMenuItem;
- HANDLE hImageMenuItem;
- HANDLE hInstanceMenuItem;
- HANDLE hAvatarsFolder;
- HANDLE hImagesFolder;
- HANDLE hwndSessionsDlg;
-} GGPROTO;
-
-typedef struct
-{
- int mode;
- uin_t uin;
- char *pass;
- char *email;
- GGPROTO *gg;
-} GGUSERUTILDLGDATA;
-
-typedef struct
-{
uin_t *recipients;
int recipients_count;
char id[32];
@@ -184,18 +130,13 @@ typedef struct char val[256];
} GGTOKEN;
-// GG Thread Function
-typedef void (__cdecl GGThreadFunc)(void*, void*);
-
#if 0 /* #ifdef DEBUGMODE */
-#define EnterCriticalSection(lpCS) {gg_netlog(gg,"EnterCriticalSection @ %s:%d", __FILE__, __LINE__); EnterCriticalSection(lpCS);}
-#define LeaveCriticalSection(lpCS) {gg_netlog(gg,"LeaveCriticalSection @ %s:%d", __FILE__, __LINE__); LeaveCriticalSection(lpCS);}
+#define EnterCriticalSection(lpCS) {netlog(gg,"EnterCriticalSection @ %s:%d", __FILE__, __LINE__); EnterCriticalSection(lpCS);}
+#define LeaveCriticalSection(lpCS) {netlog(gg,"LeaveCriticalSection @ %s:%d", __FILE__, __LINE__); LeaveCriticalSection(lpCS);}
#endif
// Wrappers of the old interface
-#define GG_PROTO (gg->proto.m_szModuleName)
-#define GG_PROTONAME (gg->name)
#define GGDEF_PROTO "GG" // Default Proto
#define GGDEF_PROTONAME "Gadu-Gadu" // Default ProtoName
@@ -338,7 +279,7 @@ typedef void (__cdecl GGThreadFunc)(void*, void*); #define GG_POPUP_WARNING 8
#define GG_POPUP_MULTILOGON 16
-#define LocalEventUnhook(hook) if(hook) UnhookEvent(hook)
+#define LocalEventUnhook(hook) if (hook) UnhookEvent(hook)
// Some MSVC compatibility with gcc
#ifdef _MSC_VER
@@ -356,6 +297,7 @@ typedef void (__cdecl GGThreadFunc)(void*, void*); extern HINSTANCE hInstance;
extern CLIST_INTERFACE *pcli;
extern list_t g_Instances;
+extern PLUGININFOEX pluginInfo;
// Screen saver
#ifndef SPI_GETSCREENSAVERRUNNING
@@ -368,80 +310,14 @@ extern list_t g_Instances; /* Helper functions */
const char *http_error_string(int h);
unsigned long crc_get(char *mem);
-int status_m2gg(GGPROTO *gg, int status, int descr);
-int status_gg2m(GGPROTO *gg, int status);
+int gg_normalizestatus(int status);
char *gg_status2db(int status, const char *suffix);
-char *ws_strerror(int code);
+TCHAR *ws_strerror(int code);
uint32_t swap32(uint32_t x);
const char *gg_version2string(int v);
-void gg_checknewuser(GGPROTO* gg, uin_t uin, const char* passwd);
-
-/* Thread functions */
-void gg_forkthread(GGPROTO *gg, GGThreadFunc pFunc, void *param);
-HANDLE gg_forkthreadex(GGPROTO *gg, GGThreadFunc pFunc, void *param, UINT *threadId);
-void gg_threadwait(GGPROTO *gg, GGTHREAD *thread);
-
-/* Global GG functions */
-void gg_notifyuser(GGPROTO *gg, HANDLE hContact, int refresh);
-void gg_setalloffline(GGPROTO *gg);
-void gg_disconnect(GGPROTO *gg);
-HANDLE gg_getcontact(GGPROTO *gg, uin_t uin, int create, int inlist, char *nick);
-void gg_registerservices(GGPROTO *gg);
-void __cdecl gg_mainthread(GGPROTO *gg, void *empty);
-int gg_isonline(GGPROTO *gg);
-int gg_refreshstatus(GGPROTO *gg, int status);
-
-void gg_broadcastnewstatus(GGPROTO *gg, int newStatus);
-int gg_contactdeleted(GGPROTO *gg, WPARAM wParam, LPARAM lParam);
-int gg_dbsettingchanged(GGPROTO *gg, WPARAM wParam, LPARAM lParam);
-void gg_notifyall(GGPROTO *gg);
-void gg_changecontactstatus(GGPROTO *gg, uin_t uin, int status, const char *idescr, int time, uint32_t remote_ip, uint16_t remote_port, uint32_t version);
-char *gg_getstatusmsg(GGPROTO *gg, int status);
-void gg_dccstart(GGPROTO *gg);
-void gg_dccconnect(GGPROTO *gg, uin_t uin);
-int gg_gettoken(GGPROTO *gg, GGTOKEN *token);
-void gg_parsecontacts(GGPROTO *gg, char *contacts);
-int gg_getinfo(PROTO_INTERFACE *proto, HANDLE hContact, int infoType);
-void gg_remindpassword(GGPROTO *gg, uin_t uin, const char *email);
-void *gg_img_loadpicture(GGPROTO *gg, struct gg_event* e, char *szFileName);
-int gg_img_releasepicture(void *img);
-int gg_img_display(GGPROTO *gg, HANDLE hContact, void *img);
-int gg_img_displayasmsg(GGPROTO *gg, HANDLE hContact, void *img);
-int gg_event(PROTO_INTERFACE *proto, PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam);
/* Avatar functions */
-void gg_getavatarfilename(GGPROTO *gg, HANDLE hContact, char *pszDest, int cbLen);
char *gg_avatarhash(char *param);
-void gg_getavatar(GGPROTO *gg, HANDLE hContact, char *szAvatarURL);
-void gg_requestavatar(GGPROTO *gg, HANDLE hContact, int iWaitFor);
-void gg_initavatarrequestthread(GGPROTO *gg);
-void gg_uninitavatarrequestthread(GGPROTO *gg);
-void gg_getuseravatar(GGPROTO *gg);
-void gg_setavatar(GGPROTO *gg, const char *szFilename);
-INT_PTR gg_getavatarinfo(GGPROTO *gg, WPARAM wParam, LPARAM lParam);
-
-/* File transfer functions */
-HANDLE gg_fileallow(PROTO_INTERFACE *proto, HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath);
-int gg_filecancel(PROTO_INTERFACE *proto, HANDLE hContact, HANDLE hTransfer);
-int gg_filedeny(PROTO_INTERFACE *proto, HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason);
-int gg_recvfile(PROTO_INTERFACE *proto, HANDLE hContact, PROTOFILEEVENT* pre);
-HANDLE gg_sendfile(PROTO_INTERFACE *proto, HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles);
-
-/* Import module */
-void gg_import_init(GGPROTO *gg, HGENMENU hRoot);
-
-/* Keep-alive module */
-void gg_keepalive_init(GGPROTO *gg);
-void gg_keepalive_destroy(GGPROTO *gg);
-
-/* Image reception functions */
-int gg_img_init(GGPROTO *gg);
-int gg_img_destroy(GGPROTO *gg);
-int gg_img_shutdown(GGPROTO *gg);
-INT_PTR gg_img_recvimage(GGPROTO *gg, WPARAM wParam, LPARAM lParam);
-INT_PTR gg_img_sendimage(GGPROTO *gg, WPARAM wParam, LPARAM lParam);
-int gg_img_sendonrequest(GGPROTO *gg, struct gg_event* e);
-BOOL gg_img_opened(GGPROTO *gg, uin_t uin);
/* IcoLib functions */
void gg_icolib_init();
@@ -455,50 +331,12 @@ void WindowFreeIcon(HWND hWnd); void gg_links_instancemenu_init();
void gg_links_init();
void gg_links_destroy();
-void gg_links_instance_init(GGPROTO* gg);
-
-/* OAuth functions */
-char *gg_oauth_header(GGPROTO *gg, const char *httpmethod, const char *url);
-int gg_oauth_checktoken(GGPROTO *gg, int force);
-
-/* UI page initializers */
-int gg_options_init(GGPROTO *gg, WPARAM wParam, LPARAM lParam);
-int gg_details_init(GGPROTO *gg, WPARAM wParam, LPARAM lParam);
-
-/* Groupchat functions */
-int gg_gc_init(GGPROTO *gg);
-void gg_gc_menus_init(GGPROTO *gg, HGENMENU hRoot);
-int gg_gc_destroy(GGPROTO *gg);
-char * gg_gc_getchat(GGPROTO *gg, uin_t sender, uin_t *recipients, int recipients_count);
-GGGC *gg_gc_lookup(GGPROTO *gg, char *id);
-int gg_gc_changenick(GGPROTO *gg, HANDLE hContact, char *pszNick);
-#define UIN2ID(uin,id) _itoa(uin,id,10)
-
-/* Popups functions */
-void gg_initpopups(GGPROTO* gg);
-void gg_showpopup(GGPROTO* gg, const char* nickname, const char* msg, int flags);
-/* Sessions functions */
-INT_PTR gg_sessions_view(GGPROTO* gg, WPARAM wParam, LPARAM lParam);
-void gg_sessions_updatedlg(GGPROTO* gg);
-BOOL gg_sessions_closedlg(GGPROTO* gg);
-void gg_sessions_menus_init(GGPROTO* gg, HGENMENU hRoot);
-
-/* Event helpers */
-#define HookProtoEvent(name, func, proto) HookEventObj(name, (MIRANDAHOOKOBJ)func, proto)
-#define CreateProtoServiceFunction(name, func, proto) CreateServiceFunctionObj(name, (MIRANDASERVICEOBJ)func, proto)
-typedef INT_PTR (*GGPROTOFUNC)(GGPROTO*,WPARAM,LPARAM);
-void CreateProtoService(const char* szService, GGPROTOFUNC serviceProc, GGPROTO *gg);
-
-/* ANSI <-> Unicode conversion helpers */
-#define gg_a2t(s) gg->unicode_core ? (TCHAR *)mir_a2u(s) : (TCHAR *)mir_strdup(s)
-#define gg_t2a(s) gg->unicode_core ? mir_u2a((wchar_t *)s) : mir_strdup(s)
+#define UIN2ID(uin,id) _itoa(uin,id,10)
// Debug functions
-int gg_netlog(const GGPROTO *gg, const char *fmt, ...);
-const char *ggdebug_eventtype(struct gg_event *e);
+const char *ggdebug_eventtype(gg_event *e);
+
+#include "gg_proto.h"
-#ifdef __cplusplus
-}
-#endif
#endif
|