Package com.uwyn.drone.modules.seenmanagement

Examples of com.uwyn.drone.modules.seenmanagement.SeenData


    }
  }
 
  public void channelMessage(Bot bot, Channel channel, String nick, ServerMessage fullMessage)
  {
    SeenData    seen_data = new SeenData(nick, new Timestamp(Calendar.getInstance().getTimeInMillis()), fullMessage.getTrailing(), fullMessage.getRaw());
    DatabaseSeen  database_seen = DatabaseSeenFactory.get();
    try
    {
      database_seen.recordSeen(bot, channel, seen_data);
    }
View Full Code Here


 
    try
    {
      // query the database for information about the nickname
      DatabaseSeen  database_seen = DatabaseSeenFactory.get();
      SeenData    search_result = database_seen.getSeen(bot, channel, seen);

      DATE_FORMAT.setTimeZone(TimeZone.getTimeZone(DroneConfig.getTimezone()));

      // check if the nick is part of the current channel names
      Iterator  channel_nicknames_it = mFinishedChannelNames.getSeens(channel).iterator();
      String    channel_nickname = null;
      while (channel_nicknames_it.hasNext())
      {
        channel_nickname = (String)channel_nicknames_it.next();
        if (seen.equals(channel_nickname.toLowerCase()))
        {
          StringBuffer  formatted_result = new StringBuffer();
          formatted_result.append(channel_nickname);
          formatted_result.append(" is currently online in ");
          formatted_result.append(channel.getName());
          if (null == search_result)
          {
            formatted_result.append(", but never said anything that I saw.");
          }
          else
          {
            formatted_result.append(" and last spoke on ");
            formatted_result.append(DATE_FORMAT.format(search_result.getMoment()));
            formatted_result.append(", saying '");
            formatted_result.append(search_result.getDisplayMessage());
            formatted_result.append("'.");
          }
          return formatted_result.toString();
        }
      }
     
      if (null == search_result)
      {
        StringBuffer  formatted_result = new StringBuffer();
        formatted_result.append("I've never seen ");
        formatted_result.append(seen);
        formatted_result.append(" talk in ");
        formatted_result.append(channel.getName());
        formatted_result.append(".");
        reply =  formatted_result.toString();
        return reply;
      }
      else
      {
        ServerMessage message = ServerMessage.parse(search_result.getRaw());
       
        StringBuffer  formatted_result = new StringBuffer();
        formatted_result.append(search_result.getNickname());
        formatted_result.append(" (");
        formatted_result.append(message.getPrefix().getRaw().substring(1));
        formatted_result.append(") was last seen in ");
        formatted_result.append(channel.getName());
        formatted_result.append(" on ");
        formatted_result.append(DATE_FORMAT.format(search_result.getMoment()));
        formatted_result.append(", saying '");
        formatted_result.append(search_result.getDisplayMessage());
        formatted_result.append("'.");
        reply =  formatted_result.toString();
        return reply;
      }
    }
View Full Code Here

TOP

Related Classes of com.uwyn.drone.modules.seenmanagement.SeenData

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.