summaryrefslogtreecommitdiff
path: root/plugins/!Deprecated/ExternalAPI/m_ircscript.h
blob: ddab3b96bbef80058a53223e155fb5374718ec48 (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

/*
	This file is a description of the interface between the Miranda Scripting 
	Plugin (MSP) and IRC. It is mainly an internal draft.
	
	The MSP is a powerful PHP based scripting engine 
	which can automate many tasks in Miranda IM. With the implementation of 
	this interface IRC can also benefit from the advantages MSP brings. The
	interface has been constructed by the respective authors of IRC and MSP.

	The idea is that MSP and IRC should communicate via the interface outlined herein, 
	but MSP should "package" the data in attractive functions that can be easily 
	used by eager scripters.

	Note that m_chat.h should be #included as the events defined therein is used in this interface
	
	The IRC plugin communicates with MSP mainly through 8 (2 x 4) services which are 
	illustrated by the following matrix (MSP has 4 services and IRC 4 services):


	--------------------------------------------------
	|						|                         |
	|  Incoming raw data	|		Data going        |
	|     from server		|		to GUI		      |
	|	(before processing)	|    (after processing)   |
	|						|                         |
	--------------------------------------------------
	|						|                         |
	|  Outgoing raw data	|		Data going        |
	|     to server			|		from GUI	      |
	|	(after processing)	|    (before processing)  |
	|						|                         |
	--------------------------------------------------
	  
	(processing refers to the IRC plugin reacting to different commands)
	
*/


//------------------------- HANDLING RAW MESSAGES ------------------------
/*	

	The two leftmost boxes are related to data sent to and from the server in RAW form.
	(a typical RAW message looks like this: ":nick!user@host COMMAND PARAMETERS")

	It is very useful for scripters to be able to manipulate and add RAW streams of data.
	
	The below structure is used when RAW data is generated and IRC must trigger an 
	event in MSP so the scripts can do their magic.

	If the data is modified make sure to use MS_SYSTEM_GET_MMI and then mmi_realloc() to
	allocate from the same heap. Do not free the data.

  	wParam=  Module name
	lParam=  (LPARAM)( char* )pszRaw
	returns nonzero if the message should be dropped
*/

/*
	NOTE! IRC will implement two services which also uses the same parameters:

	"<Module m_name>/InsertRawIn"				//used for inserting a "fake" incoming RAW event
	"<Module m_name>/InsertRawOut"			//used for inserting a "fake" outgoing RAW event

*/


#define MS_MBOT_IRC_RAW_IN  "MBot/IrcRawIn"							
#define MS_MBOT_IRC_RAW_OUT  "MBot/IrcRawOut"						


//------------------------- HANDLING GUI MESSAGES 1 ------------------------
/*	

	The top rightmost box is related to data sent to the gui 
	(currently chat.dll) in the form of GCEVENT's. (see m_chat.h)

	While maybe not as useful to the scripter, it can be useful to be able to 
	"tap into" messages to the GUI from the IRC plugin. 

	If the data is modified make sure to realloc() or similar.

  	wParam=  (WPARAM) (WPARAM_GUI_IN) &wgi
	lParam=  (LPARAM)(GCEVENT *)&gce     // see m_chat.h
	returns nonzero if the message should be dropped
*/

/*
	NOTE! IRC will implement a service which also uses the same parameters:

	"<Module m_name>/InsertGuiIn"		//used for inserting a "fake" event to the GUI

*/
typedef struct MBOT_GUI_WPARAM_IN_STRUCT
{
	const char* pszModule;
	WPARAM wParam;
}WPARAM_GUI_IN;

#define MS_MBOT_IRC_GUI_IN  "MBot/IrcGuiIn"				


//------------------------- HANDLING GUI MESSAGES 2 ------------------------
/*	

	The bottom rightmost box is related to data sent from the gui 
	(currently chat.dll) in the form of GCHOOKS's. Originally this is carried out in a hook,
	but for MSP this is done via a service instead.

	It can be useful for scripters to simulate user actions, like entering text, closing the window etc

	If the data is modified make sure to realloc() or similar.

  	wParam=  Module name
	lParam=  (LPARAM)(GCHOOK *)gch     // see m_chat.h
	returns nonzero if the message should be dropped
*/

/*
	NOTE! IRC will implement a service which also uses the same parameters:

	"<Module m_name>/InsertGuiOut"		//used for inserting a "fake" outgoing event to the GUI

*/

#define MS_MBOT_IRC_GUI_OUT  "MBot/IrcGuiOut"				

#define MS_MBOT_REGISTERIRC "MBot/RegisterIRCModule"