Author Topic: i made some changes  (Read 2408 times)

Offline AgAiNaWaY

  • Codemonkey
  • *****
  • Posts: 331
    • View Profile
i made some changes
« on: February 26, 2002, 01:38:00 pm »
inspired by this post: http://vb.epona.org/showthread.php?s=&threadid=17 i wrote the hack for the Uircd3.0.0.a18

Open channel.c

Find this code (near line 1554)
Code: [Select]
 who = find_chasing (sptr, parv[args], &chasing);
 cm = find_user_member (chptr->members, who);
 if (cm == NULL)
   {
     sendto_one (sptr, err_str (ERR_USERNOTINCHANNEL),
 me.name, cptr->name, parv[args], chptr->chname);
     /* swallow the arg */
     args++;
     break;
   }


Add this under it

Code: [Select]
/* to prevent mode flood */
   if((is_chan_admin(who,chptr) && (change=='+' && *modes=='a')) ||
     (is_chan_op(who,chptr) && (change=='+' && *modes=='o')) ||
     (is_half_op(who,chptr) && (change=='+' && *modes=='h')) ||
     (has_voice(who,chptr) && (change=='+' && *modes=='v')))
     { args++; break; }
   if((!is_chan_admin(who,chptr) && (change=='-' && *modes=='a')) ||
     (!is_chan_op(who,chptr) && (change=='-' && *modes=='o')) ||
     (!is_half_op(who,chptr) && (change=='-' && *modes=='h')) ||
     (!has_voice(who,chptr) && (change=='-' && *modes=='v')))
     { args++; break; }


Find this code (near line 1634)
Code: [Select]
 who = find_chasing (sptr, parv[args], &chasing);
 cm = find_user_member (chptr->members, who);
 if (cm == NULL)
   {
     sendto_one (sptr, err_str (ERR_USERNOTINCHANNEL),
 me.name, cptr->name, parv[args], chptr->chname);
     /* swallow the arg */
     args++;
     break;
   }


Add this under it
Code: [Select]
/* to prevent mode flood */
   if(
      (is_chan_op(who,chptr) && (change=='+' && *modes=='o')) ||
      (is_half_op(who,chptr) && (change=='+' && *modes=='h')) ||
      (has_voice(who,chptr) && (change=='+' && *modes=='v')))
      { args++; break; }
   if(
      (!is_chan_op(who,chptr) && (change=='-' && *modes=='o')) ||
      (!is_half_op(who,chptr) && (change=='-' && *modes=='h')) ||
      (!has_voice(who,chptr) && (change=='-' && *modes=='v')))
      { args++; break; }




Find this code (near line 1745)

Code: [Select]
 who = find_chasing (sptr, parv[args], &chasing);
 cm = find_user_member (chptr->members, who);
 if (cm == NULL)
   {
     sendto_one (sptr, err_str (ERR_USERNOTINCHANNEL),
 me.name, cptr->name, parv[args], chptr->chname);
     /* swallow the arg */
     args++;
     break;
   }


Under it add this code

Code: [Select]
   /* to prevent mode flood */
   if(
      (is_half_op(who,chptr) && (change=='+' && *modes=='h')) ||
      (has_voice(who,chptr) && (change=='+' && *modes=='v')))
      { args++; break; }
   if(
      (!is_half_op(who,chptr) && (change=='-' && *modes=='h')) ||
      (!has_voice(who,chptr) && (change=='-' && *modes=='v')))
      { args++; break; }



Find this code (near line 1820)
Code: [Select]
 who = find_chasing (sptr, parv[args], &chasing);
 cm = find_user_member (chptr->members, who);
 if (cm == NULL)
   {
     sendto_one (sptr, err_str (ERR_USERNOTINCHANNEL),
 me.name, cptr->name, parv[args], chptr->chname);
     /* swallow the arg */
     args++;
     break;
   }


(repeat)Add this under it

Code: [Select]
 /* to prevent mode flood */
   if(has_voice(who,chptr) && (change=='+' && *modes=='v'))
      { args++; break; }
   if(!has_voice(who,chptr) && (change=='-' && *modes=='v'))
      { args++; break; }


save
make
I´ve written also something for +a on channel creation and Service deop .. at the moment im working out that the User can choose if he want to set +a +o or nothing on channel creation. The Services deop part avoides the user from mode changes -aohv on Services Clients to prevent figths with the Services ... often seen with Eggdrops.


[ This Message was edited by: AgAiNaWaY on 2002-02-26 04:47 ]

Offline ShadowMaster

  • Chief Codemonkey
  • Administrator
  • ********
  • Posts: 3136
    • View Profile
    • http://www.shadow-realm.org/
i made some changes
« Reply #1 on: February 26, 2002, 08:05:00 pm »
Thanx for the patch, im having some thoughts on solving this a little bit different thou :smile:  We'll see what i come out with in the end. Bottom line is that this functionality WILL appear in the IRCd (this mode system is driving me slowly nutz)

As for the services deop/deadmin issue, it shouldnt be a problem in the first place if i had gotten my butt in gear and finish the oper/services protection.

Putting the latter on my ToDo list as we speak.
Search before posting - No support by PM or IM

Offline AgAiNaWaY

  • Codemonkey
  • *****
  • Posts: 331
    • View Profile
i made some changes
« Reply #2 on: February 27, 2002, 01:16:00 am »
Changed also something on the Epona Services mod.

Near Line 859 in botserv.c
Find this code ..

Code: [Select]

#endif

#ifdef IRC_UNREAL
        send_cmd(ci->bi->nick, "MODE %s +ao %s %s", ci->name, ci->bi->nick, ci->bi->nick);
#else


Under this code i added

Code: [Select]

#ifdef IRC_ULTIMATE3
        send_cmd(ci->bi->nick, "MODE %s +a %s", ci->name, ci->bi->nick);
#else
        send_cmd(ci->bi->nick, "MODE %s +o %s", ci->name, ci->bi->nick);
#endif


Now the Service Bot sets +a on join if Ultimate3 are defined.

Now i working out to avoid the "mode flood" for Channel modes.

[ This Message was edited by: AgAiNaWaY on 2002-02-26 16:17 ]