corrade-lsl-templates – Diff between revs 41 and 42
?pathlinks?
Rev 41 | Rev 42 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | /////////////////////////////////////////////////////////////////////////// |
1 | /////////////////////////////////////////////////////////////////////////// |
|
2 | // Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
2 | // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
|
3 | /////////////////////////////////////////////////////////////////////////// |
3 | /////////////////////////////////////////////////////////////////////////// |
|
4 | // |
4 | // |
|
5 | // A module that bans group members using fuzzy name matching. |
5 | // A module that bans group members using fuzzy name matching. |
|
6 | // |
6 | // |
|
7 | /////////////////////////////////////////////////////////////////////////// |
7 | /////////////////////////////////////////////////////////////////////////// |
|
Line 15... | Line 15... | |||
15 | list a = llParseStringKeepNulls(data, ["&", "="], []); |
15 | list a = llParseStringKeepNulls(data, ["&", "="], []); |
|
16 | integer i = llListFindList(llList2ListStrided(a, 0, -1, 2), [ k ]); |
16 | integer i = llListFindList(llList2ListStrided(a, 0, -1, 2), [ k ]); |
|
17 | if(i != -1) return llList2String(a, 2*i+1); |
17 | if(i != -1) return llList2String(a, 2*i+1); |
|
18 | return ""; |
18 | return ""; |
|
19 | } |
19 | } |
|
20 | |
20 | |
|
21 | /////////////////////////////////////////////////////////////////////////// |
21 | /////////////////////////////////////////////////////////////////////////// |
|
22 | // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
22 | // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
|
23 | /////////////////////////////////////////////////////////////////////////// |
23 | /////////////////////////////////////////////////////////////////////////// |
|
24 | string wasKeyValueEncode(list data) { |
24 | string wasKeyValueEncode(list data) { |
|
25 | list k = llList2ListStrided(data, 0, -1, 2); |
25 | list k = llList2ListStrided(data, 0, -1, 2); |
|
26 | list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); |
26 | list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); |
|
27 | data = []; |
27 | data = []; |
|
Line 32... | Line 32... | |||
32 | } while(llGetListLength(k) != 0); |
32 | } while(llGetListLength(k) != 0); |
|
33 | return llDumpList2String(data, "&"); |
33 | return llDumpList2String(data, "&"); |
|
34 | } |
34 | } |
|
Line 35... | Line 35... | |||
35 | |
35 | |
|
36 | /////////////////////////////////////////////////////////////////////////// |
36 | /////////////////////////////////////////////////////////////////////////// |
|
37 | // Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
37 | // Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
|
38 | /////////////////////////////////////////////////////////////////////////// |
38 | /////////////////////////////////////////////////////////////////////////// |
|
39 | // http://was.fm/secondlife/wanderer |
39 | // http://was.fm/secondlife/wanderer |
|
40 | vector wasCirclePoint(float radius) { |
40 | vector wasCirclePoint(float radius) { |
|
41 | float x = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); |
41 | float x = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); |
|
Line 44... | Line 44... | |||
44 | return <x, y, 0>; |
44 | return <x, y, 0>; |
|
45 | return wasCirclePoint(radius); |
45 | return wasCirclePoint(radius); |
|
46 | } |
46 | } |
|
Line 47... | Line 47... | |||
47 | |
47 | |
|
48 | /////////////////////////////////////////////////////////////////////////// |
48 | /////////////////////////////////////////////////////////////////////////// |
|
49 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
49 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
|
50 | /////////////////////////////////////////////////////////////////////////// |
50 | /////////////////////////////////////////////////////////////////////////// |
|
51 | // escapes a string in conformance with RFC1738 |
51 | // escapes a string in conformance with RFC1738 |
|
52 | string wasURLEscape(string i) { |
52 | string wasURLEscape(string i) { |
|
53 | string o = ""; |
53 | string o = ""; |
|
Line 68... | Line 68... | |||
68 | } while(i != ""); |
68 | } while(i != ""); |
|
69 | return o; |
69 | return o; |
|
70 | } |
70 | } |
|
Line 71... | Line 71... | |||
71 | |
71 | |
|
72 | /////////////////////////////////////////////////////////////////////////// |
72 | /////////////////////////////////////////////////////////////////////////// |
|
73 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
73 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
|
74 | /////////////////////////////////////////////////////////////////////////// |
74 | /////////////////////////////////////////////////////////////////////////// |
|
75 | list wasCSVToList(string csv) { |
75 | list wasCSVToList(string csv) { |
|
76 | list l = []; |
76 | list l = []; |
|
77 | list s = []; |
77 | list s = []; |
|
Line 107... | Line 107... | |||
107 | // postcondition: length(s) = 0 |
107 | // postcondition: length(s) = 0 |
|
108 | return l + m; |
108 | return l + m; |
|
109 | } |
109 | } |
|
Line 110... | Line 110... | |||
110 | |
110 | |
|
111 | /////////////////////////////////////////////////////////////////////////// |
111 | /////////////////////////////////////////////////////////////////////////// |
|
112 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
112 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
|
113 | /////////////////////////////////////////////////////////////////////////// |
113 | /////////////////////////////////////////////////////////////////////////// |
|
114 | string wasListToCSV(list l) { |
114 | string wasListToCSV(list l) { |
|
115 | list v = []; |
115 | list v = []; |
|
116 | do { |
116 | do { |
|
117 | string a = llDumpList2String( |
117 | string a = llDumpList2String( |
|
118 | llParseStringKeepNulls( |
118 | llParseStringKeepNulls( |
|
119 | llList2String( |
119 | llList2String( |
|
120 | l, |
120 | l, |
|
121 | 0 |
121 | 0 |
|
122 | ), |
122 | ), |
|
123 | ["\""], |
123 | ["\""], |
|
124 | [] |
124 | [] |
|
125 | ), |
125 | ), |
|
126 | "\"\"" |
126 | "\"\"" |
|
127 | ); |
127 | ); |
|
128 | if(llParseStringKeepNulls( |
128 | if(llParseStringKeepNulls( |
|
129 | a, |
129 | a, |
|
130 | [" ", ",", "\n", "\""], [] |
130 | [" ", ",", "\n", "\""], [] |
|
131 | ) != |
131 | ) != |
|
132 | (list) a |
132 | (list) a |
|
133 | ) a = "\"" + a + "\""; |
133 | ) a = "\"" + a + "\""; |
|
134 | v += a; |
134 | v += a; |
|
135 | l = llDeleteSubList(l, 0, 0); |
135 | l = llDeleteSubList(l, 0, 0); |
|
136 | } while(l != []); |
136 | } while(l != []); |
|
137 | return llDumpList2String(v, ","); |
137 | return llDumpList2String(v, ","); |
|
Line 138... | Line 138... | |||
138 | } |
138 | } |
|
139 | |
139 | |
|
140 | /////////////////////////////////////////////////////////////////////////// |
140 | /////////////////////////////////////////////////////////////////////////// |
|
141 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
141 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
|
142 | /////////////////////////////////////////////////////////////////////////// |
142 | /////////////////////////////////////////////////////////////////////////// |
|
143 | // unescapes a string in conformance with RFC1738 |
143 | // unescapes a string in conformance with RFC1738 |
|
144 | string wasURLUnescape(string i) { |
144 | string wasURLUnescape(string i) { |
|
145 | return llUnescapeURL( |
145 | return llUnescapeURL( |
|
146 | llDumpList2String( |
146 | llDumpList2String( |
|
147 | llParseString2List( |
147 | llParseString2List( |
|
148 | llDumpList2String( |
148 | llDumpList2String( |
|
149 | llParseString2List( |
149 | llParseString2List( |
|
150 | i, |
150 | i, |
|
151 | ["+"], |
151 | ["+"], |
|
152 | [] |
152 | [] |
|
153 | ), |
153 | ), |
|
154 | " " |
154 | " " |
|
155 | ), |
155 | ), |
|
156 | ["%0D%0A"], |
156 | ["%0D%0A"], |
|
157 | [] |
157 | [] |
|
158 | ), |
158 | ), |
|
159 | "\n" |
159 | "\n" |
|
160 | ) |
160 | ) |
|
Line 161... | Line 161... | |||
161 | ); |
161 | ); |
|
162 | } |
162 | } |
|
163 | |
163 | |
|
164 | /////////////////////////////////////////////////////////////////////////// |
164 | /////////////////////////////////////////////////////////////////////////// |
|
165 | // Copyright (C) 2017 Wizardry and Steamworks - License: CC BY 2.0 // |
165 | // Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 // |
|
166 | /////////////////////////////////////////////////////////////////////////// |
166 | /////////////////////////////////////////////////////////////////////////// |
|
167 | list wasSetIntersect(list a, list b) { |
167 | list wasSetIntersect(list a, list b) { |
|
Line 173... | Line 173... | |||
173 | return i + wasSetIntersect(a, b); |
173 | return i + wasSetIntersect(a, b); |
|
174 | } |
174 | } |
|
Line 175... | Line 175... | |||
175 | |
175 | |
|
176 | // configuration data |
176 | // configuration data |
|
177 | string configuration = ""; |
- | ||
178 | // callback URL |
- | ||
179 | string URL = ""; |
177 | string configuration = ""; |
|
180 | // store message over state. |
178 | // store message over state. |
|
181 | string data = ""; |
179 | string data = ""; |
|
182 | // banee |
180 | // banee |
|
183 | string firstname = ""; |
181 | string firstname = ""; |
|
Line 201... | Line 199... | |||
201 | } |
199 | } |
|
202 | on_rez(integer num) { |
200 | on_rez(integer num) { |
|
203 | llResetScript(); |
201 | llResetScript(); |
|
204 | } |
202 | } |
|
205 | changed(integer change) { |
203 | changed(integer change) { |
|
206 | if((change & CHANGED_INVENTORY) || |
204 | if((change & CHANGED_INVENTORY) || |
|
207 | (change & CHANGED_REGION_START) || |
205 | (change & CHANGED_REGION_START) || |
|
208 | (change & CHANGED_OWNER)) { |
206 | (change & CHANGED_OWNER)) { |
|
209 | llResetScript(); |
207 | llResetScript(); |
|
210 | } |
208 | } |
|
211 | } |
209 | } |
|
212 | state_exit() { |
210 | state_exit() { |
|
Line 221... | Line 219... | |||
221 | } |
219 | } |
|
222 | link_message(integer sender, integer num, string message, key id) { |
220 | link_message(integer sender, integer num, string message, key id) { |
|
223 | // We only care about notifications now. |
221 | // We only care about notifications now. |
|
224 | if(id != "notification") |
222 | if(id != "notification") |
|
225 | return; |
223 | return; |
|
226 | |
224 | |
|
227 | // This script only processes group notifications. |
225 | // This script only processes group notifications. |
|
228 | if(wasKeyValueGet("type", message) != "group") |
226 | if(wasKeyValueGet("type", message) != "group" || |
|
- | 227 | (wasKeyValueGet("type", message) == "group" && |
||
- | 228 | wasURLUnescape(wasKeyValueGet("group", message)) != |
||
- | 229 | wasKeyValueGet("group", configuration))) |
||
229 | return; |
230 | return; |
|
230 | |
231 | |
|
231 | // Get the sent message. |
232 | // Get the sent message. |
|
232 | data = wasURLUnescape( |
233 | data = wasURLUnescape( |
|
233 | wasKeyValueGet( |
234 | wasKeyValueGet( |
|
234 | "message", |
235 | "message", |
|
235 | message |
236 | message |
|
236 | ) |
237 | ) |
|
237 | ); |
238 | ); |
|
238 | |
239 | |
|
239 | // Check if this is an eggdrop command. |
240 | // Check if this is an eggdrop command. |
|
240 | if(llGetSubString(data, 0, 0) != |
241 | if(llGetSubString(data, 0, 0) != |
|
241 | wasKeyValueGet("command", configuration)) |
242 | wasKeyValueGet("command", configuration)) |
|
242 | return; |
243 | return; |
|
243 | |
244 | |
|
244 | // Check if the command matches the current module. |
245 | // Check if the command matches the current module. |
|
245 | list command = llParseString2List(data, [" "], []); |
246 | list command = llParseString2List(data, [" "], []); |
|
246 | if(llList2String(command, 0) != |
247 | if(llList2String(command, 0) != |
|
247 | wasKeyValueGet("command", configuration) + "ban") |
248 | wasKeyValueGet("command", configuration) + "ban") |
|
248 | return; |
249 | return; |
|
249 | |
250 | |
|
250 | // Remove command. |
251 | // Remove command. |
|
251 | command = llDeleteSubList(command, 0, 0); |
252 | command = llDeleteSubList(command, 0, 0); |
|
252 | |
253 | |
|
253 | firstname = wasKeyValueGet("firstname", message); |
254 | firstname = wasKeyValueGet("firstname", message); |
|
254 | lastname = wasKeyValueGet("lastname", message); |
255 | lastname = wasKeyValueGet("lastname", message); |
|
255 | |
256 | |
|
256 | if(firstname == "" || lastname == "") { |
257 | if(firstname == "" || lastname == "") { |
|
257 | data = "And who would yarr be?"; |
258 | data = "And who would yarr be?"; |
|
258 | state tell; |
259 | state tell; |
|
259 | } |
260 | } |
|
260 | |
261 | |
|
261 | // Dump the rest of the message. |
262 | // Dump the rest of the message. |
|
262 | data = llDumpList2String(command, " "); |
263 | data = llDumpList2String(command, " "); |
|
263 | |
- | ||
264 | // Get an URL. |
- | ||
265 | state url; |
- | ||
266 | } |
- | ||
267 | on_rez(integer num) { |
- | ||
268 | llResetScript(); |
- | ||
269 | } |
- | ||
270 | changed(integer change) { |
- | ||
271 | if((change & CHANGED_INVENTORY) || |
- | ||
272 | (change & CHANGED_REGION_START) || |
- | ||
273 | (change & CHANGED_OWNER)) { |
- | ||
274 | llResetScript(); |
- | ||
275 | } |
- | ||
276 | } |
- | ||
277 | } |
- | ||
Line 278... | Line -... | |||
278 | |
- | ||
279 | state url { |
- | ||
280 | state_entry() { |
- | ||
281 | // DEBUG |
- | ||
282 | llOwnerSay("[Ban] Requesting URL..."); |
264 | |
|
283 | llRequestURL(); |
- | ||
284 | } |
- | ||
285 | http_request(key id, string method, string body) { |
- | ||
286 | if(method != URL_REQUEST_GRANTED) return; |
- | ||
287 | URL = body; |
- | ||
288 | // DEBUG |
- | ||
289 | llOwnerSay("[Ban] Got URL..."); |
265 | // Get roles of caller. |
|
290 | state get_caller_roles; |
266 | state get_caller_roles; |
|
291 | } |
267 | } |
|
292 | on_rez(integer num) { |
268 | on_rez(integer num) { |
|
293 | llResetScript(); |
269 | llResetScript(); |
|
294 | } |
270 | } |
|
295 | changed(integer change) { |
271 | changed(integer change) { |
|
296 | if((change & CHANGED_INVENTORY) || |
272 | if((change & CHANGED_INVENTORY) || |
|
297 | (change & CHANGED_REGION_START) || |
273 | (change & CHANGED_REGION_START) || |
|
298 | (change & CHANGED_OWNER)) { |
274 | (change & CHANGED_OWNER)) { |
|
299 | llResetScript(); |
275 | llResetScript(); |
|
300 | } |
276 | } |
|
301 | } |
277 | } |
|
Line 305... | Line 281... | |||
305 | state_entry() { |
281 | state_entry() { |
|
306 | // DEBUG |
282 | // DEBUG |
|
307 | llOwnerSay("[Ban] Searching for caller..."); |
283 | llOwnerSay("[Ban] Searching for caller..."); |
|
308 | llInstantMessage( |
284 | llInstantMessage( |
|
309 | wasKeyValueGet( |
285 | wasKeyValueGet( |
|
310 | "corrade", |
286 | "corrade", |
|
311 | configuration |
287 | configuration |
|
312 | ), |
288 | ), |
|
313 | wasKeyValueEncode( |
289 | wasKeyValueEncode( |
|
314 | [ |
290 | [ |
|
315 | "command", "getmemberroles", |
291 | "command", "getmemberroles", |
|
316 | "group", wasURLEscape( |
292 | "group", wasURLEscape( |
|
317 | wasKeyValueGet( |
293 | wasKeyValueGet( |
|
318 | "group", |
294 | "group", |
|
319 | configuration |
295 | configuration |
|
320 | ) |
296 | ) |
|
321 | ), |
297 | ), |
|
322 | "password", wasURLEscape( |
298 | "password", wasURLEscape( |
|
323 | wasKeyValueGet( |
299 | wasKeyValueGet( |
|
324 | "password", |
300 | "password", |
|
325 | configuration |
301 | configuration |
|
326 | ) |
302 | ) |
|
327 | ), |
303 | ), |
|
328 | "firstname", firstname, |
304 | "firstname", firstname, |
|
329 | "lastname", lastname, |
305 | "lastname", lastname, |
|
330 | "callback", wasURLEscape(URL) |
306 | "callback", wasURLEscape( |
|
- | 307 | wasKeyValueGet( |
||
- | 308 | "URL", |
||
- | 309 | configuration |
||
- | 310 | ) |
||
- | 311 | ) |
||
331 | ] |
312 | ] |
|
332 | ) |
313 | ) |
|
333 | ); |
314 | ); |
|
- | 315 | |
||
334 | llSetTimerEvent(60); |
316 | llSetTimerEvent(60); |
|
335 | } |
317 | } |
|
336 | http_request(key id, string method, string body) { |
318 | link_message(integer sender, integer num, string body, key id) { |
|
- | 319 | // Only process callbacks for the database command. |
||
- | 320 | if(id != "callback" || wasKeyValueGet("command", body) != "getmemberroles") |
||
337 | llHTTPResponse(id, 200, "OK"); |
321 | return; |
|
- | 322 | |
||
338 | if(wasKeyValueGet("command", body) != "getmemberroles" || |
323 | if(wasKeyValueGet("command", body) != "getmemberroles" || |
|
339 | wasKeyValueGet("success", body) != "True") { |
324 | wasKeyValueGet("success", body) != "True") { |
|
340 | // DEBUG |
325 | // DEBUG |
|
341 | llOwnerSay("[Ban] Unable to get member roles: " + |
326 | llOwnerSay("[Ban] Unable to get member roles: " + |
|
342 | wasURLUnescape( |
327 | wasURLUnescape( |
|
343 | wasKeyValueGet("error", body) |
328 | wasKeyValueGet("error", body) |
|
344 | ) |
329 | ) |
|
345 | ); |
330 | ); |
|
346 | llReleaseURL(URL); |
- | ||
347 | state listen_group; |
331 | state listen_group; |
|
348 | } |
332 | } |
|
349 | |
333 | |
|
350 | // Dump the roles to a list. |
334 | // Dump the roles to a list. |
|
351 | list roles = wasCSVToList( |
335 | list roles = wasCSVToList( |
|
352 | wasURLUnescape( |
336 | wasURLUnescape( |
|
353 | wasKeyValueGet("data", body) |
337 | wasKeyValueGet("data", body) |
|
354 | ) |
338 | ) |
|
355 | ); |
339 | ); |
|
356 | |
340 | |
|
357 | if(llGetListLength( |
341 | if(llGetListLength( |
|
358 | wasSetIntersect(roles, |
342 | wasSetIntersect(roles, |
|
359 | wasCSVToList( |
343 | wasCSVToList( |
|
360 | wasKeyValueGet( |
344 | wasKeyValueGet( |
|
361 | "admin roles", configuration |
345 | "admin roles", configuration |
|
362 | ) |
346 | ) |
|
363 | ) |
347 | ) |
|
364 | ) |
348 | ) |
|
365 | ) == 0) { |
349 | ) == 0) { |
|
366 | data = "You ain't got the cojones!"; |
350 | data = "You ain't got the cojones!"; |
|
367 | llReleaseURL(URL); |
- | ||
368 | state tell; |
351 | state tell; |
|
369 | } |
352 | } |
|
370 | |
353 | |
|
371 | list banee = llParseString2List(data, [" "], []); |
354 | list banee = llParseString2List(data, [" "], []); |
|
372 | |
355 | |
|
373 | firstname = llList2String(banee, 0); |
356 | firstname = llList2String(banee, 0); |
|
374 | banee = llDeleteSubList(banee, 0, 0); |
357 | banee = llDeleteSubList(banee, 0, 0); |
|
375 | lastname = llList2String(banee, 0); |
358 | lastname = llList2String(banee, 0); |
|
376 | banee = llDeleteSubList(banee, 0, 0); |
359 | banee = llDeleteSubList(banee, 0, 0); |
|
377 | |
360 | |
|
378 | if(firstname == "" || lastname == "") { |
361 | if(firstname == "" || lastname == "") { |
|
379 | data = "Full name required."; |
362 | data = "Full name required."; |
|
380 | state tell; |
363 | state tell; |
|
381 | } |
364 | } |
|
382 | |
365 | |
|
383 | if(llGetListLength(banee) != 0 && |
366 | if(llGetListLength(banee) != 0 && |
|
384 | llToLower(llList2String(banee, 0)) == "nosoft") { |
367 | llToLower(llList2String(banee, 0)) == "nosoft") { |
|
385 | soft = "False"; |
368 | soft = "False"; |
|
386 | banee = llDeleteSubList(banee, 0, 0); |
369 | banee = llDeleteSubList(banee, 0, 0); |
|
387 | } |
370 | } |
|
388 | |
371 | |
|
389 | // GC |
372 | // GC |
|
390 | banee = []; |
373 | banee = []; |
|
391 | state get_banee_roles; |
374 | state get_banee_roles; |
|
392 | } |
375 | } |
|
393 | timer() { |
376 | timer() { |
|
394 | llReleaseURL(URL); |
- | ||
395 | state listen_group; |
377 | state listen_group; |
|
396 | } |
378 | } |
|
397 | on_rez(integer num) { |
379 | on_rez(integer num) { |
|
398 | llResetScript(); |
380 | llResetScript(); |
|
399 | } |
381 | } |
|
400 | changed(integer change) { |
382 | changed(integer change) { |
|
401 | if((change & CHANGED_INVENTORY) || |
383 | if((change & CHANGED_INVENTORY) || |
|
402 | (change & CHANGED_REGION_START) || |
384 | (change & CHANGED_REGION_START) || |
|
403 | (change & CHANGED_OWNER)) { |
385 | (change & CHANGED_OWNER)) { |
|
404 | llResetScript(); |
386 | llResetScript(); |
|
405 | } |
387 | } |
|
406 | } |
388 | } |
|
407 | state_exit() { |
389 | state_exit() { |
|
Line 413... | Line 395... | |||
413 | state_entry() { |
395 | state_entry() { |
|
414 | // DEBUG |
396 | // DEBUG |
|
415 | llOwnerSay("[Ban] Searching for banee..."); |
397 | llOwnerSay("[Ban] Searching for banee..."); |
|
416 | llInstantMessage( |
398 | llInstantMessage( |
|
417 | wasKeyValueGet( |
399 | wasKeyValueGet( |
|
418 | "corrade", |
400 | "corrade", |
|
419 | configuration |
401 | configuration |
|
420 | ), |
402 | ), |
|
421 | wasKeyValueEncode( |
403 | wasKeyValueEncode( |
|
422 | [ |
404 | [ |
|
423 | "command", "getmemberroles", |
405 | "command", "getmemberroles", |
|
424 | "group", wasURLEscape( |
406 | "group", wasURLEscape( |
|
425 | wasKeyValueGet( |
407 | wasKeyValueGet( |
|
426 | "group", |
408 | "group", |
|
427 | configuration |
409 | configuration |
|
428 | ) |
410 | ) |
|
429 | ), |
411 | ), |
|
430 | "password", wasURLEscape( |
412 | "password", wasURLEscape( |
|
431 | wasKeyValueGet( |
413 | wasKeyValueGet( |
|
432 | "password", |
414 | "password", |
|
433 | configuration |
415 | configuration |
|
434 | ) |
416 | ) |
|
435 | ), |
417 | ), |
|
436 | "firstname", firstname, |
418 | "firstname", firstname, |
|
437 | "lastname", lastname, |
419 | "lastname", lastname, |
|
438 | "callback", wasURLEscape(URL) |
420 | "callback", wasURLEscape( |
|
- | 421 | wasKeyValueGet( |
||
- | 422 | "URL", |
||
- | 423 | configuration |
||
- | 424 | ) |
||
- | 425 | ) |
||
439 | ] |
426 | ] |
|
440 | ) |
427 | ) |
|
441 | ); |
428 | ); |
|
442 | llSetTimerEvent(60); |
429 | llSetTimerEvent(60); |
|
443 | } |
430 | } |
|
444 | http_request(key id, string method, string body) { |
431 | link_message(integer sender, integer num, string body, key id) { |
|
445 | llHTTPResponse(id, 200, "OK"); |
432 | // Only process callbacks for the database command. |
|
446 | if(wasKeyValueGet("command", body) != "getmemberroles" || |
433 | if(id != "callback" || wasKeyValueGet("command", body) != "getmemberroles") |
|
- | 434 | return; |
||
- | 435 | |
||
447 | wasKeyValueGet("success", body) != "True") { |
436 | if(wasKeyValueGet("success", body) != "True") { |
|
448 | if(wasKeyValueGet("status", body) == "19862") { |
437 | if(wasKeyValueGet("status", body) == "19862") { |
|
449 | // DEBUG |
438 | // DEBUG |
|
450 | llOwnerSay("[Ban] User not in group, but proceeding anyway..."); |
439 | llOwnerSay("[Ban] User not in group, but proceeding anyway..."); |
|
451 | jump continue; |
440 | jump continue; |
|
452 | } |
441 | } |
|
453 | // DEBUG |
442 | // DEBUG |
|
454 | llOwnerSay("[Ban] Unable to get member roles: " + |
443 | llOwnerSay("[Ban] Unable to get member roles: " + |
|
455 | wasURLUnescape( |
444 | wasURLUnescape( |
|
456 | wasKeyValueGet("error", body) |
445 | wasKeyValueGet("error", body) |
|
457 | ) |
446 | ) |
|
458 | ); |
447 | ); |
|
459 | llReleaseURL(URL); |
- | ||
460 | state listen_group; |
448 | state listen_group; |
|
461 | } |
449 | } |
|
462 | |
450 | |
|
463 | @continue; |
451 | @continue; |
|
464 | string result = wasURLUnescape( |
452 | string result = wasURLUnescape( |
|
465 | wasKeyValueGet("data", body) |
453 | wasKeyValueGet("data", body) |
|
466 | ); |
454 | ); |
|
467 | |
455 | |
|
468 | if(result != "" && llListFindList(wasCSVToList(result), (list)"Owners") != -1) { |
456 | if(result != "" && llListFindList(wasCSVToList(result), (list)"Owners") != -1) { |
|
469 | data = "Ejectee is an owner. I'm not gunna open the pod bay doors."; |
457 | data = "Ejectee is an owner. I'm not gunna open the pod bay doors."; |
|
470 | llReleaseURL(URL); |
- | ||
471 | state tell; |
458 | state tell; |
|
472 | } |
459 | } |
|
473 | |
460 | |
|
474 | state ban; |
461 | state ban; |
|
475 | } |
462 | } |
|
476 | timer() { |
463 | timer() { |
|
477 | llReleaseURL(URL); |
- | ||
478 | state listen_group; |
464 | state listen_group; |
|
479 | } |
465 | } |
|
480 | on_rez(integer num) { |
466 | on_rez(integer num) { |
|
481 | llResetScript(); |
467 | llResetScript(); |
|
482 | } |
468 | } |
|
483 | changed(integer change) { |
469 | changed(integer change) { |
|
484 | if((change & CHANGED_INVENTORY) || |
470 | if((change & CHANGED_INVENTORY) || |
|
485 | (change & CHANGED_REGION_START) || |
471 | (change & CHANGED_REGION_START) || |
|
486 | (change & CHANGED_OWNER)) { |
472 | (change & CHANGED_OWNER)) { |
|
487 | llResetScript(); |
473 | llResetScript(); |
|
488 | } |
474 | } |
|
489 | } |
475 | } |
|
490 | state_exit() { |
476 | state_exit() { |
|
Line 496... | Line 482... | |||
496 | state_entry() { |
482 | state_entry() { |
|
497 | // DEBUG |
483 | // DEBUG |
|
498 | llOwnerSay("[Ban] Banning..."); |
484 | llOwnerSay("[Ban] Banning..."); |
|
499 | llInstantMessage( |
485 | llInstantMessage( |
|
500 | wasKeyValueGet( |
486 | wasKeyValueGet( |
|
501 | "corrade", |
487 | "corrade", |
|
502 | configuration |
488 | configuration |
|
503 | ), |
489 | ), |
|
504 | wasKeyValueEncode( |
490 | wasKeyValueEncode( |
|
505 | [ |
491 | [ |
|
506 | "command", "ban", |
492 | "command", "ban", |
|
507 | "group", wasURLEscape( |
493 | "group", wasURLEscape( |
|
508 | wasKeyValueGet( |
494 | wasKeyValueGet( |
|
509 | "group", |
495 | "group", |
|
510 | configuration |
496 | configuration |
|
511 | ) |
497 | ) |
|
512 | ), |
498 | ), |
|
513 | "password", wasURLEscape( |
499 | "password", wasURLEscape( |
|
514 | wasKeyValueGet( |
500 | wasKeyValueGet( |
|
515 | "password", |
501 | "password", |
|
516 | configuration |
502 | configuration |
|
517 | ) |
503 | ) |
|
518 | ), |
504 | ), |
|
519 | "soft", soft, |
505 | "soft", soft, |
|
520 | "action", "ban", |
506 | "action", "ban", |
|
Line 524... | Line 510... | |||
524 | firstname + " " + lastname |
510 | firstname + " " + lastname |
|
525 | ] |
511 | ] |
|
526 | ) |
512 | ) |
|
527 | ), |
513 | ), |
|
528 | "eject", "True", |
514 | "eject", "True", |
|
529 | "callback", wasURLEscape(URL) |
515 | "callback", wasURLEscape( |
|
- | 516 | wasKeyValueGet( |
||
- | 517 | "URL", |
||
- | 518 | configuration |
||
- | 519 | ) |
||
- | 520 | ) |
||
530 | ] |
521 | ] |
|
531 | ) |
522 | ) |
|
532 | ); |
523 | ); |
|
533 | llSetTimerEvent(60); |
524 | llSetTimerEvent(60); |
|
534 | } |
525 | } |
|
535 | http_request(key id, string method, string body) { |
526 | link_message(integer sender, integer num, string body, key id) { |
|
536 | llHTTPResponse(id, 200, "OK"); |
527 | // Only process callbacks for the database command. |
|
- | 528 | if(id != "callback" || wasKeyValueGet("command", body) != "ban") |
||
537 | llReleaseURL(URL); |
529 | return; |
|
- | 530 | |
||
538 | if(wasKeyValueGet("command", body) != "ban" || |
531 | if(wasKeyValueGet("command", body) != "ban" || |
|
539 | wasKeyValueGet("success", body) != "True") { |
532 | wasKeyValueGet("success", body) != "True") { |
|
540 | // DEBUG |
533 | // DEBUG |
|
541 | llOwnerSay("[Ban] Unable to ban member: " + |
534 | llOwnerSay("[Ban] Unable to ban member: " + |
|
542 | wasURLUnescape( |
535 | wasURLUnescape( |
|
543 | wasKeyValueGet("error", body) |
536 | wasKeyValueGet("error", body) |
|
544 | ) |
537 | ) |
|
545 | ); |
538 | ); |
|
546 | state listen_group; |
539 | state listen_group; |
|
547 | } |
540 | } |
|
548 | |
541 | |
|
549 | data = "Hasta la vista, baby!"; |
542 | data = "Hasta la vista, baby!"; |
|
550 | |
543 | |
|
551 | state tell; |
544 | state tell; |
|
552 | } |
545 | } |
|
553 | timer() { |
546 | timer() { |
|
554 | llReleaseURL(URL); |
- | ||
555 | state listen_group; |
547 | state listen_group; |
|
556 | } |
548 | } |
|
557 | on_rez(integer num) { |
549 | on_rez(integer num) { |
|
558 | llResetScript(); |
550 | llResetScript(); |
|
559 | } |
551 | } |
|
560 | changed(integer change) { |
552 | changed(integer change) { |
|
561 | if((change & CHANGED_INVENTORY) || |
553 | if((change & CHANGED_INVENTORY) || |
|
562 | (change & CHANGED_REGION_START) || |
554 | (change & CHANGED_REGION_START) || |
|
563 | (change & CHANGED_OWNER)) { |
555 | (change & CHANGED_OWNER)) { |
|
564 | llResetScript(); |
556 | llResetScript(); |
|
565 | } |
557 | } |
|
566 | } |
558 | } |
|
567 | state_exit() { |
559 | state_exit() { |
|
Line 573... | Line 565... | |||
573 | state_entry() { |
565 | state_entry() { |
|
574 | // DEBUG |
566 | // DEBUG |
|
575 | llOwnerSay("[Ban] Sending to group."); |
567 | llOwnerSay("[Ban] Sending to group."); |
|
576 | llInstantMessage( |
568 | llInstantMessage( |
|
577 | wasKeyValueGet( |
569 | wasKeyValueGet( |
|
578 | "corrade", |
570 | "corrade", |
|
579 | configuration |
571 | configuration |
|
580 | ), |
572 | ), |
|
581 | wasKeyValueEncode( |
573 | wasKeyValueEncode( |
|
582 | [ |
574 | [ |
|
583 | "command", "tell", |
575 | "command", "tell", |
|
584 | "group", wasURLEscape( |
576 | "group", wasURLEscape( |
|
585 | wasKeyValueGet( |
577 | wasKeyValueGet( |
|
586 | "group", |
578 | "group", |
|
587 | configuration |
579 | configuration |
|
588 | ) |
580 | ) |
|
589 | ), |
581 | ), |
|
590 | "password", wasURLEscape( |
582 | "password", wasURLEscape( |
|
591 | wasKeyValueGet( |
583 | wasKeyValueGet( |
|
592 | "password", |
584 | "password", |
|
593 | configuration |
585 | configuration |
|
594 | ) |
586 | ) |
|
595 | ), |
587 | ), |
|
596 | "entity", "group", |
588 | "entity", "group", |
|
597 | "message", wasURLEscape(data) |
589 | "message", wasURLEscape(data) |
|
598 | ] |
590 | ] |
|
599 | ) |
591 | ) |
|
600 | ); |
592 | ); |
|
601 | |
593 | |
|
602 | // reset variables. |
594 | // reset variables. |
|
603 | soft = "True"; |
595 | soft = "True"; |
|
604 | |
596 | |
|
605 | state listen_group; |
597 | state listen_group; |
|
606 | } |
598 | } |
|
607 | } |
599 | } |