summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src/chat/main.cpp
blob: 5009e3bdbce4d25943f88d9a46c1020ad01a13cb (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
/*
Chat module plugin for Miranda IM

Copyright (C) 2003 Jörgen Persson
Copyright 2003-2009 Miranda ICQ/IM project,

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.
*/

#include "../commonheaders.h"

void RegisterChatFonts( void );

//globals
HMENU       g_hMenu = NULL;
HANDLE      hJoinMenuItem, hLeaveMenuItem;

FONTINFO    aFonts[OPTIONS_FONTCOUNT];
HBRUSH      hListBkgBrush = NULL;
HBRUSH      hListSelectedBkgBrush = NULL;

TCHAR*      pszActiveWndID = 0;
char*       pszActiveWndModule = 0;

struct GlobalLogSettings_t g_Settings;

int Chat_Load()
{
	InitializeCriticalSection(&cs);
	g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
	TranslateMenu(g_hMenu);
	HookEvents();
	CreateServiceFunctions();
	CreateHookableEvents();
	return 0;
}

int Chat_Unload(void)
{
	db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);

	CList_SetAllOffline(TRUE, NULL);

	mir_free( pszActiveWndID );
	mir_free( pszActiveWndModule );

	DestroyHookableEvents();

	DestroyMenu(g_hMenu);
	FreeIcons();
	OptionsUnInit();
	DeleteCriticalSection(&cs);
	return 0;
}

int Chat_ModulesLoaded(WPARAM wParam,LPARAM lParam)
{
	char* mods[3] = { "Chat", "ChatFonts" };
	CallService( "DBEditorpp/RegisterModule", (WPARAM)mods, 2 );
	RegisterChatFonts();
	OptionsInit();
	LoadIcons();
	{
		CLISTMENUITEM mi = { sizeof(mi) };
		mi.cbSize = sizeof(mi);
		mi.position = -2000090001;
		mi.flags = CMIF_DEFAULT | CMIF_ICONFROMICOLIB;
		mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_JOIN );
		mi.pszName = LPGEN("&Join");
		mi.pszService = "GChat/JoinChat";
		hJoinMenuItem = Menu_AddContactMenuItem(&mi);

		mi.position = -2000090000;
		mi.flags = CMIF_NOTOFFLINE | CMIF_ICONFROMICOLIB;
		mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_LEAVE );
		mi.pszName = LPGEN("&Leave");
		mi.pszService = "GChat/LeaveChat";
		hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
	}
	CList_SetAllOffline(TRUE, NULL);
 	return 0;
}


void LoadIcons(void)
{
	LoadMsgLogBitmaps();
	return ;
}

void FreeIcons(void)
{
	FreeMsgLogBitmaps();
	return;
}