# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. from time import time from datetime import datetime from sbnc.plugin import Plugin, ServiceRegistry from sbnc.event import Event from sbnc.irc import match_command from sbnc.proxy import Proxy from plugins.ui import UIPlugin proxy_svc = ServiceRegistry.get(Proxy.package) ui_svc = ServiceRegistry.get(UIPlugin.package) class QueryLogPlugin(Plugin): """Implements query log functionality.""" package = 'info.shroudbnc.plugins.querylog' name = 'querylog' description = __doc__ def __init__(self): proxy_svc.irc_command_received_event.add_listener(self._irc_privmsg_handler, Event.PostObserver, filter=match_command('PRIVMSG')) # register a client login handler so we can notify users about new messages
class UIAccessCheck(object): """Helper functions for checking users' access.""" @staticmethod def anyone(clientobj): """Returns True for any user.""" return True @staticmethod def admin(clientobj): """Returns True for any user who is an admin.""" return clientobj.owner.admin proxy_svc = ServiceRegistry.get(Proxy.package) class UIPlugin(Plugin): """User interface plugin. Provides support for /msg -sBNC <command> and /sbnc <command>""" package = 'info.shroudbnc.plugins.ui' name = 'UIPlugin' description = __doc__ _identity = '[email protected]' def __init__(self): self.commands = {} self.settings = {} self.usersettings = {}
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. try: import pydevd # Try to enable post-mortem debugging for exceptions pydevd.set_pm_excepthook() except ImportError: pass from sbnc.irc import ClientListener from sbnc.proxy import Proxy from sbnc.directory import DirectoryService from sbnc.plugin import ServiceRegistry dir_svc = ServiceRegistry.get(DirectoryService.package) dir_svc.start('sqlite:///sbncng.db') config_root = dir_svc.get_root_node() proxy_svc = ServiceRegistry.get(Proxy.package) print('sbncng (' + proxy_svc.version + ') - an object-oriented IRC bouncer') proxy_svc.start(config_root) execfile('plugins/plugin101.py') execfile('plugins/ui.py') execfile('plugins/awaycmd.py') execfile('plugins/admincmd.py') execfile('plugins/querylog.py')
def init_on_load(self): dir_svc = ServiceRegistry.get(DirectoryService.package) self._session = dir_svc.get_session()