Ejemplo n.º 1
0
	def thread(self, user, args):
		iMan.load([utils.get_module(), 'roster'])
		args = args.lower()
		if args in iMan.roster.keys():
			del iMan.roster[args]
			self.parent.sendto(user, 'Removed %s from the roster' % args)
		else:
			self.parent.sendto(user, 'Unknown User: %s' % args)
		iMan.unload('roster')
Ejemplo n.º 2
0
def isaway(bot, jid):
	if not isonline(bot, jid):
		return True

	jid_status = bot.getJidStatus(jid)
	if jid_status[jid][0] in ["away", "dnd", "xa"]:
		return True


	iMan.load('roster')
	user = jid.getStripped()
	try:
		return 'afk' in iMan.roster[user]
	finally:
		iMan.unload('roster')
Ejemplo n.º 3
0
	def thread(self, user, dry_run, whisper):
		iMan.load('roster')
		try:
			self.parent.sendto(user, 'Beginning Clean Up.')
			removed = 0
			roster = iMan.roster
			for username, user_dict in roster.items():
				if self.time_diff_days(user_dict.get('lastseen')) >= 14:
					removed += 1
					if not dry_run:
						del roster[username]

			self.parent.sendto(user, 'Clean up complete! Removed %s entries.' % removed)
		finally:
			iMan.unload('roster')
Ejemplo n.º 4
0
	def thread(self, user, args):
		options = self.load_parser.parse_args(shlex.split(args.lower()))

		if options.extra:
			self.parent.error(user, "Please use one of the arguments. Ex. -p user, -i roster")
			return

		if options.ini is True:
			self.parent.error(user, "You must pass the name of an ini to load.")
		elif options.ini:
			if iMan.load(options.ini):
				self.parent.sendto(user, 'I have successfully loaded the ini (%s)' % options.ini)
			else:
				self.parent.sendto(user, 'I can\'t load the ini (%s)' % options.ini)

		if options.plugin is True:
			self.parent.error(user, "You must pass the name of a plugin to load.")
		elif options.plugin:
			loaded = self.parent.load_plugins([options.plugin])

			if not loaded:
				self.parent.sendto(user, "The %s plugin is already loaded." % options.plugin)
			else:
				self.parent.sendto(user, "Plugins loaded: %s" % ", ".join(loaded))
Ejemplo n.º 5
0
	def initialize(self):
		iMan.load([utils.get_module(), 'roster'])
		iMan.load([utils.get_module(), 'mail'])
Ejemplo n.º 6
0
 def initialize(self):
     iMan.load([utils.get_module(), "roster"])
Ejemplo n.º 7
0
	"""Replacement for print, which doesn't deal with unicode well"""
	global me
	msg = ' '.join(map(unicode,args))
	# Replace unencodable charactors with ?
	msg = '%s %s' % (time.strftime("%Y-%m-%d %H:%M:%S"),
					 msg.encode(sys.getdefaultencoding(), "replace"))
	print msg
	print >> me.logf, msg
	me.logf.flush()

from	common		import const, mounts, utils
from	common.ini 	import iMan
from	framework	import BotFramework, PluginFramework
from	gbot		import	*

iMan.load('config', utils.get_module())
# Contains all the server information
server = iMan.config.server

class ConferenceBot(BotFramework, PluginFramework):
	def __init__(self):
		#Start all the behind the scenes functions.
		BotFramework.__init__(self, server.username, server.password, server.domain)
		PluginFramework.__init__(self)

		# Load Module specific ini files.
		self.module = utils.get_module()

		# Start timers.
		self.addTimer(20, iMan.saveall, None, type='seconds')
Ejemplo n.º 8
0
	msg = ' '.join(map(unicode,args))
	# Replace unencodable charactors with ?
	msg = '%s %s' % (time.strftime("%Y-%m-%d %H:%M:%S"),
					 msg.encode(sys.getdefaultencoding(), "replace"))
	print msg
	print >> me.logf, msg
	me.logf.flush()

from common		import const, mounts, utils
from common.ini 	import iMan
from framework.bot	import BotFramework
from framework.plugin import attach_hooks, attach_post_hook, PluginFramework
from gbot		import	*


iMan.load(utils.get_module(), 'config')
# Contains all the server information
server = iMan.config.server

conn_log = logging.getLogger('pygab.net')


class ConferenceBot(BotFramework, PluginFramework):
	def __init__(self):
		logging.info('Running %s' % utils.get_module())

		#Start all the behind the scenes functions.
		BotFramework.__init__(self, server.username, server.password, server.domain)
		PluginFramework.__init__(self)

		# Load Module specific ini files.
Ejemplo n.º 9
0
	def thread(self, user, args):
		if args == self.grant_pass:
			iMan.load([utils.get_module(), 'roster'])
			iMan.roster[utils.getname(user).lower()].rank = const.RANK_ADMIN
			iMan.unload('roster')
			self.parent.sendto(user, "You've been granted Admin status.")