mirror of https://github.com/sipwise/jitsi.git
parent
cd55394686
commit
c37d6f45a3
@ -0,0 +1,53 @@
|
||||
package net.java.sip.communicator.impl.protocol.irc;
|
||||
|
||||
import net.java.sip.communicator.service.protocol.ChatRoomMemberRole;
|
||||
|
||||
public enum Mode
|
||||
{
|
||||
OWNER('O', ChatRoomMemberRole.OWNER),
|
||||
OPERATOR('o', ChatRoomMemberRole.ADMINISTRATOR),
|
||||
VOICE('v', ChatRoomMemberRole.MEMBER);
|
||||
|
||||
public static ChatRoomMemberRole convertSymbolToRole(char symbol)
|
||||
{
|
||||
for(Mode mode : Mode.values())
|
||||
{
|
||||
if (mode.getSymbol() == symbol)
|
||||
{
|
||||
return mode.getRole();
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid mode symbol provided. ('"+symbol+"')");
|
||||
}
|
||||
|
||||
public static Mode bySymbol(char symbol)
|
||||
{
|
||||
for(Mode mode : Mode.values())
|
||||
{
|
||||
if (mode.getSymbol() == symbol)
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown mode symbol provided. ('"+symbol+"')");
|
||||
}
|
||||
|
||||
final private char symbol;
|
||||
final private ChatRoomMemberRole role;
|
||||
|
||||
private Mode(char symbol, ChatRoomMemberRole role)
|
||||
{
|
||||
this.symbol = symbol;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public char getSymbol()
|
||||
{
|
||||
return this.symbol;
|
||||
}
|
||||
|
||||
public ChatRoomMemberRole getRole()
|
||||
{
|
||||
return this.role;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package net.java.sip.communicator.impl.protocol.irc.listener;
|
||||
|
||||
import com.ircclouds.irc.api.domain.messages.ServerNotice;
|
||||
import com.ircclouds.irc.api.domain.messages.ServerNumericMessage;
|
||||
import com.ircclouds.irc.api.domain.messages.interfaces.IMessage;
|
||||
import com.ircclouds.irc.api.listeners.IMessageListener;
|
||||
|
||||
public class GenericListener
|
||||
implements IMessageListener
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onMessage(IMessage msg)
|
||||
{
|
||||
if (msg instanceof ServerNotice)
|
||||
{
|
||||
System.out.println("NOTICE: " + ((ServerNotice) msg).getText());
|
||||
}
|
||||
else if (msg instanceof ServerNumericMessage)
|
||||
{
|
||||
System.out.println("NUM MSG: "
|
||||
+ ((ServerNumericMessage) msg).getNumericCode() + ": "
|
||||
+ ((ServerNumericMessage) msg).getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Listeners for irc-api.
|
||||
*/
|
||||
/**
|
||||
* @author danny
|
||||
*
|
||||
*/
|
||||
package net.java.sip.communicator.impl.protocol.irc.listener;
|
||||
Loading…
Reference in new issue