Beispiel #1
0
def commandListAgents(self, command):
	"""
		List all users in the system
		update the list of nicks first
	"""
	if self.agent is None:
		self.writeConsole('You don\'t have an active agent.\n/add an agent or /login in order to list agents.') 
		return
	#update nicknames
	if util.pollAllPosts(self):
		util.checkNewNicks(self)
	self.writeConsole('\n== Agents ==\n')
	util.getAllNicks(self)
	for nick in self.allNicks:
		self.writeConsole(nick)
	return
Beispiel #2
0
def commandNick(self, command):
    """
		set a nickname for the user
		nickname needs to be unique
		update profile
		update the list of nicks first
	"""
    if self.agent is None:
        self.writeConsole(
            'You don\'t have an active agent.\n/add an agent or /login in order to set your nickname.'
        )
        return
    if len(command) < 2:
        self.writeConsole('You need to specify a nickname')
        return
    #update nicknames
    if util.pollAllPosts(self):
        util.checkNewNicks(self)
    util.getAllNicks(self)
    if command[1] in self.allNicks:
        self.writeConsole(command[1] + ' is already taken as a nickname.')
        return
    try:
        response = self.agent.post('nick:' + command[1])
        if response['success'] == 1:
            self.writeConsole('(' + str(response['command_result']) +
                              ') >> Set nickname to ' + str(command[1]))
            self.agentNick = command[1]
            conn = sqlite3.connect('coinflow.db')
            c = conn.cursor()
            c.execute('select id from profiles where seed=?;',
                      (str(self.agentSeed), ))
            id = c.fetchone()
            if id is None:
                c.execute('insert into profiles (nick, seed) values (?,?);',
                          (str(self.agentNick), str(self.agentSeed)))
            else:
                c.execute('update profiles set nick=? where seed=?;',
                          (str(self.agentNick), str(self.agentSeed)))
            conn.commit()
            conn.close()
        else:
            self.writeConsole('Setting nick failed')
    except netvend.NetvendResponseError as e:
        self.writeConsole('Setting nick failed - ' + str(e))
    return
Beispiel #3
0
def commandListAgents(self, command):
    """
		List all users in the system
		update the list of nicks first
	"""
    if self.agent is None:
        self.writeConsole(
            'You don\'t have an active agent.\n/add an agent or /login in order to list agents.'
        )
        return
    #update nicknames
    if util.pollAllPosts(self):
        util.checkNewNicks(self)
    self.writeConsole('\n== Agents ==\n')
    util.getAllNicks(self)
    for nick in self.allNicks:
        self.writeConsole(nick)
    return
Beispiel #4
0
def commandNick(self, command):
	"""
		set a nickname for the user
		nickname needs to be unique
		update profile
		update the list of nicks first
	"""
	if self.agent is None:
		self.writeConsole('You don\'t have an active agent.\n/add an agent or /login in order to set your nickname.') 
		return
	if len(command) < 2:
		self.writeConsole('You need to specify a nickname')
		return
	#update nicknames
	if util.pollAllPosts(self):
		util.checkNewNicks(self)
	util.getAllNicks(self)
	if command[1] in self.allNicks:
		self.writeConsole(command[1] + ' is already taken as a nickname.')
		return
	try:
		response = self.agent.post('nick:' + command[1])
		if response['success'] == 1:
			self.writeConsole('(' + str(response['command_result']) + ') >> Set nickname to ' + str(command[1]))
			self.agentNick = command[1]
			conn = sqlite3.connect('coinflow.db')
			c = conn.cursor()
			c.execute('select id from profiles where seed=?;', (str(self.agentSeed),))
			id = c.fetchone()
			if id is None:
				c.execute('insert into profiles (nick, seed) values (?,?);', (str(self.agentNick), str(self.agentSeed)))
			else:
				c.execute('update profiles set nick=? where seed=?;', (str(self.agentNick), str(self.agentSeed)))
			conn.commit()
			conn.close()
		else:
			self.writeConsole('Setting nick failed')
	except netvend.NetvendResponseError as e:
		self.writeConsole('Setting nick failed - ' + str(e))
	return