| 198 | | num_channels = 0; |
|---|
| 199 | | channel_slab = slab_create("channels", sizeof(struct channel)); |
|---|
| 200 | | chanuser_slab = slab_create("channel users", sizeof(struct chanuser)); |
|---|
| 201 | | chanlist_slab = slab_create("channel lists", sizeof(struct chanlist)); |
|---|
| 202 | | slab_set_opt(chanuser_slab, SLAB_ALLOC_BEST_FIT, 1); |
|---|
| 203 | | slab_set_opt(chanlist_slab, SLAB_ALLOC_BEST_FIT, 1); |
|---|
| 204 | | channels = NULL; |
|---|
| | 200 | static bool init_called = 0; |
|---|
| | 201 | if (!init_called) { |
|---|
| | 202 | init_called = 1; |
|---|
| | 203 | num_channels = 0; |
|---|
| | 204 | channel_slab = slab_create("channels", sizeof(struct channel)); |
|---|
| | 205 | chanuser_slab = slab_create("channel users", sizeof(struct chanuser)); |
|---|
| | 206 | chanlist_slab = slab_create("channel lists", sizeof(struct chanlist)); |
|---|
| | 207 | slab_set_opt(chanuser_slab, SLAB_ALLOC_BEST_FIT, 1); |
|---|
| | 208 | slab_set_opt(chanlist_slab, SLAB_ALLOC_BEST_FIT, 1); |
|---|
| | 209 | channels = NULL; |
|---|
| | 210 | } |
|---|
| | 2036 | |
|---|
| | 2037 | test_channel(player, name, c); |
|---|
| | 2038 | u = onchannel(player, c); |
|---|
| | 2039 | if (!u) { |
|---|
| | 2040 | notify_format(player, T("You are not on channel <%s>."), ChanName(c)); |
|---|
| | 2041 | return; |
|---|
| | 2042 | } |
|---|
| | 2043 | |
|---|
| | 2044 | if (!rhs_present) { |
|---|
| | 2045 | if (strlen(CUtitle(u)) == 0) |
|---|
| | 2046 | notify_format(player, T("You have no title set on <%s>."), ChanName(c)); |
|---|
| | 2047 | else |
|---|
| | 2048 | notify_format(player, T("Your title on <%s> is '%s'."), ChanName(c), |
|---|
| | 2049 | CUtitle(u)); |
|---|
| | 2050 | return; |
|---|
| | 2051 | } |
|---|
| | 2052 | |
|---|
| | 2275 | /* ARGSUSED */ |
|---|
| | 2276 | FUNCTION(fun_cbufferadd) |
|---|
| | 2277 | { |
|---|
| | 2278 | CHAN *c; |
|---|
| | 2279 | dbref victim; |
|---|
| | 2280 | |
|---|
| | 2281 | // Person must be able to do nospoof cemits. |
|---|
| | 2282 | if (!command_check_byname(executor, "@cemit") || fun->flags & FN_NOSIDEFX) { |
|---|
| | 2283 | safe_str(T(e_perm), buff, bp); |
|---|
| | 2284 | return; |
|---|
| | 2285 | } |
|---|
| | 2286 | // Find the channel. |
|---|
| | 2287 | if (!args[0] || !*args[0]) { |
|---|
| | 2288 | safe_str(T("#-1 NO CHANNEL GIVEN"), buff, bp); |
|---|
| | 2289 | return; |
|---|
| | 2290 | } |
|---|
| | 2291 | // Make sure we have text. |
|---|
| | 2292 | if (!args[1] || !*args[1]) { |
|---|
| | 2293 | safe_str(T("#-1 NO TEXT GIVEN"), buff, bp); |
|---|
| | 2294 | return; |
|---|
| | 2295 | } |
|---|
| | 2296 | |
|---|
| | 2297 | victim = executor; |
|---|
| | 2298 | // Do we spoof somebody else? |
|---|
| | 2299 | if (nargs == 3 && parse_boolean(args[2])) { |
|---|
| | 2300 | // Person must be able to do nospoof cemits. |
|---|
| | 2301 | if (!command_check_byname(executor, "@nscemit") || fun->flags & FN_NOSIDEFX) { |
|---|
| | 2302 | safe_str(T(e_perm), buff, bp); |
|---|
| | 2303 | return; |
|---|
| | 2304 | } |
|---|
| | 2305 | victim = enactor; |
|---|
| | 2306 | } |
|---|
| | 2307 | // Get the message. |
|---|
| | 2308 | switch (find_channel(args[0], &c, executor)) { |
|---|
| | 2309 | case CMATCH_NONE: |
|---|
| | 2310 | safe_str(T("#-1 NO SUCH CHANNEL"), buff, bp); |
|---|
| | 2311 | return; |
|---|
| | 2312 | case CMATCH_AMBIG: |
|---|
| | 2313 | safe_str(T("#-1 AMBIGUOUS CHANNEL NAME"), buff, bp); |
|---|
| | 2314 | return; |
|---|
| | 2315 | default: |
|---|
| | 2316 | if (!Chan_Can_Modify(c, executor)) { |
|---|
| | 2317 | safe_str(T(e_perm), buff, bp); |
|---|
| | 2318 | } else if (ChanBufferQ(c) != NULL) { |
|---|
| | 2319 | add_to_bufferq(ChanBufferQ(c), 0, victim, args[1]); |
|---|
| | 2320 | } else { |
|---|
| | 2321 | safe_str(T("#-1 CHANNEL DOES NOT HAVE A BUFFER"), buff, bp); |
|---|
| | 2322 | } |
|---|
| | 2323 | } |
|---|
| | 2324 | } |
|---|
| | 2325 | |
|---|