aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/ChannelManager.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/MessageIrcImpl.java39
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/MessageManager.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/Utils.java12
-rw-r--r--test/net/java/sip/communicator/impl/protocol/irc/MessageIrcImplTest.java14
-rw-r--r--test/net/java/sip/communicator/impl/protocol/irc/UtilsTest.java8
6 files changed, 9 insertions, 68 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ChannelManager.java b/src/net/java/sip/communicator/impl/protocol/irc/ChannelManager.java
index f8a6a58..95b54d5 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/ChannelManager.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/ChannelManager.java
@@ -1142,7 +1142,7 @@ public class ChannelManager
this.chatroom, userNick, msg.getSource().getIdent(), msg
.getSource().getHostname(), ChatRoomMemberRole.MEMBER);
MessageIrcImpl message =
- MessageIrcImpl.newActionFromIRC(member, msg.getText());
+ MessageIrcImpl.newActionFromIRC(msg.getText());
this.chatroom.fireMessageReceivedEvent(message, member, new Date(),
ChatRoomMessageReceivedEvent.CONVERSATION_MESSAGE_RECEIVED);
}
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/MessageIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/MessageIrcImpl.java
index 90a70ff..8a405aa 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/MessageIrcImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/MessageIrcImpl.java
@@ -99,49 +99,16 @@ public class MessageIrcImpl
}
/**
- * Create a new instance from an IRC text and parse the IRC message. (See
- * {@link #newMessageFromIRC(String)}.)
- *
- * @param user the originating user
- * @param message the IRC action message
- * @return returns a new message instance
- */
- public static MessageIrcImpl newActionFromIRC(
- final ChatRoomMemberIrcImpl user, final String message)
- {
- return newActionFromIRC(user.getContactAddress(), message);
- }
-
- /**
- * Create a new instance from an IRC text and parse the IRC message. (See
- * {@link #newMessageFromIRC(String)}.)
- *
- * @param user the originating user
- * @param message the IRC action message
- * @return returns a new message instance
- */
- public static MessageIrcImpl newActionFromIRC(final Contact user,
- final String message)
- {
- return newActionFromIRC(user.getAddress(), message);
- }
-
- /**
* Construct the new action message.
*
- * @param user the originating user
* @param message the IRC action message
* @return returns a new message instance
*/
- private static MessageIrcImpl newActionFromIRC(final String user,
- final String message)
+ public static MessageIrcImpl newActionFromIRC(final String message)
{
String text = Utils.parseIrcMessage(message);
- // TODO consider returning message starting with "/me " and let Jitsi do
- // the /me formatting.
- text = Utils.styleAsAction(text, user);
- return new MessageIrcImpl(text, HTML_MIME_TYPE, DEFAULT_MIME_ENCODING,
- null);
+ return new MessageIrcImpl("/me " + text, HTML_MIME_TYPE,
+ DEFAULT_MIME_ENCODING, null);
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/MessageManager.java b/src/net/java/sip/communicator/impl/protocol/irc/MessageManager.java
index f759eb8..249aab8 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/MessageManager.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/MessageManager.java
@@ -424,7 +424,7 @@ public class MessageManager
MessageManager.this.provider.getPersistentPresence()
.findContactByID(user);
final MessageIrcImpl message =
- MessageIrcImpl.newActionFromIRC(from, msg.getText());
+ MessageIrcImpl.newActionFromIRC(msg.getText());
MessageManager.this.provider.getBasicInstantMessaging()
.fireMessageReceived(message, from);
}
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/Utils.java b/src/net/java/sip/communicator/impl/protocol/irc/Utils.java
index 05f86b7..d749a90 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/Utils.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/Utils.java
@@ -212,18 +212,6 @@ public final class Utils
}
/**
- * Format message as HTML-formatted action.
- *
- * @param message original IRC message
- * @param user user nick name
- * @return returns HTML-formatted action
- */
- public static String styleAsAction(final String message, final String user)
- {
- return "<b>*" + user + "</b> " + message;
- }
-
- /**
* Format message as HTML-formatted away message.
*
* @param text away message
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/MessageIrcImplTest.java b/test/net/java/sip/communicator/impl/protocol/irc/MessageIrcImplTest.java
index 02eabd2..e79030b 100644
--- a/test/net/java/sip/communicator/impl/protocol/irc/MessageIrcImplTest.java
+++ b/test/net/java/sip/communicator/impl/protocol/irc/MessageIrcImplTest.java
@@ -68,13 +68,9 @@ public class MessageIrcImplTest
// Test with chat room member.
ChatRoomMemberIrcImpl chatRoomMember =
EasyMock.createMock(ChatRoomMemberIrcImpl.class);
- EasyMock.expect(chatRoomMember.getContactAddress())
- .andReturn("IamUser");
EasyMock.replay(chatRoomMember);
- MessageIrcImpl message =
- MessageIrcImpl.newActionFromIRC(chatRoomMember, text);
- Assert.assertEquals(Utils.styleAsAction(text, "IamUser"),
- message.getContent());
+ MessageIrcImpl message = MessageIrcImpl.newActionFromIRC(text);
+ Assert.assertEquals("/me Hello world.", message.getContent());
Assert.assertEquals(MessageIrcImpl.HTML_MIME_TYPE,
message.getContentType());
Assert.assertEquals(MessageIrcImpl.DEFAULT_MIME_ENCODING,
@@ -83,11 +79,9 @@ public class MessageIrcImplTest
// Test with contact.
ContactIrcImpl contact = EasyMock.createMock(ContactIrcImpl.class);
- EasyMock.expect(contact.getAddress()).andReturn("IamUser");
EasyMock.replay(contact);
- message = MessageIrcImpl.newActionFromIRC(contact, text);
- Assert.assertEquals(Utils.styleAsAction(text, "IamUser"),
- message.getContent());
+ message = MessageIrcImpl.newActionFromIRC(text);
+ Assert.assertEquals("/me Hello world.", message.getContent());
Assert.assertEquals(MessageIrcImpl.HTML_MIME_TYPE,
message.getContentType());
Assert.assertEquals(MessageIrcImpl.DEFAULT_MIME_ENCODING,
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/UtilsTest.java b/test/net/java/sip/communicator/impl/protocol/irc/UtilsTest.java
index 92b6ed8..430eb94 100644
--- a/test/net/java/sip/communicator/impl/protocol/irc/UtilsTest.java
+++ b/test/net/java/sip/communicator/impl/protocol/irc/UtilsTest.java
@@ -194,12 +194,4 @@ public class UtilsTest
Assert.assertEquals("<i>MrNiceGuy</i>: hello world",
Utils.styleAsNotice(message, nick));
}
-
- public void testStyleAsAction()
- {
- String message = "is absolutely crazy!";
- String nick = "AbsoluteLunatic";
- Assert.assertEquals("<b>*AbsoluteLunatic</b> is absolutely crazy!",
- Utils.styleAsAction(message, nick));
- }
}