corrade-lsl-templates – Diff between revs 29 and 41
?pathlinks?
Rev 29 | Rev 41 | |||
---|---|---|---|---|
1 | /////////////////////////////////////////////////////////////////////////// |
1 | /////////////////////////////////////////////////////////////////////////// |
|
2 | // Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
2 | // Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
|
3 | /////////////////////////////////////////////////////////////////////////// |
3 | /////////////////////////////////////////////////////////////////////////// |
|
4 | // |
4 | // |
|
5 | // A module that unbans group members using fuzzy name matching. |
5 | // A module that unbans group members using fuzzy name matching. |
|
6 | // |
6 | // |
|
7 | /////////////////////////////////////////////////////////////////////////// |
7 | /////////////////////////////////////////////////////////////////////////// |
|
8 | |
8 | |
|
9 | /////////////////////////////////////////////////////////////////////////// |
9 | /////////////////////////////////////////////////////////////////////////// |
|
10 | // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 // |
10 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
|
11 | /////////////////////////////////////////////////////////////////////////// |
11 | /////////////////////////////////////////////////////////////////////////// |
|
12 | string wasKeyValueGet(string k, string data) { |
12 | string wasKeyValueGet(string k, string data) { |
|
13 | if(llStringLength(data) == 0) return ""; |
13 | if(llStringLength(data) == 0) return ""; |
|
14 | if(llStringLength(k) == 0) return ""; |
14 | if(llStringLength(k) == 0) return ""; |
|
15 | list a = llParseString2List(data, ["&", "="], []); |
15 | list a = llParseStringKeepNulls(data, ["&", "="], []); |
|
16 | integer i = llListFindList(a, [ k ]); |
16 | integer i = llListFindList(llList2ListStrided(a, 0, -1, 2), [ k ]); |
|
17 | if(i != -1) return llList2String(a, 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: CC BY 2.0 // |
|
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 = []; |
|
28 | do { |
28 | do { |
|
29 | data += llList2String(k, 0) + "=" + llList2String(v, 0); |
29 | data += llList2String(k, 0) + "=" + llList2String(v, 0); |
|
30 | k = llDeleteSubList(k, 0, 0); |
30 | k = llDeleteSubList(k, 0, 0); |
|
31 | v = llDeleteSubList(v, 0, 0); |
31 | v = llDeleteSubList(v, 0, 0); |
|
32 | } while(llGetListLength(k) != 0); |
32 | } while(llGetListLength(k) != 0); |
|
33 | return llDumpList2String(data, "&"); |
33 | return llDumpList2String(data, "&"); |
|
34 | } |
34 | } |
|
35 | |
35 | |
|
36 | /////////////////////////////////////////////////////////////////////////// |
36 | /////////////////////////////////////////////////////////////////////////// |
|
37 | // Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
37 | // Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
|
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); |
|
42 | float y = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); |
42 | float y = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); |
|
43 | if(llPow(x,2) + llPow(y,2) <= llPow(radius,2)) |
43 | if(llPow(x,2) + llPow(y,2) <= llPow(radius,2)) |
|
44 | return <x, y, 0>; |
44 | return <x, y, 0>; |
|
45 | return wasCirclePoint(radius); |
45 | return wasCirclePoint(radius); |
|
46 | } |
46 | } |
|
47 | |
47 | |
|
48 | /////////////////////////////////////////////////////////////////////////// |
48 | /////////////////////////////////////////////////////////////////////////// |
|
49 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
49 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
|
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 = ""; |
|
54 | do { |
54 | do { |
|
55 | string c = llGetSubString(i, 0, 0); |
55 | string c = llGetSubString(i, 0, 0); |
|
56 | i = llDeleteSubString(i, 0, 0); |
56 | i = llDeleteSubString(i, 0, 0); |
|
57 | if(c == "") jump continue; |
57 | if(c == "") jump continue; |
|
58 | if(c == " ") { |
58 | if(c == " ") { |
|
59 | o += "+"; |
59 | o += "+"; |
|
60 | jump continue; |
60 | jump continue; |
|
61 | } |
61 | } |
|
62 | if(c == "\n") { |
62 | if(c == "\n") { |
|
63 | o += "%0D" + llEscapeURL(c); |
63 | o += "%0D" + llEscapeURL(c); |
|
64 | jump continue; |
64 | jump continue; |
|
65 | } |
65 | } |
|
66 | o += llEscapeURL(c); |
66 | o += llEscapeURL(c); |
|
67 | @continue; |
67 | @continue; |
|
68 | } while(i != ""); |
68 | } while(i != ""); |
|
69 | return o; |
69 | return o; |
|
70 | } |
70 | } |
|
71 | |
71 | |
|
72 | /////////////////////////////////////////////////////////////////////////// |
72 | /////////////////////////////////////////////////////////////////////////// |
|
73 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
73 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
|
74 | /////////////////////////////////////////////////////////////////////////// |
74 | /////////////////////////////////////////////////////////////////////////// |
|
75 | list wasCSVToList(string csv) { |
75 | list wasCSVToList(string csv) { |
|
76 | list l = []; |
76 | list l = []; |
|
77 | list s = []; |
77 | list s = []; |
|
78 | string m = ""; |
78 | string m = ""; |
|
79 | do { |
79 | do { |
|
80 | string a = llGetSubString(csv, 0, 0); |
80 | string a = llGetSubString(csv, 0, 0); |
|
81 | csv = llDeleteSubString(csv, 0, 0); |
81 | csv = llDeleteSubString(csv, 0, 0); |
|
82 | if(a == ",") { |
82 | if(a == ",") { |
|
83 | if(llList2String(s, -1) != "\"") { |
83 | if(llList2String(s, -1) != "\"") { |
|
84 | l += m; |
84 | l += m; |
|
85 | m = ""; |
85 | m = ""; |
|
86 | jump continue; |
86 | jump continue; |
|
87 | } |
87 | } |
|
88 | m += a; |
88 | m += a; |
|
89 | jump continue; |
89 | jump continue; |
|
90 | } |
90 | } |
|
91 | if(a == "\"" && llGetSubString(csv, 0, 0) == a) { |
91 | if(a == "\"" && llGetSubString(csv, 0, 0) == a) { |
|
92 | m += a; |
92 | m += a; |
|
93 | csv = llDeleteSubString(csv, 0, 0); |
93 | csv = llDeleteSubString(csv, 0, 0); |
|
94 | jump continue; |
94 | jump continue; |
|
95 | } |
95 | } |
|
96 | if(a == "\"") { |
96 | if(a == "\"") { |
|
97 | if(llList2String(s, -1) != a) { |
97 | if(llList2String(s, -1) != a) { |
|
98 | s += a; |
98 | s += a; |
|
99 | jump continue; |
99 | jump continue; |
|
100 | } |
100 | } |
|
101 | s = llDeleteSubList(s, -1, -1); |
101 | s = llDeleteSubList(s, -1, -1); |
|
102 | jump continue; |
102 | jump continue; |
|
103 | } |
103 | } |
|
104 | m += a; |
104 | m += a; |
|
105 | @continue; |
105 | @continue; |
|
106 | } while(csv != ""); |
106 | } while(csv != ""); |
|
107 | // postcondition: length(s) = 0 |
107 | // postcondition: length(s) = 0 |
|
108 | return l + m; |
108 | return l + m; |
|
109 | } |
109 | } |
|
110 | |
110 | |
|
111 | /////////////////////////////////////////////////////////////////////////// |
111 | /////////////////////////////////////////////////////////////////////////// |
|
112 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
112 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
|
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, ","); |
|
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: CC BY 2.0 // |
|
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 | ) |
|
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: CC BY 2.0 // |
|
166 | /////////////////////////////////////////////////////////////////////////// |
166 | /////////////////////////////////////////////////////////////////////////// |
|
167 | list wasSetIntersect(list a, list b) { |
167 | list wasSetIntersect(list a, list b) { |
|
168 | if(llGetListLength(a) == 0) return []; |
168 | if(llGetListLength(a) == 0) return []; |
|
169 | string i = llList2String(a, 0); |
169 | string i = llList2String(a, 0); |
|
170 | a = llDeleteSubList(a, 0, 0); |
170 | a = llDeleteSubList(a, 0, 0); |
|
171 | if(llListFindList(b, (list)i) == -1) |
171 | if(llListFindList(b, (list)i) == -1) |
|
172 | return wasSetIntersect(a, b); |
172 | return wasSetIntersect(a, b); |
|
173 | return i + wasSetIntersect(a, b); |
173 | return i + wasSetIntersect(a, b); |
|
174 | } |
174 | } |
|
175 | |
175 | |
|
176 | // configuration data |
176 | // configuration data |
|
177 | string configuration = ""; |
177 | string configuration = ""; |
|
178 | // callback URL |
178 | // callback URL |
|
179 | string URL = ""; |
179 | string URL = ""; |
|
180 | // store message over state. |
180 | // store message over state. |
|
181 | string data = ""; |
181 | string data = ""; |
|
182 | // banee |
182 | // banee |
|
183 | string firstname = ""; |
183 | string firstname = ""; |
|
184 | string lastname = ""; |
184 | string lastname = ""; |
|
185 | string soft = "True"; |
185 | string soft = "True"; |
|
186 | |
186 | |
|
187 | default { |
187 | default { |
|
188 | state_entry() { |
188 | state_entry() { |
|
189 | llOwnerSay("[Unban] Starting..."); |
189 | llOwnerSay("[Unban] Starting..."); |
|
190 | llSetTimerEvent(10); |
190 | llSetTimerEvent(10); |
|
191 | } |
191 | } |
|
192 | link_message(integer sender, integer num, string message, key id) { |
192 | link_message(integer sender, integer num, string message, key id) { |
|
193 | if(id != "configuration") return; |
193 | if(id != "configuration") return; |
|
194 | llOwnerSay("[Unban] Got configuration..."); |
194 | llOwnerSay("[Unban] Got configuration..."); |
|
195 | configuration = message; |
195 | configuration = message; |
|
196 | state listen_group; |
196 | state listen_group; |
|
197 | } |
197 | } |
|
198 | timer() { |
198 | timer() { |
|
199 | llOwnerSay("[Unban] Requesting configuration..."); |
199 | llOwnerSay("[Unban] Requesting configuration..."); |
|
200 | llMessageLinked(LINK_THIS, 0, "configuration", NULL_KEY); |
200 | llMessageLinked(LINK_THIS, 0, "configuration", NULL_KEY); |
|
201 | } |
201 | } |
|
202 | on_rez(integer num) { |
202 | on_rez(integer num) { |
|
203 | llResetScript(); |
203 | llResetScript(); |
|
204 | } |
204 | } |
|
205 | changed(integer change) { |
205 | changed(integer change) { |
|
206 | if((change & CHANGED_INVENTORY) || |
206 | if((change & CHANGED_INVENTORY) || |
|
207 | (change & CHANGED_REGION_START) || |
207 | (change & CHANGED_REGION_START) || |
|
208 | (change & CHANGED_OWNER)) { |
208 | (change & CHANGED_OWNER)) { |
|
209 | llResetScript(); |
209 | llResetScript(); |
|
210 | } |
210 | } |
|
211 | } |
211 | } |
|
212 | state_exit() { |
212 | state_exit() { |
|
213 | llSetTimerEvent(0); |
213 | llSetTimerEvent(0); |
|
214 | } |
214 | } |
|
215 | } |
215 | } |
|
216 | |
216 | |
|
217 | state listen_group { |
217 | state listen_group { |
|
218 | state_entry() { |
218 | state_entry() { |
|
219 | // DEBUG |
219 | // DEBUG |
|
220 | llOwnerSay("[Unban] Waiting for group messages..."); |
220 | llOwnerSay("[Unban] Waiting for group messages..."); |
|
221 | } |
221 | } |
|
222 | link_message(integer sender, integer num, string message, key id) { |
222 | link_message(integer sender, integer num, string message, key id) { |
|
223 | // We only care about notifications now. |
223 | // We only care about notifications now. |
|
224 | if(id != "notification") |
224 | if(id != "notification") |
|
225 | return; |
225 | return; |
|
226 | |
226 | |
|
227 | // This script only processes group notifications. |
227 | // This script only processes group notifications. |
|
228 | if(wasKeyValueGet("type", message) != "group") |
228 | if(wasKeyValueGet("type", message) != "group") |
|
229 | return; |
229 | return; |
|
230 | |
230 | |
|
231 | // Get the sent message. |
231 | // Get the sent message. |
|
232 | data = wasURLUnescape( |
232 | data = wasURLUnescape( |
|
233 | wasKeyValueGet( |
233 | wasKeyValueGet( |
|
234 | "message", |
234 | "message", |
|
235 | message |
235 | message |
|
236 | ) |
236 | ) |
|
237 | ); |
237 | ); |
|
238 | |
238 | |
|
239 | // Check if this is an eggdrop command. |
239 | // Check if this is an eggdrop command. |
|
240 | if(llGetSubString(data, 0, 0) != |
240 | if(llGetSubString(data, 0, 0) != |
|
241 | wasKeyValueGet("command", configuration)) |
241 | wasKeyValueGet("command", configuration)) |
|
242 | return; |
242 | return; |
|
243 | |
243 | |
|
244 | // Check if the command matches the current module. |
244 | // Check if the command matches the current module. |
|
245 | list command = llParseString2List(data, [" "], []); |
245 | list command = llParseString2List(data, [" "], []); |
|
246 | if(llList2String(command, 0) != |
246 | if(llList2String(command, 0) != |
|
247 | wasKeyValueGet("command", configuration) + "unban") |
247 | wasKeyValueGet("command", configuration) + "unban") |
|
248 | return; |
248 | return; |
|
249 | |
249 | |
|
250 | // Remove command. |
250 | // Remove command. |
|
251 | command = llDeleteSubList(command, 0, 0); |
251 | command = llDeleteSubList(command, 0, 0); |
|
252 | |
252 | |
|
253 | firstname = wasKeyValueGet("firstname", message); |
253 | firstname = wasKeyValueGet("firstname", message); |
|
254 | lastname = wasKeyValueGet("lastname", message); |
254 | lastname = wasKeyValueGet("lastname", message); |
|
255 | |
255 | |
|
256 | if(firstname == "" || lastname == "") { |
256 | if(firstname == "" || lastname == "") { |
|
257 | data = "And who would yarr be?"; |
257 | data = "And who would yarr be?"; |
|
258 | state tell; |
258 | state tell; |
|
259 | } |
259 | } |
|
260 | |
260 | |
|
261 | // Dump the rest of the message. |
261 | // Dump the rest of the message. |
|
262 | data = llDumpList2String(command, " "); |
262 | data = llDumpList2String(command, " "); |
|
263 | |
263 | |
|
264 | // Get an URL. |
264 | // Get an URL. |
|
265 | state url; |
265 | state url; |
|
266 | } |
266 | } |
|
267 | on_rez(integer num) { |
267 | on_rez(integer num) { |
|
268 | llResetScript(); |
268 | llResetScript(); |
|
269 | } |
269 | } |
|
270 | changed(integer change) { |
270 | changed(integer change) { |
|
271 | if((change & CHANGED_INVENTORY) || |
271 | if((change & CHANGED_INVENTORY) || |
|
272 | (change & CHANGED_REGION_START) || |
272 | (change & CHANGED_REGION_START) || |
|
273 | (change & CHANGED_OWNER)) { |
273 | (change & CHANGED_OWNER)) { |
|
274 | llResetScript(); |
274 | llResetScript(); |
|
275 | } |
275 | } |
|
276 | } |
276 | } |
|
277 | } |
277 | } |
|
278 | |
278 | |
|
279 | state url { |
279 | state url { |
|
280 | state_entry() { |
280 | state_entry() { |
|
281 | // DEBUG |
281 | // DEBUG |
|
282 | llOwnerSay("[Unban] Requesting URL..."); |
282 | llOwnerSay("[Unban] Requesting URL..."); |
|
283 | llRequestURL(); |
283 | llRequestURL(); |
|
284 | } |
284 | } |
|
285 | http_request(key id, string method, string body) { |
285 | http_request(key id, string method, string body) { |
|
286 | if(method != URL_REQUEST_GRANTED) return; |
286 | if(method != URL_REQUEST_GRANTED) return; |
|
287 | URL = body; |
287 | URL = body; |
|
288 | // DEBUG |
288 | // DEBUG |
|
289 | llOwnerSay("[Unban] Got URL..."); |
289 | llOwnerSay("[Unban] Got URL..."); |
|
290 | state get_caller_roles; |
290 | state get_caller_roles; |
|
291 | } |
291 | } |
|
292 | on_rez(integer num) { |
292 | on_rez(integer num) { |
|
293 | llResetScript(); |
293 | llResetScript(); |
|
294 | } |
294 | } |
|
295 | changed(integer change) { |
295 | changed(integer change) { |
|
296 | if((change & CHANGED_INVENTORY) || |
296 | if((change & CHANGED_INVENTORY) || |
|
297 | (change & CHANGED_REGION_START) || |
297 | (change & CHANGED_REGION_START) || |
|
298 | (change & CHANGED_OWNER)) { |
298 | (change & CHANGED_OWNER)) { |
|
299 | llResetScript(); |
299 | llResetScript(); |
|
300 | } |
300 | } |
|
301 | } |
301 | } |
|
302 | } |
302 | } |
|
303 | |
303 | |
|
304 | state get_caller_roles { |
304 | state get_caller_roles { |
|
305 | state_entry() { |
305 | state_entry() { |
|
306 | // DEBUG |
306 | // DEBUG |
|
307 | llOwnerSay("[Unban] Searching for caller..."); |
307 | llOwnerSay("[Unban] Searching for caller..."); |
|
308 | llInstantMessage( |
308 | llInstantMessage( |
|
309 | wasKeyValueGet( |
309 | wasKeyValueGet( |
|
310 | "corrade", |
310 | "corrade", |
|
311 | configuration |
311 | configuration |
|
312 | ), |
312 | ), |
|
313 | wasKeyValueEncode( |
313 | wasKeyValueEncode( |
|
314 | [ |
314 | [ |
|
315 | "command", "getmemberroles", |
315 | "command", "getmemberroles", |
|
316 | "group", wasURLEscape( |
316 | "group", wasURLEscape( |
|
317 | wasKeyValueGet( |
317 | wasKeyValueGet( |
|
318 | "group", |
318 | "group", |
|
319 | configuration |
319 | configuration |
|
320 | ) |
320 | ) |
|
321 | ), |
321 | ), |
|
322 | "password", wasURLEscape( |
322 | "password", wasURLEscape( |
|
323 | wasKeyValueGet( |
323 | wasKeyValueGet( |
|
324 | "password", |
324 | "password", |
|
325 | configuration |
325 | configuration |
|
326 | ) |
326 | ) |
|
327 | ), |
327 | ), |
|
328 | "firstname", firstname, |
328 | "firstname", firstname, |
|
329 | "lastname", lastname, |
329 | "lastname", lastname, |
|
330 | "callback", wasURLEscape(URL) |
330 | "callback", wasURLEscape(URL) |
|
331 | ] |
331 | ] |
|
332 | ) |
332 | ) |
|
333 | ); |
333 | ); |
|
334 | llSetTimerEvent(60); |
334 | llSetTimerEvent(60); |
|
335 | } |
335 | } |
|
336 | http_request(key id, string method, string body) { |
336 | http_request(key id, string method, string body) { |
|
337 | llHTTPResponse(id, 200, "OK"); |
337 | llHTTPResponse(id, 200, "OK"); |
|
338 | if(wasKeyValueGet("command", body) != "getmemberroles" || |
338 | if(wasKeyValueGet("command", body) != "getmemberroles" || |
|
339 | wasKeyValueGet("success", body) != "True") { |
339 | wasKeyValueGet("success", body) != "True") { |
|
340 | // DEBUG |
340 | // DEBUG |
|
341 | llOwnerSay("[Unban] Unable to get member roles: " + |
341 | llOwnerSay("[Unban] Unable to get member roles: " + |
|
342 | wasURLUnescape( |
342 | wasURLUnescape( |
|
343 | wasKeyValueGet("error", body) |
343 | wasKeyValueGet("error", body) |
|
344 | ) |
344 | ) |
|
345 | ); |
345 | ); |
|
346 | llReleaseURL(URL); |
346 | llReleaseURL(URL); |
|
347 | state listen_group; |
347 | state listen_group; |
|
348 | } |
348 | } |
|
349 | |
349 | |
|
350 | // Dump the roles to a list. |
350 | // Dump the roles to a list. |
|
351 | list roles = wasCSVToList( |
351 | list roles = wasCSVToList( |
|
352 | wasURLUnescape( |
352 | wasURLUnescape( |
|
353 | wasKeyValueGet("data", body) |
353 | wasKeyValueGet("data", body) |
|
354 | ) |
354 | ) |
|
355 | ); |
355 | ); |
|
356 | |
356 | |
|
357 | if(llGetListLength( |
357 | if(llGetListLength( |
|
358 | wasSetIntersect(roles, |
358 | wasSetIntersect(roles, |
|
359 | wasCSVToList( |
359 | wasCSVToList( |
|
360 | wasKeyValueGet( |
360 | wasKeyValueGet( |
|
361 | "admin roles", configuration |
361 | "admin roles", configuration |
|
362 | ) |
362 | ) |
|
363 | ) |
363 | ) |
|
364 | ) |
364 | ) |
|
365 | ) == 0) { |
365 | ) == 0) { |
|
366 | data = "You ain't got the cojones!"; |
366 | data = "You ain't got the cojones!"; |
|
367 | llReleaseURL(URL); |
367 | llReleaseURL(URL); |
|
368 | state tell; |
368 | state tell; |
|
369 | } |
369 | } |
|
370 | |
370 | |
|
371 | list banee = llParseString2List(data, [" "], []); |
371 | list banee = llParseString2List(data, [" "], []); |
|
372 | |
372 | |
|
373 | firstname = llList2String(banee, 0); |
373 | firstname = llList2String(banee, 0); |
|
374 | banee = llDeleteSubList(banee, 0, 0); |
374 | banee = llDeleteSubList(banee, 0, 0); |
|
375 | lastname = llList2String(banee, 0); |
375 | lastname = llList2String(banee, 0); |
|
376 | banee = llDeleteSubList(banee, 0, 0); |
376 | banee = llDeleteSubList(banee, 0, 0); |
|
377 | |
377 | |
|
378 | if(firstname == "" || lastname == "") { |
378 | if(firstname == "" || lastname == "") { |
|
379 | data = "Full name required."; |
379 | data = "Full name required."; |
|
380 | state tell; |
380 | state tell; |
|
381 | } |
381 | } |
|
382 | |
382 | |
|
383 | if(llGetListLength(banee) != 0 && |
383 | if(llGetListLength(banee) != 0 && |
|
384 | llToLower(llList2String(banee, 0)) == "nosoft") { |
384 | llToLower(llList2String(banee, 0)) == "nosoft") { |
|
385 | soft = "False"; |
385 | soft = "False"; |
|
386 | banee = llDeleteSubList(banee, 0, 0); |
386 | banee = llDeleteSubList(banee, 0, 0); |
|
387 | } |
387 | } |
|
388 | |
388 | |
|
389 | // GC |
389 | // GC |
|
390 | banee = []; |
390 | banee = []; |
|
391 | state get_banee_roles; |
391 | state get_banee_roles; |
|
392 | } |
392 | } |
|
393 | timer() { |
393 | timer() { |
|
394 | llReleaseURL(URL); |
394 | llReleaseURL(URL); |
|
395 | state listen_group; |
395 | state listen_group; |
|
396 | } |
396 | } |
|
397 | on_rez(integer num) { |
397 | on_rez(integer num) { |
|
398 | llResetScript(); |
398 | llResetScript(); |
|
399 | } |
399 | } |
|
400 | changed(integer change) { |
400 | changed(integer change) { |
|
401 | if((change & CHANGED_INVENTORY) || |
401 | if((change & CHANGED_INVENTORY) || |
|
402 | (change & CHANGED_REGION_START) || |
402 | (change & CHANGED_REGION_START) || |
|
403 | (change & CHANGED_OWNER)) { |
403 | (change & CHANGED_OWNER)) { |
|
404 | llResetScript(); |
404 | llResetScript(); |
|
405 | } |
405 | } |
|
406 | } |
406 | } |
|
407 | state_exit() { |
407 | state_exit() { |
|
408 | llSetTimerEvent(0); |
408 | llSetTimerEvent(0); |
|
409 | } |
409 | } |
|
410 | } |
410 | } |
|
411 | |
411 | |
|
412 | state get_banee_roles { |
412 | state get_banee_roles { |
|
413 | state_entry() { |
413 | state_entry() { |
|
414 | // DEBUG |
414 | // DEBUG |
|
415 | llOwnerSay("[Unban] Searching for banee..."); |
415 | llOwnerSay("[Unban] Searching for banee..."); |
|
416 | llInstantMessage( |
416 | llInstantMessage( |
|
417 | wasKeyValueGet( |
417 | wasKeyValueGet( |
|
418 | "corrade", |
418 | "corrade", |
|
419 | configuration |
419 | configuration |
|
420 | ), |
420 | ), |
|
421 | wasKeyValueEncode( |
421 | wasKeyValueEncode( |
|
422 | [ |
422 | [ |
|
423 | "command", "getmemberroles", |
423 | "command", "getmemberroles", |
|
424 | "group", wasURLEscape( |
424 | "group", wasURLEscape( |
|
425 | wasKeyValueGet( |
425 | wasKeyValueGet( |
|
426 | "group", |
426 | "group", |
|
427 | configuration |
427 | configuration |
|
428 | ) |
428 | ) |
|
429 | ), |
429 | ), |
|
430 | "password", wasURLEscape( |
430 | "password", wasURLEscape( |
|
431 | wasKeyValueGet( |
431 | wasKeyValueGet( |
|
432 | "password", |
432 | "password", |
|
433 | configuration |
433 | configuration |
|
434 | ) |
434 | ) |
|
435 | ), |
435 | ), |
|
436 | "firstname", firstname, |
436 | "firstname", firstname, |
|
437 | "lastname", lastname, |
437 | "lastname", lastname, |
|
438 | "callback", wasURLEscape(URL) |
438 | "callback", wasURLEscape(URL) |
|
439 | ] |
439 | ] |
|
440 | ) |
440 | ) |
|
441 | ); |
441 | ); |
|
442 | llSetTimerEvent(60); |
442 | llSetTimerEvent(60); |
|
443 | } |
443 | } |
|
444 | http_request(key id, string method, string body) { |
444 | http_request(key id, string method, string body) { |
|
445 | llHTTPResponse(id, 200, "OK"); |
445 | llHTTPResponse(id, 200, "OK"); |
|
446 | if(wasKeyValueGet("command", body) != "getmemberroles" || |
446 | if(wasKeyValueGet("command", body) != "getmemberroles" || |
|
447 | wasKeyValueGet("success", body) != "True") { |
447 | wasKeyValueGet("success", body) != "True") { |
|
448 | if(wasKeyValueGet("status", body) == "19862") { |
448 | if(wasKeyValueGet("status", body) == "19862") { |
|
449 | // DEBUG |
449 | // DEBUG |
|
450 | llOwnerSay("[Unban] User not in group, but proceeding anyway..."); |
450 | llOwnerSay("[Unban] User not in group, but proceeding anyway..."); |
|
451 | jump continue; |
451 | jump continue; |
|
452 | } |
452 | } |
|
453 | // DEBUG |
453 | // DEBUG |
|
454 | llOwnerSay("[Unban] Unable to get member roles: " + |
454 | llOwnerSay("[Unban] Unable to get member roles: " + |
|
455 | wasURLUnescape( |
455 | wasURLUnescape( |
|
456 | wasKeyValueGet("error", body) |
456 | wasKeyValueGet("error", body) |
|
457 | ) |
457 | ) |
|
458 | ); |
458 | ); |
|
459 | llReleaseURL(URL); |
459 | llReleaseURL(URL); |
|
460 | state listen_group; |
460 | state listen_group; |
|
461 | } |
461 | } |
|
462 | |
462 | |
|
463 | string result = wasURLUnescape( |
463 | string result = wasURLUnescape( |
|
464 | wasKeyValueGet("data", body) |
464 | wasKeyValueGet("data", body) |
|
465 | ); |
465 | ); |
|
466 | |
466 | |
|
467 | if(result != "" && llListFindList(wasCSVToList(result), (list)"Owners") != -1) { |
467 | if(result != "" && llListFindList(wasCSVToList(result), (list)"Owners") != -1) { |
|
468 | data = "Ejectee is an owner. I'm not gonna open the pod bay doors."; |
468 | data = "Ejectee is an owner. I'm not gonna open the pod bay doors."; |
|
469 | llReleaseURL(URL); |
469 | llReleaseURL(URL); |
|
470 | state tell; |
470 | state tell; |
|
471 | } |
471 | } |
|
472 | |
472 | |
|
473 | @continue; |
473 | @continue; |
|
474 | |
474 | |
|
475 | state unban; |
475 | state unban; |
|
476 | } |
476 | } |
|
477 | timer() { |
477 | timer() { |
|
478 | llReleaseURL(URL); |
478 | llReleaseURL(URL); |
|
479 | state listen_group; |
479 | state listen_group; |
|
480 | } |
480 | } |
|
481 | on_rez(integer num) { |
481 | on_rez(integer num) { |
|
482 | llResetScript(); |
482 | llResetScript(); |
|
483 | } |
483 | } |
|
484 | changed(integer change) { |
484 | changed(integer change) { |
|
485 | if((change & CHANGED_INVENTORY) || |
485 | if((change & CHANGED_INVENTORY) || |
|
486 | (change & CHANGED_REGION_START) || |
486 | (change & CHANGED_REGION_START) || |
|
487 | (change & CHANGED_OWNER)) { |
487 | (change & CHANGED_OWNER)) { |
|
488 | llResetScript(); |
488 | llResetScript(); |
|
489 | } |
489 | } |
|
490 | } |
490 | } |
|
491 | state_exit() { |
491 | state_exit() { |
|
492 | llSetTimerEvent(0); |
492 | llSetTimerEvent(0); |
|
493 | } |
493 | } |
|
494 | } |
494 | } |
|
495 | |
495 | |
|
496 | state unban { |
496 | state unban { |
|
497 | state_entry() { |
497 | state_entry() { |
|
498 | // DEBUG |
498 | // DEBUG |
|
499 | llOwnerSay("[Unban] Unbanning..."); |
499 | llOwnerSay("[Unban] Unbanning..."); |
|
500 | llInstantMessage( |
500 | llInstantMessage( |
|
501 | wasKeyValueGet( |
501 | wasKeyValueGet( |
|
502 | "corrade", |
502 | "corrade", |
|
503 | configuration |
503 | configuration |
|
504 | ), |
504 | ), |
|
505 | wasKeyValueEncode( |
505 | wasKeyValueEncode( |
|
506 | [ |
506 | [ |
|
507 | "command", "ban", |
507 | "command", "ban", |
|
508 | "group", wasURLEscape( |
508 | "group", wasURLEscape( |
|
509 | wasKeyValueGet( |
509 | wasKeyValueGet( |
|
510 | "group", |
510 | "group", |
|
511 | configuration |
511 | configuration |
|
512 | ) |
512 | ) |
|
513 | ), |
513 | ), |
|
514 | "password", wasURLEscape( |
514 | "password", wasURLEscape( |
|
515 | wasKeyValueGet( |
515 | wasKeyValueGet( |
|
516 | "password", |
516 | "password", |
|
517 | configuration |
517 | configuration |
|
518 | ) |
518 | ) |
|
519 | ), |
519 | ), |
|
520 | "soft", soft, |
520 | "soft", soft, |
|
521 | "action", "unban", |
521 | "action", "unban", |
|
522 | "avatars", wasURLEscape( |
522 | "avatars", wasURLEscape( |
|
523 | wasListToCSV( |
523 | wasListToCSV( |
|
524 | [ |
524 | [ |
|
525 | firstname + " " + lastname |
525 | firstname + " " + lastname |
|
526 | ] |
526 | ] |
|
527 | ) |
527 | ) |
|
528 | ), |
528 | ), |
|
529 | "callback", wasURLEscape(URL) |
529 | "callback", wasURLEscape(URL) |
|
530 | ] |
530 | ] |
|
531 | ) |
531 | ) |
|
532 | ); |
532 | ); |
|
533 | llSetTimerEvent(60); |
533 | llSetTimerEvent(60); |
|
534 | } |
534 | } |
|
535 | http_request(key id, string method, string body) { |
535 | http_request(key id, string method, string body) { |
|
536 | llHTTPResponse(id, 200, "OK"); |
536 | llHTTPResponse(id, 200, "OK"); |
|
537 | llReleaseURL(URL); |
537 | llReleaseURL(URL); |
|
538 | if(wasKeyValueGet("command", body) != "ban" || |
538 | if(wasKeyValueGet("command", body) != "ban" || |
|
539 | wasKeyValueGet("success", body) != "True") { |
539 | wasKeyValueGet("success", body) != "True") { |
|
540 | // DEBUG |
540 | // DEBUG |
|
541 | llOwnerSay("[Unban] Unable to ban member: " + |
541 | llOwnerSay("[Unban] Unable to ban member: " + |
|
542 | wasURLUnescape( |
542 | wasURLUnescape( |
|
543 | wasKeyValueGet("error", body) |
543 | wasKeyValueGet("error", body) |
|
544 | ) |
544 | ) |
|
545 | ); |
545 | ); |
|
546 | state listen_group; |
546 | state listen_group; |
|
547 | } |
547 | } |
|
548 | |
548 | |
|
549 | data = "They'll be bak!"; |
549 | data = "They'll be bak!"; |
|
550 | |
550 | |
|
551 | state tell; |
551 | state tell; |
|
552 | } |
552 | } |
|
553 | timer() { |
553 | timer() { |
|
554 | llReleaseURL(URL); |
554 | llReleaseURL(URL); |
|
555 | state listen_group; |
555 | state listen_group; |
|
556 | } |
556 | } |
|
557 | on_rez(integer num) { |
557 | on_rez(integer num) { |
|
558 | llResetScript(); |
558 | llResetScript(); |
|
559 | } |
559 | } |
|
560 | changed(integer change) { |
560 | changed(integer change) { |
|
561 | if((change & CHANGED_INVENTORY) || |
561 | if((change & CHANGED_INVENTORY) || |
|
562 | (change & CHANGED_REGION_START) || |
562 | (change & CHANGED_REGION_START) || |
|
563 | (change & CHANGED_OWNER)) { |
563 | (change & CHANGED_OWNER)) { |
|
564 | llResetScript(); |
564 | llResetScript(); |
|
565 | } |
565 | } |
|
566 | } |
566 | } |
|
567 | state_exit() { |
567 | state_exit() { |
|
568 | llSetTimerEvent(0); |
568 | llSetTimerEvent(0); |
|
569 | } |
569 | } |
|
570 | } |
570 | } |
|
571 | |
571 | |
|
572 | state tell { |
572 | state tell { |
|
573 | state_entry() { |
573 | state_entry() { |
|
574 | // DEBUG |
574 | // DEBUG |
|
575 | llOwnerSay("[Unban] Sending to group."); |
575 | llOwnerSay("[Unban] Sending to group."); |
|
576 | llInstantMessage( |
576 | llInstantMessage( |
|
577 | wasKeyValueGet( |
577 | wasKeyValueGet( |
|
578 | "corrade", |
578 | "corrade", |
|
579 | configuration |
579 | configuration |
|
580 | ), |
580 | ), |
|
581 | wasKeyValueEncode( |
581 | wasKeyValueEncode( |
|
582 | [ |
582 | [ |
|
583 | "command", "tell", |
583 | "command", "tell", |
|
584 | "group", wasURLEscape( |
584 | "group", wasURLEscape( |
|
585 | wasKeyValueGet( |
585 | wasKeyValueGet( |
|
586 | "group", |
586 | "group", |
|
587 | configuration |
587 | configuration |
|
588 | ) |
588 | ) |
|
589 | ), |
589 | ), |
|
590 | "password", wasURLEscape( |
590 | "password", wasURLEscape( |
|
591 | wasKeyValueGet( |
591 | wasKeyValueGet( |
|
592 | "password", |
592 | "password", |
|
593 | configuration |
593 | configuration |
|
594 | ) |
594 | ) |
|
595 | ), |
595 | ), |
|
596 | "entity", "group", |
596 | "entity", "group", |
|
597 | "message", wasURLEscape(data) |
597 | "message", wasURLEscape(data) |
|
598 | ] |
598 | ] |
|
599 | ) |
599 | ) |
|
600 | ); |
600 | ); |
|
601 | |
601 | |
|
602 | // reset variables. |
602 | // reset variables. |
|
603 | soft = "True"; |
603 | soft = "True"; |
|
604 | |
604 | |
|
605 | state listen_group; |
605 | state listen_group; |
|
606 | } |
606 | } |
|
607 | } |
607 | } |
|
608 | |
608 | |