1 #include "module.h"
2 
3 MODULE = Purple::Serv  PACKAGE = Purple::Serv  PREFIX = serv_
4 PROTOTYPES: ENABLE
5 
6 
7 void
8 serv_add_deny(con, a)
9 	Purple::Connection con
10 	const char * a
11 
12 void
13 serv_add_permit(a, b)
14 	Purple::Connection a
15 	const char * b
16 
17 void
18 serv_alias_buddy(buddy)
19 	Purple::BuddyList::Buddy buddy
20 
21 void
22 serv_chat_invite(con, a, b, c)
23 	Purple::Connection con
24 	int a
25 	const char * b
26 	const char * c
27 
28 void
29 serv_chat_leave(a, b)
30 	Purple::Connection a
31 	int b
32 
33 int
34 serv_chat_send(con, a, b, flags)
35 	Purple::Connection con
36 	int a
37 	const char * b
38 	Purple::MessageFlags flags
39 
40 void
41 serv_chat_whisper(con, a, b, c)
42 	Purple::Connection con
43 	int a
44 	const char * b
45 	const char * c
46 
47 void
48 serv_get_info(con, a)
49 	Purple::Connection con
50 	const char * a
51 
52 void
53 serv_got_alias(gc, who, alias)
54 	Purple::Connection gc
55 	const char *who
56 	const char *alias
57 
58 void
59 serv_got_chat_in(g, id, who, chatflags, message, mtime)
60 	Purple::Connection g
61 	int id
62 	const char *who
63 	Purple::MessageFlags chatflags
64 	const char *message
65 	time_t mtime
66 
67 void
68 serv_got_chat_invite(gc, name, who, message, components)
69 	Purple::Connection gc
70 	const char *name
71 	const char *who
72 	const char *message
73 	SV * components
74 INIT:
75 	HV * t_HV;
76 	HE * t_HE;
77 	SV * t_SV;
78 	GHashTable * t_GHash;
79 	I32 len;
80 	char *t_key, *t_value;
81 CODE:
82 	t_HV =  (HV *)SvRV(components);
83 	t_GHash = g_hash_table_new(g_str_hash, g_str_equal);
84 
85 	for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) {
86 		t_key = hv_iterkey(t_HE, &len);
87 		t_SV = *hv_fetch(t_HV, t_key, len, 0);
88  		t_value = SvPVutf8_nolen(t_SV);
89 
90 		g_hash_table_insert(t_GHash, t_key, t_value);
91 	}
92 	serv_got_chat_invite(gc, name, who, message, t_GHash);
93 
94 void
95 serv_got_chat_left(g, id)
96 	Purple::Connection g
97 	int id
98 
99 void
100 serv_got_im(gc, who, msg, imflags, mtime)
101 	Purple::Connection gc
102 	const char *who
103 	const char *msg
104 	Purple::MessageFlags imflags
105 	time_t mtime
106 
107 Purple::Conversation
108 serv_got_joined_chat(gc, id, name)
109 	Purple::Connection gc
110 	int id
111 	const char *name
112 
113 void
114 serv_got_typing(gc, name, timeout, state)
115 	Purple::Connection gc
116 	const char *name
117 	int timeout
118 	Purple::TypingState state
119 
120 void
121 serv_got_typing_stopped(gc, name)
122 	Purple::Connection gc
123 	const char *name
124 
125 void
126 serv_join_chat(conn, components)
127 	Purple::Connection conn
128 	HV * components
129 PREINIT:
130 	HE *t_HE;
131 	SV *t_SV;
132 	I32 len;
133 	GHashTable *t_GHash;
134 	char *t_key, *t_value;
135 CODE:
136 	t_GHash = g_hash_table_new(g_str_hash, g_str_equal);
137 
138 	for (t_HE = hv_iternext(components); t_HE != NULL;
139 	     t_HE = hv_iternext(components)) {
140 		t_key = hv_iterkey(t_HE, &len);
141 		t_SV = *hv_fetch(components, t_key, len, 0);
142 		t_value = SvPVutf8_nolen(t_SV);
143 
144 		g_hash_table_insert(t_GHash, t_key, t_value);
145 	}
146 	serv_join_chat(conn, t_GHash);
147 	g_hash_table_destroy(t_GHash);
148 
149 void
150 serv_move_buddy(buddy, group1, group2)
151 	Purple::BuddyList::Buddy buddy
152 	Purple::BuddyList::Group group1
153 	Purple::BuddyList::Group group2
154 
155 void
156 serv_reject_chat(con, components)
157 	Purple::Connection con
158 	SV * components
159 INIT:
160 	HV * t_HV;
161 	HE * t_HE;
162 	SV * t_SV;
163 	GHashTable * t_GHash;
164 	I32 len;
165 	char *t_key, *t_value;
166 CODE:
167 	t_HV =  (HV *)SvRV(components);
168 	t_GHash = g_hash_table_new(g_str_hash, g_str_equal);
169 
170 	for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) {
171 		t_key = hv_iterkey(t_HE, &len);
172 		t_SV = *hv_fetch(t_HV, t_key, len, 0);
173  		t_value = SvPVutf8_nolen(t_SV);
174 
175 		g_hash_table_insert(t_GHash, t_key, t_value);
176 	}
177 	serv_reject_chat(con, t_GHash);
178 
179 void
180 serv_rem_deny(con, a)
181 	Purple::Connection con
182 	const char * 	a
183 
184 void
185 serv_rem_permit(con, a)
186 	Purple::Connection con
187 	const char *	a
188 
189 void
190 serv_send_file(gc, who, file)
191 	Purple::Connection gc
192 	const char *who
193 	const char *file
194 
195 int
196 serv_send_im(con, a, b, flags )
197 	Purple::Connection con
198 	const char * a
199 	const char * b
200 	Purple::MessageFlags flags
201 
202 int
203 serv_send_typing(con, a, state)
204 	Purple::Connection con
205 	const char * a
206 	Purple::TypingState state
207 
208 void
209 serv_set_info(con, a)
210 	Purple::Connection con
211 	const char * a
212 
213 void
214 serv_set_permit_deny(con)
215 	Purple::Connection con
216 
217