All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ircclouds.irc.api.om.TopicMessageBuilder Maven / Gradle / Ivy

There is a newer version: 1.0-0014
Show newest version
package com.ircclouds.irc.api.om;

import java.util.*;

import com.ircclouds.irc.api.domain.*;
import com.ircclouds.irc.api.domain.messages.*;

/**
 * 
 * @author didry
 * 
 */
public class TopicMessageBuilder implements IBuilder
{
	@Override
	public TopicMessage build(String aMessage)
	{
		// user TOPIC #channel :topic
		int idx1 = aMessage.indexOf(' ');
		int idx2 = aMessage.indexOf(' ', idx1 + 1);
		int idx3 = aMessage.indexOf(' ', idx2 + 1);

		String _user = aMessage.substring(1, idx1);
		String _chan = aMessage.substring(idx2 + 1, idx3);
		String _topic = aMessage.substring(idx3 + 1, aMessage.length()).substring(1);

		return new TopicMessage(_chan, new IRCTopic(_user, new Date(), _topic));
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy