Advertisement
outsider

Initial Common Channels for ircu

Sep 13th, 2009
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.07 KB | None | 0 0
  1. void relay_private_notice(struct Client* sptr, const char* name, const char* text)
  2. {
  3.   struct Client* acptr;
  4.   struct Membership* chansrc;
  5.   struct Membership* chandst;
  6.   const struct User* usersrc = cli_user(sptr);
  7.   const struct User* userdst = cli_user(acptr);
  8.   int chanfound=0;
  9.  
  10.   ...
  11.  
  12.   /* ScaryNet
  13.    * +C check, if target is in a common channel with the destination
  14.    * allow, otherwise reject
  15.    */
  16.   if (IsInchanOnly(acptr) && !IsOper(sptr) && !IsChannelService(sptr)) {
  17.     for (chansrc = usersrc->channel; chansrc; chansrc = chansrc->next_channel) {
  18.       for (chandst = userdst->channel; chandst; chandst = chandst->next_channel) {
  19.         if (chandst->channel == chansrc->channel) {
  20.           chanfound = 1;
  21.           break;
  22.         }
  23.       }
  24.       if (chanfound == 1)
  25.         break;
  26.     }
  27.     MyFree(chansrc);
  28.     MyFree(chandst);
  29.     if (chanfound == 0) {
  30.       return;
  31.     }
  32.   }
  33.  
  34.   /*
  35.    * deliver the message
  36.    */
  37.   if (MyUser(acptr))
  38.     add_target(acptr, sptr);
  39.  
  40.   sendcmdto_one(sptr, CMD_NOTICE, acptr, "%C :%s", acptr, text);
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement