Package com.uwyn.drone.core

Examples of com.uwyn.drone.core.Module


  private void dispatchModuleMessage(Collection modules, ModuleMessage message)
  {
    if (modules != null)
    {
      Iterator  modules_it = modules.iterator();
      Module    module = null;
      while (modules_it.hasNext())
      {
        module = (Module)modules_it.next();
        module.getRunner().addMessage(message);
      }
    }
  }
View Full Code Here


        mConnectedNick = (String)message.getParameters().get(0);
        mLoggedOn = true;
       
        // call all the connected methods of the registered modules
        Iterator  it = mModules.iterator();
        Module    module = null;
        while (it.hasNext())
        {
          module = (Module)it.next();
          module.loggedon(this);
        }

        // fire the bot event
        fireLoggedOn();
       
View Full Code Here

  throws CoreException
  {
    if (command.equals("help"))
    {
      Map    modules = bot.getNamedModules();
      Module  module = null;
     
      // display module-specific help
      if (arguments != null &&
        arguments.trim().length() > 0)
      {
        Matcher logsearch_matcher = HELP_PATTERN.matcher(arguments.toLowerCase());
       
        // check if the syntax is correct
        if (!logsearch_matcher.matches() ||
          (logsearch_matcher.groupCount() < 1 &&
           logsearch_matcher.groupCount() > 2))
        {
          bot.send(new Privmsg(nick, "Invalid syntax '"+command+" "+arguments+"'."));
          return;
        }
       
        // get the different help arguments
        String module_name = null;
        String help_key = null;
        module_name = logsearch_matcher.group(1);
        if (logsearch_matcher.groupCount() > 1)
        {
          help_key = logsearch_matcher.group(2);
          if (0 == help_key.length())
          {
            help_key = null;
          }
        }
       
        // check if the module is known
        module = (Module)modules.get(module_name);
        if (null == module)
        {
          bot.send(new Privmsg(nick, "Unknown module '"+module_name+"'."));
          return;
        }
       
        // obtain the requested help text
        Map helpmap = module.getHelpMap();
        if (null == helpmap ||
          !helpmap.containsKey(help_key))
        {
          bot.send(new Privmsg(nick, "Couldn't find the requested help information in module '"+module_name+"'."));
          return;
        }
       
        // output the help text
        String help = (String)helpmap.get(help_key);
        help = StringUtils.replace(help, VAR_MODULENAME, module.getName());
        outputHelp(bot, nick, help);
      }
      // display help about all the installed modules
      else
      {
        if (modules.size() > 0)
        {
          StringBuffer  module_help = new StringBuffer(MODULES_HELP);
          String      description = null;
         
          Iterator  modules_it = modules.values().iterator();
          while (modules_it.hasNext())
          {
            module = (Module)modules_it.next();
           
            module_help.append(AttributeCode.BOLD+module.getName()+AttributeCode.BOLD+AttributeCode.ENDLINE);
            description = module.getDescription();
            if (description != null)
            {
              module_help.append(module.getDescription()+AttributeCode.ENDLINE);
            }
          }
       
          // output the help text
          outputHelp(bot, nick, module_help.toString());
View Full Code Here

TOP

Related Classes of com.uwyn.drone.core.Module

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.