PennMUSH Community
Show
Ignore:
Timestamp:
09/23/08 12:50:40 (2 months ago)
Author:
shawnw
Message:

Prep for 1.8.3p7

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/trunk/src/extchat.c

    r1230 r1278  
    103103CHAN *channels;    /**< Pointer to channel list */ 
    104104 
     105extern int rhs_present;         /* from command.c */ 
     106 
    105107static PRIV priv_table[] = { 
    106108  {"Disabled", 'D', CHANNEL_DISABLED, CHANNEL_DISABLED}, 
     
    196198init_chatdb(void) 
    197199{ 
    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  } 
    205211} 
    206212 
     
    518524      db_read_this_labeled_int(fp, "type", &n); 
    519525      db_read_this_labeled_string(fp, "title", &tmp); 
     526      ChanNumUsers(ch) -= 1; 
    520527    } 
    521528  } 
     
    20272034    return; 
    20282035  } 
     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 
    20292053  if (!title) 
    20302054    title = (const char *) ""; 
     
    20422066    } 
    20432067  } 
    2044   test_channel(player, name, c); 
    2045   u = onchannel(player, c); 
    2046   if (!u) { 
    2047     notify_format(player, T("You are not on channel <%s>."), ChanName(c)); 
    2048     return; 
    2049   } 
     2068 
    20502069  strcpy(CUtitle(u), title); 
    20512070  if (!Quiet(player)) 
     
    22542273} 
    22552274 
     2275/* ARGSUSED */ 
     2276FUNCTION(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 
    22562326 
    22572327/* ARGSUSED */ 
     
    34573527  } 
    34583528  u = onchannel(player, chan); 
    3459   if (!u && !Chan_Can_Access(chan, player)) { 
    3460     notify(player, T("CHAT: You must join a channel to recall from it.")); 
     3529  if (!u && !Chan_Can_Join(chan, player)) { 
     3530    notify(player, 
     3531           T("CHAT: You must be able to join a channel to recall from it.")); 
    34613532    return; 
    34623533  }