summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-06-13 21:09:27 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-06-13 21:09:27 +0300
commitf7fdb4ef4e5021b2f96d96af9aa0d467ece9660f (patch)
tree98e0f94cc25ca4770748ff789b2207ade75734fe
parent16b58b001d519a36ec7584d09face4def90f36e4 (diff)
gettings jabber api's code )
-rw-r--r--commonheaders.h1
-rw-r--r--init.cpp33
-rw-r--r--utilities.cpp24
3 files changed, 47 insertions, 11 deletions
diff --git a/commonheaders.h b/commonheaders.h
index 69eab89..55d2e73 100644
--- a/commonheaders.h
+++ b/commonheaders.h
@@ -24,6 +24,7 @@
#define MIRANDA_VER 0x0800
#include <newpluginapi.h>
#include <m_jabber.h>
+#include <m_protocols.h>
#include <m_database.h>
#include <m_options.h>
#include <m_langpack.h>
diff --git a/init.cpp b/init.cpp
index 8b380d7..260aa8c 100644
--- a/init.cpp
+++ b/init.cpp
@@ -20,16 +20,19 @@
#define PLUGIN_NAME "juick"
HINSTANCE hInst;
+HANDLE hAccountsChanges;
PLUGINLINK *pluginLink;
BOOL bWatrackService = FALSE;
static int OnModulesLoaded(WPARAM wParam,LPARAM lParam);
extern char *date();
-extern int WaMpdOptInit(WPARAM wParam,LPARAM lParam);
+IJabberInterface *JabberInterface[10];
+int JabberAccountsCount = 0;
struct MM_INTERFACE mmi;
struct UTF8_INTERFACE utfi;
+
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
0,
@@ -50,17 +53,16 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
return TRUE;
}
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- {
- static char plugname[52];
- strcpy(plugname, PLUGIN_NAME" [");
- strcat(plugname, date());
- strcat(plugname, " ");
- strcat(plugname, __TIME__);
- strcat(plugname, "]");
- pluginInfo.shortName = plugname;
- }
+ static char plugname[52];
+ strcpy(plugname, PLUGIN_NAME" [");
+ strcat(plugname, date());
+ strcat(plugname, " ");
+ strcat(plugname, __TIME__);
+ strcat(plugname, "]");
+ pluginInfo.shortName = plugname;
return &pluginInfo;
}
@@ -83,14 +85,23 @@ void InitVars()
{
}
+extern int JuickOptInit(WPARAM wParam,LPARAM lParam);
+extern int GetJabberInterface(WPARAM, LPARAM);
static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
{
+ GetJabberInterface(0,0);
+ HANDLE hHookOptionInit = HookEvent(ME_OPT_INITIALISE, JuickOptInit);
+ hAccountsChanges = HookEvent(ME_PROTO_ACCLISTCHANGED, GetJabberInterface);
return 0;
}
+extern int GetJabberAPIs(WPARAM, LPARAM);
+
+
+
-int __declspec(dllexport) Unload(void)
+extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
}
diff --git a/utilities.cpp b/utilities.cpp
index 170dcca..b2c28f0 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -30,6 +30,30 @@ TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,c
return szRes;
}
+extern IJabberInterface *JabberInterface[10];
+extern int JabberAccountsCount;
+
+int GetJabberInterface(WPARAM, LPARAM) //get interface for all jabber accounts, options later
+{
+ IJabberInterface *JIftmp[50]; //should it be dynamic ?
+ int count = 0;
+ PROTOACCOUNT **accounts;
+ ProtoEnumAccounts(&count, &accounts);
+ JabberAccountsCount = 0;
+ for(int i = 0; i < count; i++)
+ {
+ char *tmp = mir_u2a(accounts[i]->tszAccountName);
+ JIftmp[i] = getJabberApi(tmp);
+ if(JIftmp[i])
+ {
+ JabberInterface[JabberAccountsCount] = JIftmp[i];
+ JabberAccountsCount++;
+ }
+ mir_free(tmp);
+ }
+ return 0;
+}
+
char *date()
{