# Path: cardinal/decorators.py
# def event(triggers):
#     if isinstance(triggers, str):
#         triggers = [triggers]
# 
#     if not isinstance(triggers, list):
#         raise TypeError("Event must be a trigger string or list of triggers")
# 
#     def wrap(f):
#         f.events = triggers
#         return f
# 
#     return wrap


from cardinal.decorators import event


class InviteJoinPlugin:
    """Simple plugin that joins a channel if an invite is given."""

    def __init__(self, cardinal, config):
        self.rejoin_on_kick = False
        if config:
            self.rejoin_on_kick = config.get('rejoin_on_kick', False)

    @event('irc.invite')
    def join_channel(self, cardinal, user, channel):
        """Callback for irc.invite that joins a channel"""
        cardinal.join(channel)


# Path: cardinal/decorators.py
# def event(triggers):
#     if isinstance(triggers, str):
#         triggers = [triggers]
# 
#     if not isinstance(triggers, list):
#         raise TypeError("Event must be a trigger string or list of triggers")
# 
#     def wrap(f):
#         f.events = triggers
#         return f
# 
#     return wrap


# Path: plugins/join_on_invite/plugin.py
from cardinal.decorators import event



class InviteJoinPlugin:
    """Simple plugin that joins a channel if an invite is given."""

    def __init__(self, cardinal, config):
        self.rejoin_on_kick = False
        if config:
            self.rejoin_on_kick = config.get('rejoin_on_kick', False)

    @event('irc.invite')
    def join_channel(self, cardinal, user, channel):
        """Callback for irc.invite that joins a channel"""
        cardinal.join(channel)


    @event('irc.kick')