Ejemplo n.º 1
0
 def PostUpdate(self, source, *args, **kwargs):
     user = User.get_by_irc_id(source)
     if not user.banned:
         status = super(IdenticaApi,self).PostUpdate(*args, **kwargs)
         user.add_post(status, source)
         if user.gets_mail:
             try:
                 self._send_information_mail(user, status.decode('utf-8'))
             except BaseException, e:
                 print 'Error in send_infomation_mail:', type(e).__name__, e
                 exit(1)
Ejemplo n.º 2
0
 def _set_bann(self, username, bann_status):
     try:
         if username[0] == '@':
             bannee = User.get_by_user_id(username[1:])
         else:
             bannee = User.get_by_irc_id(username)
         banner = User.get_by_irc_id(self.event.source())
         if banner.banned:
             reply = 'You are banned.'
         elif not banner.admin:
             reply = 'You are no admin.'
         elif bannee != None:
             if bannee.user_id == banner.user_id:
                 reply = 'You can\'t %sban yourself.' % ('' if bann_status else 'un')
             else:
                 bannee.banned = bann_status
                 reply = 'You %sbanned user %s.' % ('' if bann_status else 'un', bannee.user_id)
         else:
             reply = 'User %s does not exist.' % username
     except User.NotLoggedIn, e:
         reply = str(e)
Ejemplo n.º 3
0
 def do_admin(self,username):
     try:
         if username[0] == '@':
             user = User.get_by_user_id(username[1:])
         else:
             user = User.get_by_irc_id(username)
         admin = User.get_by_irc_id(self.event.source())
         if admin == None:
             reply = 'You are no admin.'
         elif not admin.admin:
             reply = 'You are no admin.'
         elif user != None:
             if user.user_id != admin.user_id:
                 user.admin = not user.admin
                 if user.admin:
                     reply = 'You made %s an admin.' % user.user_id
                 else:
                     reply = 'You took admin rights from %s.' % user.user_id
             else:
                 reply = 'You can not strip yourself of your admin rights.'
     except User.NotLoggedIn, e:
         reply = str(e)