|
Lines 43-48
Link Here
|
| 43 |
import org.eclipse.ecf.presence.chatroom.IChatRoomParticipantListener; |
43 |
import org.eclipse.ecf.presence.chatroom.IChatRoomParticipantListener; |
| 44 |
import org.eclipse.ecf.presence.history.IHistory; |
44 |
import org.eclipse.ecf.presence.history.IHistory; |
| 45 |
import org.eclipse.ecf.presence.history.IHistoryManager; |
45 |
import org.eclipse.ecf.presence.history.IHistoryManager; |
|
|
46 |
import org.eclipse.ecf.presence.im.IChatMessageSender; |
| 47 |
import org.eclipse.ecf.presence.im.IChatMessage.Type; |
| 46 |
import org.eclipse.osgi.util.NLS; |
48 |
import org.eclipse.osgi.util.NLS; |
| 47 |
import org.schwering.irc.lib.IRCConnection; |
49 |
import org.schwering.irc.lib.IRCConnection; |
| 48 |
import org.schwering.irc.lib.IRCEventListener; |
50 |
import org.schwering.irc.lib.IRCEventListener; |
|
Lines 57-63
Link Here
|
| 57 |
* |
59 |
* |
| 58 |
*/ |
60 |
*/ |
| 59 |
public class IRCRootContainer extends IRCAbstractContainer implements |
61 |
public class IRCRootContainer extends IRCAbstractContainer implements |
| 60 |
IContainer, IChatRoomInvitationSender, IChatRoomManager, |
62 |
IContainer, IChatMessageSender, IChatRoomInvitationSender, IChatRoomManager, |
| 61 |
IChatRoomContainer, IRCMessageChannel, IChatRoomContainerOptionsAdapter { |
63 |
IChatRoomContainer, IRCMessageChannel, IChatRoomContainerOptionsAdapter { |
| 62 |
|
64 |
|
| 63 |
private static final long CONNECT_TIMEOUT = 20000; |
65 |
private static final long CONNECT_TIMEOUT = 20000; |
|
Lines 364-376
Link Here
|
| 364 |
* @see org.eclipse.ecf.core.IContainer#getAdapter(java.lang.Class) |
366 |
* @see org.eclipse.ecf.core.IContainer#getAdapter(java.lang.Class) |
| 365 |
*/ |
367 |
*/ |
| 366 |
public Object getAdapter(Class serviceType) { |
368 |
public Object getAdapter(Class serviceType) { |
| 367 |
if (serviceType == null) |
369 |
if (serviceType != null && serviceType.isInstance(this)) { |
| 368 |
return null; |
370 |
return null; |
| 369 |
if (serviceType.equals(IChatRoomManager.class) |
371 |
} else { |
| 370 |
|| serviceType.equals(IChatRoomContainerOptionsAdapter.class)) |
|
|
| 371 |
return this; |
| 372 |
else |
| 373 |
return null; |
372 |
return null; |
|
|
373 |
} |
| 374 |
} |
374 |
} |
| 375 |
|
375 |
|
| 376 |
/* |
376 |
/* |
|
Lines 723-749
Link Here
|
| 723 |
private void showMessage(String channel, String msg) { |
723 |
private void showMessage(String channel, String msg) { |
| 724 |
IRCChannelContainer msgChannel = getChannel(channel); |
724 |
IRCChannelContainer msgChannel = getChannel(channel); |
| 725 |
if (msgChannel != null) |
725 |
if (msgChannel != null) |
| 726 |
msgChannel.fireMessageListeners(createIDFromString(channel), msg); |
726 |
msgChannel.fireChatRoomMessageEvent(createIDFromString(channel), msg); |
| 727 |
else |
727 |
else |
| 728 |
fireMessageListeners((channel == null) ? getSystemID() |
728 |
fireChatRoomMessageEvent((channel == null) ? getSystemID() |
| 729 |
: createIDFromString(channel), msg); |
729 |
: createIDFromString(channel), msg); |
| 730 |
} |
730 |
} |
| 731 |
|
731 |
|
| 732 |
private void showMessage(String channel, String user, String msg) { |
732 |
private void showMessage(String channel, String user, String msg) { |
| 733 |
IRCChannelContainer msgChannel = getChannel(channel); |
733 |
IRCChannelContainer msgChannel = getChannel(channel); |
| 734 |
if (msgChannel != null) |
734 |
if (msgChannel != null) { |
| 735 |
msgChannel.fireMessageListeners(createIDFromString(user), msg); |
735 |
msgChannel.fireChatRoomMessageEvent(createIDFromString(user), msg); |
| 736 |
else |
736 |
} else { |
| 737 |
fireMessageListeners(createIDFromString(user), msg); |
737 |
fireChatMessageEvent(createIDFromString(user), msg); |
|
|
738 |
for (Iterator it = channels.values().iterator(); it.hasNext();) { |
| 739 |
msgChannel = (IRCChannelContainer) it.next(); |
| 740 |
msgChannel.fireChatMessageEvent(createIDFromString(user), msg); |
| 741 |
} |
| 742 |
} |
| 738 |
} |
743 |
} |
| 739 |
|
744 |
|
| 740 |
private void showErrorMessage(String channel, String msg) { |
745 |
private void showErrorMessage(String channel, String msg) { |
| 741 |
IRCChannelContainer msgChannel = getChannel(channel); |
746 |
IRCChannelContainer msgChannel = getChannel(channel); |
| 742 |
if (msgChannel != null) |
747 |
if (msgChannel != null) |
| 743 |
msgChannel.fireMessageListeners((username == null) ? getSystemID() |
748 |
msgChannel.fireChatRoomMessageEvent((username == null) ? getSystemID() |
| 744 |
: createIDFromString(username), msg); |
749 |
: createIDFromString(username), msg); |
| 745 |
else |
750 |
else |
| 746 |
fireMessageListeners((username == null) ? getSystemID() |
751 |
fireChatRoomMessageEvent((username == null) ? getSystemID() |
| 747 |
: createIDFromString(username), msg); |
752 |
: createIDFromString(username), msg); |
| 748 |
} |
753 |
} |
| 749 |
|
754 |
|
|
Lines 970-973
Link Here
|
| 970 |
} |
975 |
} |
| 971 |
} |
976 |
} |
| 972 |
|
977 |
|
|
|
978 |
public void sendChatMessage(ID toID, ID threadID, Type type, |
| 979 |
String subject, String body, Map properties) throws ECFException { |
| 980 |
sendChatMessage(toID, body); |
| 981 |
} |
| 982 |
|
| 983 |
public void sendChatMessage(ID toID, String body) throws ECFException { |
| 984 |
if (toID == null) { |
| 985 |
throw new ECFException(); |
| 986 |
} |
| 987 |
connection.doPrivmsg(toID.getName(), body); |
| 988 |
} |
| 989 |
|
| 990 |
public IChatMessageSender getPrivateMessageSender() { |
| 991 |
return this; |
| 992 |
} |
| 993 |
|
| 973 |
} |
994 |
} |