def CmdJoinDo(from_name,msg): if funcs.isInBalckList(from_name): return 'you are in black list,contact administrator' if funcs.isHavePassword() and not funcs.isInWhiteList(from_name): if GetCmdNum(msg) != 3: if not funcs.isInGroupUser(from_name): ret_str = '%s was trying to join group' % from_name funcs.sendMsgToAdminUsers(ret_str) return 'ERROR:this group need password!' passwd = GetCmdByNum(msg,3) if not funcs.checkPassword(passwd): if not funcs.isInGroupUser(from_name): ret_str = '%s was trying to join group' % from_name funcs.sendMsgToAdminUsers(ret_str) return 'ERROR:group password not correct!' if GetCmdNum(msg) < 2: return 'need nickname' nickname = GetCmdByNum(msg,2) user = funcs.getUserByNickname(nickname) if user: return 'nickname:%s is taken by somebody' % nickname user = funcs.getUserByName(from_name) if user: return 'you have been joined already' funcs.userJoin(from_name,nickname) ret_msg = u'welcome %s joined this group' % nickname funcs.Broadcast(ret_msg) return 'you join successfully'
def CmdJoinDo(from_name, msg): if funcs.isInBalckList(from_name): return 'you are in black list,contact administrator' if funcs.isHavePassword() and not funcs.isInWhiteList(from_name): if GetCmdNum(msg) != 3: if not funcs.isInGroupUser(from_name): ret_str = '%s was trying to join group' % from_name funcs.sendMsgToAdminUsers(ret_str) return 'ERROR:this group need password!' passwd = GetCmdByNum(msg, 3) if not funcs.checkPassword(passwd): if not funcs.isInGroupUser(from_name): ret_str = '%s was trying to join group' % from_name funcs.sendMsgToAdminUsers(ret_str) return 'ERROR:group password not correct!' if GetCmdNum(msg) < 2: return 'need nickname' nickname = GetCmdByNum(msg, 2) user = funcs.getUserByNickname(nickname) if user: return 'nickname:%s is taken by somebody' % nickname user = funcs.getUserByName(from_name) if user: return 'you have been joined already' funcs.userJoin(from_name, nickname) ret_msg = u'welcome %s joined this group' % nickname funcs.Broadcast(ret_msg) return 'you join successfully'
def CmdInviteDo(from_name,msg): if GetCmdNum(msg) < 2: return 'error:need gtalk who be invited' invite_gmail = GetCmdByNum(msg,2) if not mail.is_email_valid(invite_gmail): return 'error:account not email' if funcs.isInBalckList(invite_gmail): funcs.delBlackList(invite_gmail) else: user = funcs.getUserByName(invite_gmail) if user: return '%s have been joined already' % invite_gmail xmpp_api.send_invite(invite_gmail) if not funcs.isInWhiteList(invite_gmail): funcs.addWhiteList(invite_gmail) return 'An invitation has been sent to %s ok,she/he can NOT chat until /join' % invite_gmail
def CmdInviteDo(from_name, msg): if GetCmdNum(msg) < 2: return 'error:need gtalk who be invited' invite_gmail = GetCmdByNum(msg, 2) if not mail.is_email_valid(invite_gmail): return 'error:account not email' if funcs.isInBalckList(invite_gmail): funcs.delBlackList(invite_gmail) else: user = funcs.getUserByName(invite_gmail) if user: return '%s have been joined already' % invite_gmail xmpp_api.send_invite(invite_gmail) if not funcs.isInWhiteList(invite_gmail): funcs.addWhiteList(invite_gmail) return 'An invitation has been sent to %s ok,she/he can NOT chat until /join' % invite_gmail