-
Notifications
You must be signed in to change notification settings - Fork 0
/
Channel System.txt
228 lines (139 loc) · 23.9 KB
/
Channel System.txt
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
@@ Core
@cmdquota me=99999
@@ the chan_lib is the parent of all channel-like systems.
@skip isdbref(tag(setr(1,chan_lib)))={@assert/inline isdbref(tag(stor))=@pemit %#=ERROR: No storage object set!;@assert/inline isdbref(setr(0,create(Channel System Library,,t)))=@pemit %#=ERROR: Could not create code object %q1: %q0;@set %q0=INDESTRUCTIBLE NO_COMMAND;@tag/add %q1=%q0;@tel %q0=#stor}
&SWITCHES #chan_lib=setunion(LIST|WHO|ON|OFF|GAG|UNGAG|JOIN|LEAVE|RESTRICT|UNRESTRICT|TITLE|OPTIONS|ALTEREGO,CREATE|RENAME|DELETE|EXAMINE|LOCK|UNLOCK|CONFIG|MEMADD|MEMREM|MODADD|MODREM|ADMADD|ADMREM[if(isdbref(tag(scene)),|LOG|STOPLOG)],|,|)
&CHAN.TYPE #chan_lib=CHANNELS
&CHAN.GAG #chan_lib=GAGGED
&FN.SYS_NAME #chan_lib=mudname()
&FN.CHANNELS #chan_lib=sortname(lcon(%!,,,,1))
&FN.VISIBLE_CHANNELS #chan_lib=filter(CHECK,u(FN.CHANNELS),%b,%b,TalkLock,%0)
&FN.PLAYER_STATUS #chan_lib=if(match(get(%0/CHANINFO.[v(CHAN.GAG)]),objid(%1)),ansi(hx,Gag),if(match(get(%0/JOINED),objid(%1)),ansi(hg,On),ansi(hx,Off)))
@@ %0 - channel dbref, %1 - player objid
&FN.VALID_NAME #chan_lib=ofparse(3,if(strlen(%0),1,#-1 CHANNEL NAMES CANNOT BE EMPTY),if(lte(strlen(%0),30),1,#-1 CHANNEL NAMES MUST BE <=30 CHARACTERS),if(valid(name,%0),1,#-1 CHANNEL NAMES MUST BE VALID THING NAMES))
&FN.FIND_CHANNEL #chan_lib=privatize(1,ofparse(3,if(strlen(%0),1,#-1 CHANNEL NAME EMPTY),if(words(setr(0,u(FN.VISIBLE_CHANNELS,%0))),1,#-1 NO VISIBLE CHANNELS IN SYSTEM),if(cand(isobjid(%1),match(%q0,%1)),1[setq(1,%1)],if(lt(words(setr(1,switch(%2,1,namefind(%q0,%1),2,namegraball(%q0,%1),namegrab(%q0,%1)))),2),1,#-1 MATCHED MULTIPLE CHANNELS: [iter(%q0,name(%i0),%b,|)])),strfirstof(%q1,if(strfirstof(%3,1),#-1 CHANNEL '%1' NOT FOUND))))
@@ %0 - for who, %1 channel name, %2 - 0 (default) for namegrab, 1 for namefind, 2 for namegraball, %3 - (default true) error on empty
@@ Can Error.
&SW.MAIN #chan_lib=@attach %!/INC.LIST=u(FN.VISIBLE_CHANNELS,%#),MAIN
&SW.LIST #chan_lib=@attach %!/INC.LIST=u(FN.VISIBLE_CHANNELS,%#),MAIN
&INC.ADMIN #chan_lib=@assert/inline u(CHANNEL_ADMIN,%#,%q<chan>)=@pemit %#=Permission Denied.
&INC.FIND #chan_lib=@assert/inline isobjid(setr(!,u(FN.FIND_CHANNEL,%#,stripansi(%0)),chan))=@pemit %#=%q<chan>
&INC.LIST #chan_lib=@pemit %#=header(u(FN.SYS_NAME) Channels);@pemit %#=u(FN.COLUMNS_%1);@pemit %#=separator();th setq(!,lwhoid(),online);@dolist/inline %0={@attach %!/INC.LIST_%1=%d0};@pemit %#=footer()
&FN.COLUMNS_MAIN #chan_lib=ansi(confoverride(%#,COLUMN),printf($4-s $3s $-15s $|"-45s $:0:3s/$:0:3s,DBRF,Sta,Name,Description,Cur,Mem))
&INC.LIST_MAIN #chan_lib=@pemit %#=printf($4-s $3s $-15s $|"-45s $:0:3s/$:0:3s,num(%0),u(FN.PLAYER_STATUS,%0,%#),cname(%0),default(%0/DESCRIBE,No description.),words(setinter(filterobjid(setr(!,get(%0/JOINED),mem)),%q<online>)),words(%q<mem>))
&FN.NAMES #chan_lib=elist(iter(filterobjid(%0),cname(%i0),%b,|),,|)
&SW.WHO #chan_lib=@attach %!/INC.FIND;@pemit %#=[u(FN.NAMES,get(%q<chan>/JOINED)))]
&SW.CONFIG #chan_lib=@attach %!/CONFIG=%0,%1,%!
&SW.OPTIONS #chan_lib=@attach %!/INC.FIND=trim(before(%0,/));@assert/inline u(CHECK,%q<chan>,,%:)=@pemit %#=Permission denied.;@attach #inc/CONFIG=trim(after(%0,/)),%1,%q<chan>
&SW.EXAMINE #chan_lib=@attach %!/INC.FIND;@attach %!/INC.ADMIN;@pemit %#=header(Examine: [cname(%q<chan>)] (%q<chan>));@pemit %#=[ansi(hw,JOINED:)]%B[u(FN.NAMES,get(%q<chan>/JOINED))];@pemit %#=[ansi(hw,GAGGING:)]%B[u(FN.NAMES,get(%q<chan>/GAGGING))];@if words(setr(!,get(%q<chan>/RESTRICT),restrict),|)={@pemit %#=separator(Restricted);@dolist/inline/delimit | %q<restrict>={@pemit %#=[cname(before(%d0,~))] - until [fancytime(after(%d0,~))]}};@pemit %#=separator(Locks);@dolist/inline/delimit | [get(%!/LOCKS)]={@pemit %#=[ansi(hw,%d0:)] [lock(%q<chan>/user|%d0)]};@pemit %#=footer()
&SW.DELETE #chan_lib=@attach %!/INC.FIND;@attach %!/INC.ADMIN;@assert/inline match(name(%q<chan>)|[num(%q<chan>)]|[objid(%q<chan>)],%1,|)=@pemit %#=Verify failed. Right side argument must be the channel's full name, dbref, or objid.;th setq(!,cname(%q<chan>),channame);@attach #inc/MSG_ALERT=Channel '%q<channame>' deleted.;th u(FN.CEMIT,%q<channame>,:has deleted the channel.);@set %q<chan>=!SAFE !INDESTRUCTIBLE;@destroy/override %q<chan>
&INC.CREATE_CHECK #chan_lib=@assert/inline gtebittype(%#,5)=@pemit %#=Permission denied!
&SW.CREATE #chan_lib=@attach %!/INC.CREATE_CHECK;@assert/inline setr(!,u(FN.VALID_NAME,setr(!,trim(%0),channame)),result)=@pemit %#=%q<result>;@break/inline cand(isobjid(setr(!,u(FN.FIND_CHANNEL,%#,%q<channame>),found)),!strmatch(%q<chan>,%q<found>))=@pemit %#=Channel name conflict detected.;@assert/inline isdbref(setr(!,create(%q<channame>,,t),chan))=@pemit %#=Could not create Channel: %q<chan>;@if has_markup(%q<channame>)={@name/ansi %q<chan>=%q<channame>};@parent %q<chan>=[u(CHAN_PARENT)];@set %q<chan>=INDESTRUCTIBLE SAFE;@pemit %#=Created a new channel: %q<channame>;@attach #inc/MSG_ALERT=New channel created: %q<channame>
&SW.RENAME #chan_lib=@attach %!/INC.FIND;@attach %!/INC.ADMIN;@assert/inline setr(!,u(FN.VALID_NAME,setr(!,trim(%1),channame)),result)=@pemit %#=%q<result>;@break/inline cand(isobjid(setr(!,u(FN.FIND_CHANNEL,%#,stripansi(%q<channame>),found))),!strmatch(%q<chan>,%q<found>))=@pemit %#=Channel name conflict detected.;th setq(!,cname(%q<chan>),oldname);@if has_markup(%q<channame>)={@name/ansi %q<chan>=%q<channame>},{@name %q<chan>=%q<channame>};@pemit %#=Channel '%q<oldname>' renamed to '%q<channame>';@attach #inc/MSG_ALERT=Channel '%q<oldname>' renamed to '%q<channame>';th u(FN.CEMIT,%q<chan>,:renamed '%q<oldname>' to '%q<channame>',%#)
&INC.STARTLOCK #chan_lib=@attach %!/INC.FIND=before(stripansi(%0),/);@attach %!/INC.ADMIN;@attach #inc/PARTIAL=after(stripansi(%0),/),get(%!/LOCKS),|,lock,locktype;
&SW.LOCK #chan_lib=@attach %!/INC.STARTLOCK;@attach #inc/VALID.LOCKKEY=%1;@lock/user %q<chan>|%q<lock>=%q<value>;@pemit %#=[setr(!,Set Channel '[cname(%q<chan>)]' %q<lock> Lock to: %q<valueformat>,msg)];@attach #inc/MSG_ALERT=%q<msg>
&SW.UNLOCK #chan_lib=@attach %!/INC.STARTLOCK;@unlock/user %q<chan>|%q<lock>;@pemit %#=[setr(!,Cleared Channel '[cname(%q<chan>)]' %q<lock> Lock Back to Default,msg)];@attach #inc/MSG_ALERT=%q<msg>
&SW.ON #chan_lib=@attach %!/SW.JOIN
&SW.JOIN #chan_lib=@attach %!/INC.FIND;@break/inline match(get(%q<chan>/JOINED),%:)=@pemit %#=You are already a member!;@attach %!/JOIN_CHANNEL=%q<chan>,%:;@pemit %#=You have joined [cname(%q<chan>)].
&JOIN_CHANNEL #chan_lib=@set %0=JOINED:[setunion(filterobjid(get(%0/JOINED)),%1)];@set %1=CHANNELS.[v(CHAN.TYPE)]:[setunion(filterobjid(get(%1/CHANNELS.[v(CHAN.TYPE)])),objid(%0))];@attach %!/UNGAG_CHANNEL=%0,%1;@attach %!/JOIN_CHANNEL_AFTER
&JOIN_CHANNEL_AFTER #chan_lib=th u(FN.CEMIT,%0,:has joined the channel.,%1)
@@ %0 - channel, %1 - new member
&SW.OFF #chan_lib=@attach %!/SW.LEAVE
&SW.LEAVE #chan_lib=@attach %!/INC.FIND;@assert/inline match(get(%q<chan>/JOINED),%:)=@pemit %#=You are not a member!;@attach %!/LEAVE_CHANNEL=%q<chan>,%:;@pemit %#=You have left the channel.
&LEAVE_CHANNEL #chan_lib=@set %0=JOINED:[setdiff(filterobjid(get(%0/JOINED)),%1)];@set %1=CHANNELS.[v(CHAN.TYPE)]:[setdiff(filterobjid(get(%1/CHANNELS.[v(CHAN.TYPE)])),objid(%0))];@attach %!/UNGAG_CHANNEL=%0,%1;@attach %!/LEAVE_CHANNEL_AFTER
&LEAVE_CHANNEL_AFTER #chan_lib=th u(FN.CEMIT,%0,:has left the channel.,%1)
&DO_ALTERTITLE #chan_lib=@attach %!/INC.FIND;@assert/inline getconf(%q<chan>,%2)=@pemit %#=This channel has them disabled.;th setq(!,CHANINFO.[edit(objid(%q<chan>),:,_)].%2,attr);@set %#=%q<attr>:%1;@pemit %#=Set.
&SW.ALTEREGO #chan_lib=@attach %!/DO_ALTERTITLE=%0,%1,ALTEREGO
&SW.TITLE #chan_lib=@attach %!/DO_ALTERTITLE=%0,%1,TITLE
&SW.RESTRICT #chan_lib=@attach %!/INC.FIND;@assert/inline u(CHECK,%q<chan>,ModerateLock)=@pemit %#=Permission denied.;@attach #inc/GET_PLAYER=before(%1,/),t1;@break/inline u(CHECK,%q<chan>,ModerateLock)=@pemit %#=You cannot moderate other moderators.;@attach #inc/VALID.FUTURE=after(%1,/);@set %q<chan>=RESTRICT:[set_kv(get(%q<chan>/RESTRICT),%q<t1>,%q<value>)];@pemit %#=[setr(!,[cname(%q<t1>)] has [setr(!,been restricted from talking on [cname(%q<chan>)] for [etime(sub(%q<value>,secs()))] - until%B,msg2)].,msg)][fancytime(%q<value>)];@pemit %q<t1>=You have %q<msg2> [fancytime(%q<value>,,%q<t1>)];@attach #inc/MSG_ALERT=%q<msg> [fancytime(%q<value>,UTC)]
&SW.UNRESTRICT #chan_lib=@attach %!/INC.FIND;@attach #inc/GET_PLAYER=%1,t1;@assert/inline setr(!,get_kv(setr(!,get(%q<chan>/RESTRICT),data),%q<t1>),gag)=@pemit %#=[cname(%q<t1>)] is not restricted.;@if gte(sub(%q<gag>,secs()),0)={@pemit %#=[cname(%q<t1>)] has been un-restricted.;@set %q<chan>=RESTRICT:[del_kv(%q<data>,%q<t1>)];@pemit %#=You lift [setr(!,[cname(%q<t1>)]'s restriction on Channel '[cname(%q<chan>)]'.,msg)];@pemit %q<t1>=Moderators lift your restriction on Channel '[cname(%q<chan>)]'.;@attach #inc/MSG_ALERT=Lifted %q<msg>},{@pemit %#=[cname(%q<t1>)]'s restriction has already expired. It has been cleaned up.;@attach %!/CLEAN_RESTRICTIONS=%q<chan>};
&SW.GAG #chan_lib=@attach %!/INC.FIND;@assert/inline u(CHECK,%q<chan>,JoinLock,%:)=@pemit %#=Permission denied.;@assert/inline match(get(%q<chan>/JOINED),%:)=@pemit %#=You are not listening to that channel.;@break/inline match(setr(!,get(%q<chan>/CHANINFO.[v(CHAN.GAG)]),gaggers),%:)=#pemit %#=That channel is already gagged.;@set %q<chan>=CHANINFO.[v(CHAN.GAG)]:[setunion(%q<gaggers>,%:)];@set %:=CHANINFO.[v(CHAN.GAG)]:[setunion(get(%:/CHANINFO.[v(CHAN.GAG)]),%q<chan>)];@pemit %#=Gagged [cname(%q<chan>)].
&GAG_CHANNEL #chan_lib=@set %0=CHANINFO.[v(CHAN.GAG)]:[setunion(filterobjid(get(%0/CHANINFO.[v(CHAN.GAG)])),objid(%1))];@set %1=CHANINFO.[v(CHAN.GAG)]:[setunion(filterobjid(get(%1/CHANINFO.[v(CHAN.GAG)])),objid(%0))]
&SW.UNGAG #chan_lib=@attach %!/INC.FIND;@assert/inline u(CHECK,%q<chan>,JoinLock,%:)=@pemit %#=Permission denied.;@assert/inline match(get(%q<chan>/JOINED),%:)=@pemit %#=You are not listening to that channel.;@assert/inline match(setr(!,get(%q<chan>/CHANINFO.[v(CHAN.GAG)]),gaggers),%:)=#pemit %#=That channel is not gagged.;@set %q<chan>=CHANINFO.[v(CHAN.GAG)]:[setdiff(%q<gaggers>,%:)];@set %:=CHANINFO.[v(CHAN.GAG)]:[setdiff(get(%:/CHANINFO.[v(CHAN.GAG)]),%q<chan>)];@pemit %#=Un-Gagged [cname(%q<chan>)].
&UNGAG_CHANNEL #chan_lib=@set %0=CHANINFO.[v(CHAN.GAG)]:[setdiff(filterobjid(get(%0/CHANINFO.[v(CHAN.GAG)])),objid(%1))];@set %1=CHANINFO.[v(CHAN.GAG)]:[setdiff(filterobjid(get(%1/CHANINFO.[v(CHAN.GAG)])),objid(%0))]
&DO_BASE #chan_lib=@attach %!/INC.FIND;@assert/inline %2=@pemit %#=Permission denied.;@attach #inc/GET_PLAYER=%1,t1;th setq(!,filterobjid(get(%q<chan>/%2)),data);
&DO_ADD #chan_lib=@attach %!/DO_BASE;@break/inline match(%q<data>,%q<t1>)=@pemit %#=[cname(%q<t1>)] is already among the %2.;@set %q<chan>=%2:[setunion(%q<data>,%q<t1>)];@pemit %q<t1>=You are now among the %2 for Radio Channel: [cname(%q<chan>)];@pemit %#=[cname(%q<t1>)] added to the %2.
&DO_REM #chan_lib=@attach %!/DO_BASE;@assert/inline match(%q<data>,%q<t1>)=@pemit %#=[cname(%q<t1>)] is not among the %2.;@set %q<chan>=%2:[setdiff(%q<data>,%q<t1>)];@pemit %q<t1>=You are no longer among the %2 for Radio Channel: [cname(%q<chan>)];@pemit %#=[cname(%q<t1>)] removed from the %2.
&SW.MEMADD #chan_lib=@attach %!/DO_ADD=%0,%1,u(CHECK,%q<chan>,ModerateLock,%#),MEMBERS
&SW.MEMREM #chan_lib=@attach %!/DO_REM=%0,%1,u(CHECK,%q<chan>,ModerateLock,%#),MEMBERS
&SW.MODADD #chan_lib=@attach %!/DO_ADD=%0,%1,u(CHECK,%q<chan>,AdminLock,%#),MODERATORS
&SW.MODREM #chan_lib=@attach %!/DO_REM=%0,%1,u(CHECK,%q<chan>,AdminLock,%#),MODERATORS
&SW.ADMADD #chan_lib=@attach %!/DO_ADD=%0,%1,u(CHECK,%q<chan>,FakeLock,%#),ADMINS
&SW.ADMREM #chan_lib=@attach %!/DO_REM=%0,%1,u(CHECK,%q<chan>,FakeLock,%#),ADMINS
&CHANNEL_ADMIN #chan_lib=gtebittype(%0,5)
&LOCKS #chan_lib=TalkLock|ModerateLock|AdminLock
&CHECK_HELPER_EXTRA #chan_lib=switch(%1,TalkLock,if(setr(!,secs_remain(get_kv(get(%0/CHANINFO.[v(CHAN.GAG)]),objid(%2))),gag),0[null(pemit(%2,You are banned from [cname(%0)] for: [etime(%q<gag>)]))],1),1)
&CHECK.ADMINLOCK #chan_lib=match(get(%0/ADMINS),objid(%1))
&CHECK.MODERATELOCK #chan_lib=cor(u(CHECK.ADMINLOCK,%0,%1),match(get(%0/MODERATORS),objid(%1)))
&CHECK.JOINLOCK #chan_lib=cor(u(CHECK.MODERATELOCK,%0,%1),match(get(%0/MEMBERS),objid(%1)))
&CHECK #chan_lib=localize(if(u(CHANNEL_ADMIN,%2),1,cand(cor(elock(%0/user|%1,num(%2)),u(CHECK.%1,%0,%2)),u(CHECK_HELPER_EXTRA,%0,%1,%2))))
@@ %0 - channel, %1 - permission, %2 - object
&BASE_FORMAT #chan_lib=<[cname(%1)][if(strlen(%6),:%B[ansi(hg,%6)])]> [if(%7,%2,[if(strlen(%4),%4%B)][parsestr(%2,%0,",",,&[if(strlen(%5),%5 [chr(40)][cname(%3)][chr(41)],cname(%3))])])]
@@ %0 - recipient, %1 - channel dbref, %2 - message, %3 - sender, %4 - title if enabled and set, %5 - altego if enabled and set, %6 - scene ids, %7 - system message
&CUSTOM_FORMATTER #chan_lib=CHATFORMAT
@@ %0 - original message without custom formatter, %1 - channel dbref, %3 - message, %4 - sender
&FORMAT_MESSAGE #chan_lib=uldefault(%0/[v(CUSTOM_FORMATTER)],u(BASE_FORMAT,,%1,%2,%3,%4,%5,%6,%7),u(BASE_FORMAT,,%1,%2,%3,%4,%5,%6),%1,%2,%3,%4,%5,%6,%7)
@@ %0 - recipient, %1 - channel dbref, %2 - message, %3 - sender, %4 - title if enabled and set, %5 - altego if enabled and set, %6 - scene ids in use, %7 system message
&CUSTOM_IGNORE #chan_lib=CHATIGNORE
&FN.DISTRIBUTE #chan_lib=localize([if(!match(get(%0/[v(CUSTOM_IGNORE)],objid(%2))),pemit(%0,u(FORMAT_MESSAGE,%0,%1,%2,%3,%4,%5,%6,%7)))])
@@ %0 - target, %1 - channel objid, %2 - message, %3 - sender
&FN.SEND_MESSAGES #chan_lib=iter(setdiff(get(%0/JOINED),get(%0/CHANINFO.[v(CHAN.GAG)])),u(FN.DISTRIBUTE,%i0,%0,%1,%2,%3,%4,%5,%6))
@@ %0 - channel objid, %1 - message, %2 - sender, %3 - alterego, %4 - title, %5 - scene ids, %6 - system message marker.
&Q.SCENE.ACTIVE #chan_lib=SELECT channel_id,scene_id FROM channel_scene WHERE channel_objid=? AND channel_active=1 AND scene_status=1
&Q.SELECT.ACTROLE #chan_lib=SELECT actrole_id FROM actrole WHERE actor_id=? AND actrole_name=?
&Q.INSERT.ACTROLE #chan_lib=INSERT INTO actrole (actor_id,actrole_name) VALUES (?,?)
&Q.INSERT.POSE #chan_lib=INSERT INTO pose (actrole_id,channel_id,pose_date_created,pose_text) VALUES (?,?,FROM_UNIXTIME(?),?)
&Q.UPDATE.POSE #chan_lib=UPDATE pose SET !=? WHERE pose_id=?
&Q.UPDATE.SCENE.UNIXTIME #chan_lib=UPDATE scene SET !=FROM_UNIXTIME(?) WHERE scene_id=?
&Q.INCREMENT.ACTION_COUNT #chan_lib=UPDATE actor SET action_count=action_count+1 WHERE actor_id=?
&FN.LOG_FORMAT #chan_lib=if(%4,%0,[if(strlen(%3),%3%B)][parsestr(%0,%0,",",,&[if(strlen(%2),%2 [chr(40)][cname(%1)][chr(41)],cname(%1))])])
&FN.LOG_MESSAGE #chan_lib=[if(!isint(setr(!,mysql(SELECT.ACTROLE,setr(!,u(#scene/FN.PREPACT,%4,%2),actor),setr(!,strfirstof(stripansi(setr(!,%3,setrole)),name(%2)),actname)),role_id)),[mysql(INSERT.ACTROLE,%q<actor>,%q<actname>)][setq(!,sql(SELECT last_insert_id[chr(40)][chr(41)]),role_id)])][setq(!,u(FN.LOG_FORMAT,%1,%2,%3,%5,%6),msg)][mysql(INSERT.POSE,%q<role_id>,%0,secs(),%q<msg>)][mysql(INCREMENT.ACTION_COUNT,%q<actor>)][mysql(UPDATE.SCENE.UNIXTIME,scene_date_activity,secs(),%4)]
@@ %0 - channel_id, %1 message, %2 - sender, %3 - alterego, %4 - scene id, %5 - title, %6 - system message
&FN.SCENELOG #chan_lib=privatize(1,if(cand(isdbref(tag(scene)),words(setr(!,mysql2(SCENE.ACTIVE,%0),scenes),|)),iter(%q<scenes>,elements(%i0,2,^),|,%B)[null(iter(%q<scenes>,u(FN.LOG_MESSAGE,elements(%i0,1,^),%1,%2,%3,elements(%i0,2,^),%4,%5)))]))
@@ %0 - channel objid, %1 message %2 sender, %3 alterego, %4 title, %5 sys message
&FN.PREP_SEND #chan_lib=u(FN.SEND_MESSAGES,%0,%1,%2,setr(!,if(getconf(%0,TITLES),get(%2/CHANINFO.[edit(objid(%0),:,_)].TITLE)),title),setr(!,if(getconf(%0,ALTEREGO),get(%2/CHANINFO.[edit(objid(%0),:,_)].ALTEREGO)),alterego),u(FN.SCENELOG,%0,%1,%2,%q<alterego>,%q<title>,%3),%3)
&FN.CEMIT #chan_lib=privatize(1,ofparse(3,if(setr(!,u(FN.FIND_CHANNEL,setr(!,strfirstof(%2,%#),sender),%0),chan),1,%q<chan>),if(u(CHECK,%q<chan>,TalkLock,%q<sender>),1,#-1 PERMISSION DENIED),if(t(%3),if(u(CHECK,%q<chan>,AdminLock,%q<sender>),1,#-1 PERMISSION DENIED),1),if(strlen(%1),1,#-1 NOTHING TO SEND),if(!strmatch(%1,|*),1,#-1 EMIT NOT ALLOWED),1[null(u(FN.PREP_SEND,%q<chan>,%1,%q<sender>,%3))]))
@@ %0 - channel name/dbref, %1 - message, %2 - sender (defaults to %#), %3 - system message
&Q.SELECT.SCENE #chan_lib=SELECT ! FROM scene WHERE scene_id=?
&Q.SELECT.CHANNEL_LOG #chan_lib=SELECT channel_id,channel_active FROM channel WHERE channel_objid=? AND scene_id=?
&Q.INSERT.CHANNEL_LOG #chan_lib=INSERT INTO channel (scene_id,channel_name,channel_objid,channel_category) VALUES (?,?,?,?)
&Q.UPDATE.CHANNEL_LOG #chan_lib=UPDATE channel SET !=? WHERE channel_id=?
&SW.LOG #chan_lib=@attach %!/INC.FIND;@assert/inline getconf(%q<chan>,CANLOG)=@pemit %#=That channel doesn't support logging!;@attach #scene/FINDSCENE=%1,scene;@assert/inline eq(1,mysql(SELECT.SCENE,scene_status,%q<scene>))=@pemit %#=That scene isn't active!;@if strlen(setr(!,mysql2(SELECT.CHANNEL_LOG,objid(%q<chan>),%q<scene>),exist))={@break/inline elements(%q<exist>,2,^)=@pemit %#=It's already being logged!;@attach #inc/DOSQL=UPDATE.CHANNEL_LOG,channel_active,1,elements(%q<exist>,1,^)},{@attach #inc/DOSQL=INSERT.CHANNEL_LOG,%q<scene>,name(%q<chan>),objid(%q<chan>),v(CHAN_CATEGORY)};@attach #scene/MSG_SCENE=%q<scene>,0,%:,Now logging [u(FN.SYS_NAME)] Channel: [cname(%q<chan>)];th u(FN.CEMIT,%q<chan>,Now Logging to Scene: %q<scene>,,1)
&SW.STOPLOG #chan_lib=@attach %!/INC.FIND;@attach #scene/FINDSCENE=%1,scene;@assert/inline eq(1,mysql(SELECT.SCENE,scene_status,%q<scene>))=@pemit %#=That scene isn't active!;@assert/inline strlen(setr(!,mysql2(SELECT.CHANNEL_LOG,objid(%q<chan>),%q<scene>),exist))=@pemit %#=It's not being logged!;@assert/inline elements(%q<exist>,2,^)=@pemit %#=It's not being logged!;@attach #scene/MSG_SCENE=%q<scene>,0,%:,Stopped logging [u(FN.SYS_NAME)] Channel: [cname(%q<chan>)];th u(FN.CEMIT,%q<chan>,No longer Logging to Scene: %q<scene>,,1);@attach #inc/DOSQL=UPDATE.CHANNEL_LOG,channel_active,0,elements(%q<exist>,1,^);
@startup #chan_lib=@trigger %!/CHANNEL_CLEANER
&CHANNEL_CLEANER #chan_lib=@dolist u(FN.CHANNELS)={@attach %!/CLEAN=##};@wait 3600=@trigger %!/CHANNEL_CLEANER
&CLEAN #chan_lib=@attach %!/CLEAN_GAGS=%0;
&FIL.RESTRICT #chan_lib=[cand(isobjid(before(%0,~)),remaining(after(%0,~)))]
&CLEAN_RESTRICT #chan_lib=@set %0=RESTRICT:[filter(FIL.GAGS,get(%0/RESTRICT),|,|)]
&FIL.ISOBJID #chan_lib=isobjid(%0)
&CLEAN_LISTS #chan_lib=@dolist/inline JOINED GAGGED={@set %0=%d0:[filter(FIL.ISOBJID,get(%0/%d0))]}
@@ %0 - object to clean.
@@ After this is the actual default +channel system.
@skip isdbref(tag(setr(1,chan)))={@assert/inline isdbref(globalroom())=@pemit %#=ERROR: No global room set!;@assert/inline isdbref(setr(0,create(Channel System,,t)))=@pemit %#=ERROR: Could not create code object: %q0;@set %q0=INDESTRUCTIBLE !NO_COMMAND;@tag/add %q1=%q0;@tel %q0=[globalroom()];@parent %q0=#chan_lib}
@skip isdbref(tag(setr(1,chan_parent)))={@assert/inline isdbref(tag(chan))=@pemit %#=ERROR: No Channel object set!;@assert/inline isdbref(setr(0,create(Channel System Parent,,t)))=@pemit %#=ERROR: Could not create code object %q1: %q0;@set %q0=INDESTRUCTIBLE NO_COMMAND;@tag/add %q1=%q0;@tel %q0=[tag(stor)]}
&LK.MODERATE #chan_parent=t(match(v(MODERATORS),%:))
&LK.ADMIN #chan_parent=t(match(v(ADMINS),%:))
&LK.MEMBER #chan_parent=t(match(v(MEMBERS),%:))
@lock/user #chan_parent|TalkLock=LK.TRUE/1
@lock/user #chan_parent|ModerateLock=LK.GTEBITTYPE/4
@lock/user #chan_parent|AdminLock=LK.GTEBITTYPE/4
&CONFIG.TITLES.DESC #chan_parent=Enable Channel titles? Channel titles appear before the name.
&CONFIG.TITLES.DEFAULT #chan_parent=1
&CONFIG.TITLES.TYPE #chan_parent=BOOL
&CONFIG.ALTEREGO.DESC #chan_parent=Enable alter-ego names? Those who set them will display as: <AlterEgo> (Realname) says, "blah"
&CONFIG.ALTEREGO.DEFAULT #chan_parent=1
&CONFIG.ALTEREGO.TYPE #chan_parent=BOOL
&CONFIG.CANLOG.DESC #chan_parent=Can this channel be used with SceneSys logs?
&CONFIG.CANLOG.DEFAULT #chan_parent=0
&CONFIG.CANLOG.TYPE #chan_parent=BOOL
&CMD.@CHANNEL #chan=$^(?s)(?\:@|\+)?(chan|channel)(?\:/(\\S+)?)?(?\: +(.+?))?(?\:=(.*))?$:@attach #inc/GET_SWITCH=%2;@attach %!/SW.[strfirstof(%q<switch>,MAIN)]=trim(%3),%4
@set #chan/CMD.@CHANNEL=regexp
&CHAN_PARENT #chan=tag(chan_parent)
&CHAN_CATEGORY #chan=3
&GPFN.CEMIT #chan=privatize(1,u(FN.CEMIT,%0,%1))
&FN.ERR_CHANNEL #chan=privatize(1,if(words(setr(!,setinter(get(%0/CHANNELS.[v(CHAN.TYPE)]),u(FN.CHANNELS)),avail)),if(isobjid(setr(!,namegrab(%q<avail>,%1),chan)),if(setr(!,cemit(%q<chan>,%2,%0),res),1,0[pemit(%0,Permission denied: %q<res>)]),0),0))
@startup #chan=@attach [parent(me)]/STARTUP;@attach #inc/REGISTER_FUNCTIONS
@@ Help Section
&ERR.CHANNEL #eobj=privatize(1,if(strlen(setr(!,after(%0,+),aplus)),if(strlen(setr(!,objeval(%#,%q<aplus>),feval)),u(#chan/FN.ERR_CHANNEL,%#,stripansi(first(%q<aplus>)),rest(%q<aplus>)),0),0))
+help/add Communications/@channel=#chan/HLP_CHANNELS
&HLP_CHANNELS #chan=[ansi(hw,Command Aliases:)] +chan, +channel, @chan, @channel%R%RThe Channels System provides global chat channels with unique names and a straightforward permissions and moderation system.%R%R[ansi(hc,Commands)]%R%R[ansi(hw,@chan)]%R%TDisplay all channels you can see.%R%R[ansi(hw,@chan/join <channel>)]%R%TJoin a channel.%R%R[ansi(hw,@chan/leave <channel>)]%R%TLeave a channel.%R%R[ansi(hw,@chan/gag <channel>)]%R%TSquelch output from a channel. You won't hear it until you /ungag. Clears at logout.%R%R[ansi(hw,@chan/ungag <channel>)]%R%TReleases a gag. Hear messages again.%R%R[if(isdbref(tag(scene)),[ansi(hc,Roleplay Logging)]%RThe following commands integrate with the Roleplay Logging system. See [ansi(hw,+help @scene)]. The indication that a Channel is being logged is a sequence of numbers after its name.%R%R[ansi(hw,@chan/log <channel>=<SceneId>)]%R%TBegin logging to a given Scene.%R%R[ansi(hw,@chan/stoplog <channel>=<SceneID>)]%R%TStop further messages from being logged to that Scene.%R%R)][ansi(hc,Sending Messages)]%R%RYou can send messages by typing [ansi(hw,+<channel> <message>)], where <channel> is able to partial match by prefix. For example, to speak on a channel named Public, you could use [ansi(hw,+p hello!)] or [ansi(hw,+pub yo!)]%R%R[ansi(hc,Moderator Commands)]%R%R[ansi(hw,@chan/restrict <channel>=<player>/<duration>)]%R%TApply a duration-based send block. Duration example: 30d 5h 40m for 30 days, 5 hours, and 40 minutes.%R%R[ansi(hw,@chan/unrestrict <channel>=<player>)]%R%TRelease a ban early.%R%R[ansi(hc,Administrator Commands)]%R%R[ansi(hw,@chan/create <channel>)]%R%TCreates a new channel. use the ansi%(%) function to create one with a colored name!%R%R[ansi(hw,@chan/rename <old name>=<new name>)]%R%TRename a channel. Can rename to itself to fix case or color.%R%R[ansi(hw,@chan/delete <channel>=<verify>)]%R%TDelete a channel. Must enter the full name in <verify> to confirm.%R%R[ansi(hw,@chan/lock <channel>/<lock>=<lockkey>)]%R%TSet a MUSHcode lock string to one of the channel locks. See more below.%R%R[ansi(hw,@chan/unlock <channel>/<lock>)]%R%TRelease a lock back to defaults.%R%R[ansi(hw,@chan/options <channel>\[/<op>=<value>\])]%R%TView or change a Channel's options.%R%R[ansi(hc,Permissions and Membership)]%RChannels each have three lists for privileges: members, moderators, and admins. These lists can be modified using the switches:%R[ansi(hw,/memadd /memrem /modadd /modrem /admadd /admrem)]%RExample:%R[ansi(hw,@chan/memadd <channel>=<player>)]%R%RA Wizard/Owner can appoint Admins. Admins may appoint Moderators and use /options. Moderators may add and remove members and use the /restrict feature. Members can join and speak on the channel. Higher permissions imply all lower privileges: IE, moderators can always talk whether or not they're on the member list.%R%RThe [ansi(hw,AdminLock)], [ansi(hw,ModeratorLock)], and [ansi(hw,TalkLock)] offer an alternate approach for granting permission, which CO-EXISTS with the above lists. IE: Moderator privileges are gained by EITHER passing the lock OR being in the Moderators list.%R%R[ansi(hc,Lock Keys)]%RChannels have access to special eval locks.%R[ansi(hw,LK.ADMIN/1)]%R%TEvals true if checker is on the admins list.%R[ansi(hw,LK.MODERATE/1)]%R%TEvals true if checker is on the moderators list.%R[ansi(hw,LK.MEMBER/1)]%R%TEvals true if checker is on the member list.%R%R[ansi(hc,Default Channel Locks)]%R[iter(TalkLock ModerateLock AdminLock,[ansi(hw,%i0)]: [lock(#chan_parent/user|%i0)],%B,%R)]