summaryrefslogtreecommitdiff
path: root/plugins/IEHistory/src/utils.h
blob: 76d409bca0a804ba863a55262c898f42288adfcb (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
/*
IEView history viewer plugin for Miranda IM

Copyright © 2005-2006 Cristian Libotean

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

#define ANCHOR_LEFT     0x000001
#define ANCHOR_RIGHT		0x000002
#define ANCHOR_TOP      0x000004
#define ANCHOR_BOTTOM   0x000008
#define ANCHOR_ALL      ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_TOP | ANCHOR_BOTTOM

#define DIRECTION_BACK			0x000001
#define DIRECTION_FORWARD		0x000002

#define SEARCH_TEXT					0x000001
#define SEARCH_TIME					0x000002

/*
#define SIDE_LEFT				  0x000001
#define SIDE_TOP				  0x000002
#define SIDE_RIGHT			  0x000004
#define SIDE_BOTTOM		  	0x000008
#define SIDE_TOPLEFT		  SIDE_TOP | SIDE_LEFT
#define SIDE_TOPRIGHT		  SIDE_TOP | SIDE_RIGHT
#define SIDE_BOTTOMLEFT   SIDE_BOTTOM | SIDE_LEFT
#define SIDE_BOTTOMRIGHT	SIDE_BOTTOM | SIDE_RIGHT
*/

#define TSDF_TIME_SET						0x00000001
#define TSDF_DATE_SET						0x00000002

struct TimeSearchData{
	int flags;
	SYSTEMTIME time;
};

struct SearchResult{
	long index;
	MEVENT hEvent;
};

#ifdef _DEBUG
int LogInit();
int Log(char *format, ...);
#else
#	define LogInit()
#	define Log(fmt,...)
#endif

void ScreenToClient(HWND hWnd, LPRECT rect);

int Info(char *title, char *format, ...);
wchar_t *GetContactName(MCONTACT contact);
void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors);
RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors);

void UnixTimeToFileTime(time_t t, LPFILETIME pft);
void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst);

MEVENT GetNeededEvent(MEVENT hLastFirstEvent, int num, int direction);
SearchResult SearchHistory(MCONTACT contact, MEVENT hFirstEvent,  void *searchData, int direction, int type);

/*
static __inline int mir_snprintf(char *buffer, size_t count, const char* fmt, ...) {
	va_list va;
	int len;

	va_start(va, fmt);
	len = _vsnprintf(buffer, count-1, fmt, va);
	va_end(va);
	buffer[count-1] = 0;
	return len;
}
*/
#endif