Package com.uwyn.drone.core

Examples of com.uwyn.drone.core.Channel


      }
     
      // obtain the requested channel
      String channel_name = seen_matcher.group(1).toLowerCase();
      String message = seen_matcher.group(2);
      Channel  channel = bot.getServer().getChannel(channel_name);
      if (null == channel)
      {
        return;
      }
     
      // send the CTCP action message to the channel
      channel.send(Ctcp.escapeAction(message));
    }
  }
View Full Code Here


      }
     
      // obtain the requested channel
      String channel_name = seen_matcher.group(1).toLowerCase();
      String message = seen_matcher.group(2);
      Channel  channel = bot.getServer().getChannel(channel_name);
      if (null == channel)
      {
        return;
      }

      // say the message on the channel
      channel.send(message);
    }
  }
View Full Code Here

        }

        // obtain the requested channel
        String channel_name = logsearch_matcher.group(1);
        String search = logsearch_matcher.group(2);
        Channel  channel = bot.getServer().getChannel(channel_name);
        if (null == channel)
        {
          bot.send(new Privmsg(nick, "Unknown channel '"+channel_name+"'"));
          return;
        }
View Full Code Here

      }
     
      // obtain the requested channel
      String channel_name = seen_matcher.group(1);
      String seen = seen_matcher.group(2);
      Channel  channel = bot.getServer().getChannel(channel_name);
      if (null == channel)
      {
        return;
      }

      // First drone requests the list of current channel names to
      // see of the requested nick isn't currently online.
      // After the response of the names-list, drone will determine
      // what the correct answer is.
      // This is done in the response() method.
      synchronized (mMessageSeensWaiting)
      {
        // register the nick as waiting for a repsonse
        ArrayList seens_waiting = mMessageSeensWaiting.getSeens(channel);
        if (null == seens_waiting)
        {
          seens_waiting = new ArrayList();
          mMessageSeensWaiting.put(channel, seens_waiting);
        }
       
        int      message_seen_index = seens_waiting.indexOf(seen);
        MessageSeen  message_seen = null;
        if (-1 == message_seen_index)
        {
          message_seen = new MessageSeen(seen);
          seens_waiting.add(message_seen);
        }
        else
        {
          message_seen = (MessageSeen)seens_waiting.get(message_seen_index);
        }
       
        if (!message_seen.getNicks().contains(nick))
        {
          message_seen.getNicks().add(nick);
         
          // request the current list of names in the channel
          bot.send(new Names(channel.getName()));
        }
      }
    }
  }
View Full Code Here

    if (null == channel_name ||
      0 == channel_name.length())
    {
      return;
    }
    Channel  channel = bot.getServer().getChannel(channel_name);
    if (null == channel)
    {
      return;
    }
   
    synchronized (mConstructedChannelNames)
    {
      // received additional name entries
      if (ResponseCode.RPL_NAMREPLY == responseCode)
      {
        ArrayList nicknames = mConstructedChannelNames.getSeens(channel);
        if (null == nicknames)
        {
          nicknames = new ArrayList();
          mConstructedChannelNames.put(channel, nicknames);
        }
        ArrayList  received_names = StringUtils.split(fullMessage.getTrailing(), " ");
        Iterator  received_names_it = received_names.iterator();
        String    received_name = null;
        while (received_names_it.hasNext())
        {
          received_name = (String)received_names_it.next();
          // remove operator and voice indicators
          if (received_name.startsWith("@") ||
            received_name.startsWith("+"))
          {
            nicknames.add(received_name.substring(1));
          }
          else
          {
            nicknames.add(received_name);
          }
        }
      }
      // received all name entries, so process all the waiting seen messages
      else if (ResponseCode.RPL_ENDOFNAMES == responseCode)
      {
        ArrayList channel_nicknames = mConstructedChannelNames.removeSeens(channel);
        if (null == channel_nicknames)
        {
          return;
        }
       
        mFinishedChannelNames.put(channel, channel_nicknames);
       
        // check of there are seen nicks names that are waiting for a
        // channel namelist
        if (!mChannelSeensWaiting.hasChannel(channel) &&
          !mMessageSeensWaiting.hasChannel(channel))
        {
          return;
        }

        synchronized (mChannelSeensWaiting)
        {
          ArrayList  channel_seens = mChannelSeensWaiting.getSeens(channel);
          String     channel_seen = null;
         
          // go over all the waiting channel seen requests and process
          // them, removing them from the waiting list
          while (channel_seens != null &&
               channel_seens.size() > 0)
          {
            channel_seen = (String)channel_seens.remove(0);
            String reply = processSeenWaiting(bot, channel, channel_seen);
            if (reply != null)
            {
              channel.send(reply);
            }
          }
        }

        synchronized (mMessageSeensWaiting)
View Full Code Here

        DatabaseFaqs  database_faq = DatabaseFaqsFactory.get();
        FaqData      faq_data = database_faq.getRandomFaq(bot);
        if (faq_data != null)
        {
          Iterator  channels_it = bot.getJoinedChannels().iterator();
          Channel    channel = null;
          while (channels_it.hasNext())
          {
            channel = (Channel)channels_it.next();
            channel.send(faq_data.getName()+": "+faq_data.getAnswer());
          }
        }
      }
    }
    catch (CoreException e)
View Full Code Here

    {
      errors.add(new ValidationError.MANDATORY("channelname"));
    }
    else
    {
      Channel channel = bot.getJoinedChannel(channelName);
      if (null == channel)
      {
        errors.add(new ValidationError.INVALID("channelname"));
      }
      else
View Full Code Here

  public final void processElement()
  {
    ArrayList errors = new ArrayList();

    Bot      bot = null;
    Channel    channel = null;
    Calendar  day = null;

    String botname = null;
    String channelname = null;
    String daystring = null;
View Full Code Here

          Bot bot = (Bot)iter.next();

          Iterator channels_it = bot.getJoinedChannels().iterator();
          while (channels_it.hasNext())
          {
            Channel     channel = ((Channel)channels_it.next());
            StringBuffer   key = new StringBuffer();
            key
              .append(Config.getRepInstance().getString("LUCENE_DIR"))
              .append(File.separator)
              .append(bot.getName())
              .append("-")
              .append(bot.getServer().getServerName())
              .append("-")
              .append(channel.getName().substring(1));
           
            if (submission.getChannel() == null ||
              submission.getChannel().equals(""))
            {
              IndexReader   r = IndexReader.open(key.toString());
              IndexSearcher   s = new IndexSearcher(r);

              searchers.add(s);
              readers.add(r);
            }
            else
            {
              String submissionChannel = submission.getChannel().substring(submission.getChannel().indexOf("#"));
              if (channel.getName().equals(submissionChannel))
              {
                IndexReader   r = IndexReader.open(key.toString());
                IndexSearcher   s = new IndexSearcher(r);

                searchers.add(s);
View Full Code Here

TOP

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

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.