summaryrefslogtreecommitdiff
path: root/plugins/NewXstatusNotify/src/stdafx.h
blob: 6f8578163d4ef5ee28f3cbd2fc1934c67fc4e734 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
	NewXstatusNotify YM - Plugin for Miranda IM
	Copyright (c) 2001-2004 Luca Santarelli
	Copyright (c) 2005-2007 Vasilich
	Copyright (c) 2007-2011 yaho

	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 COMMON_H
#define COMMON_H

#pragma once

#define STRICT

#include <windows.h>
#include <mmsystem.h>
#include <commctrl.h>
#include <commdlg.h>
#include <shellapi.h>
#include <time.h>
#include <malloc.h>

#include <newpluginapi.h>
#include <win2k.h>
#include <m_button.h>
#include <m_clc.h>
#include <m_database.h>
#include <m_genmenu.h>
#include <m_history.h>
#include <m_icolib.h>
#include <m_ignore.h>
#include <m_langpack.h>
#include <m_message.h>
#include <m_options.h>
#include <m_popup.h>
#include <m_protosvc.h>
#include <m_skin.h>
#include <m_userinfo.h>
#include <m_xstatus.h>
#include <m_extraicons.h>
#include <m_string.h>
#include <m_clistint.h>

#include <m_metacontacts.h>
#include <m_toptoolbar.h>

#include "resource.h"
#include "indsnd.h"
#include "options.h"
#include "popup.h"
#include "utils.h"
#include "version.h"
#include "xstatus.h"

#define MODULE "NewStatusNotify"

struct CMPlugin : public PLUGIN<CMPlugin>
{
	CMPlugin();
};

#define MAX_STATUSTEXT			36
#define MAX_STANDARDTEXT		36
#define MAX_SKINSOUNDNAME		36
#define MAX_SKINSOUNDDESC		36

#define GENDER_UNSPECIFIED		0
#define GENDER_MALE				1
#define GENDER_FEMALE			2

#define ID_STATUS_FROMOFFLINE	0
#define ID_STATUS_SMSGREMOVED	1
#define ID_STATUS_SMSGCHANGED	2
#define ID_STATUS_XREMOVED		3
#define ID_STATUS_XCHANGED		4
#define ID_STATUS_XMSGCHANGED	5
#define ID_STATUS_XMSGREMOVED	6
#define ID_STATUSEX_MAX			6
#define STATUSEX_COUNT			ID_STATUSEX_MAX + 1
#define ID_STATUS_EXTRASTATUS	40081
#define ID_STATUS_STATUSMSG	40082
#define ID_STATUS_MIN			ID_STATUS_OFFLINE
#define ID_STATUS_MAX			ID_STATUS_OUTTOLUNCH
#define ID_STATUS_MAX2			ID_STATUS_STATUSMSG
#define STATUS_COUNT			ID_STATUS_MAX2 - ID_STATUS_MIN + 1
#define Index(ID_STATUS)		ID_STATUS - ID_STATUS_OFFLINE

#define COLOR_BG_AVAILDEFAULT	RGB(173,206,247)
#define COLOR_BG_NAVAILDEFAULT	RGB(255,189,189)
#define COLOR_TX_DEFAULT		RGB(0,0,0)

#define ICO_RESET				"reset"
#define ICO_POPUP				"popup"
#define ICO_SOUND				"sound"
#define ICO_NOTIFICATION_OFF	"notification_off"
#define ICO_NOTIFICATION_ON		"notification_on"
#define ICO_XSTATUS				"xstatus"
#define ICO_DISABLEALL			"disable_all"
#define ICO_ENABLEALL			"enable_all"
#define ICO_VARIABLES			"variables"
#define ICO_STATUS_MESSAGE		"status_message"
#define ICO_LOGGING_XSTATUS		"logging_xstatus"
#define ICO_LOGGING_SMSG		"logging_status_message"

#define JS_PARSE_XMPP_URI		"/ParseXmppURI"

#define COMPARE_SAME			0
#define COMPARE_DIFF			1
#define COMPARE_DEL				2

typedef struct tagSTATUS
{
	wchar_t lpzMStatusText[MAX_STATUSTEXT];
	wchar_t lpzFStatusText[MAX_STATUSTEXT];
	wchar_t lpzUStatusText[MAX_STATUSTEXT];
	wchar_t lpzStandardText[MAX_STANDARDTEXT];
	char lpzSkinSoundName[MAX_SKINSOUNDNAME];
	wchar_t lpzSkinSoundDesc[MAX_SKINSOUNDDESC];
	wchar_t lpzSkinSoundFile[MAX_PATH];
	COLORREF colorBack;
	COLORREF colorText;
} STATUS;

typedef struct {
	MCONTACT hContact;
	wchar_t *oldstatusmsg;
	wchar_t *newstatusmsg;
	char *proto;
	int compare;
} STATUSMSGINFO;

/*
MCONTACT hContact = wParam;
WORD oldStatus = LOWORD(lParam);
WORD newStatus = HIWORD(lParam);
oldStatus is the status the contact was before the change.
newStatus is the status the contact is now.
Cast them to (int) if you need them that way.
*/
#define ME_STATUSCHANGE_CONTACTSTATUSCHANGED "Miranda/StatusChange/ContactStatusChanged"

#define MS_STATUSCHANGE_MENUCOMMAND "NewStatusNotify/EnableDisableMenuCommand"

extern OPTIONS opt;
extern LIST<DBEVENT> eventListXStatus;
extern LIST<DBEVENT> eventListStatus;
extern LIST<DBEVENT> eventListSMsg;
extern TEMPLATES templates;
extern HGENMENU hEnableDisableMenu;
extern STATUS StatusList[STATUS_COUNT];
extern STATUS StatusListEx[STATUSEX_COUNT];
extern IconItem iconList[];

wchar_t* GetStr(STATUSMSGINFO *n, const wchar_t *tmplt);
void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt);
void BlinkIcon(MCONTACT hContact, HICON hIcon, wchar_t *stzText);
void PlayChangeSound(MCONTACT hContact, const char *name);
#endif //COMMON_H