Documentation and additional info in system message for mode changes.

fix-message-formatting
Danny van Heumen 12 years ago
parent f716f9a8cd
commit 87edec5f0e

@ -597,6 +597,8 @@ private class ServerListener
/**
* Print out server notices for debugging purposes and for simply
* keeping track of the connections.
*
* @param msg the server notice
*/
@Override
public void onServerNotice(ServerNotice msg)
@ -607,6 +609,8 @@ public void onServerNotice(ServerNotice msg)
/**
* Print out server numeric messages for debugging purposes and for
* simply keeping track of the connection.
*
* @param msg the numeric message
*/
@Override
public void onServerNumericMessage(ServerNumericMessage msg)
@ -619,6 +623,8 @@ public void onServerNumericMessage(ServerNumericMessage msg)
/**
* Print out received errors for debugging purposes and may be for
* expected errors that can be acted upon.
*
* @param msg the error message
*/
@Override
public void onError(ErrorMessage msg)
@ -627,6 +633,14 @@ public void onError(ErrorMessage msg)
+ msg.getText());
}
/**
* Upon receiving a private message from a user, deliver that to a
* private chat room and create one if it does not exist. We can ignore
* normal chat rooms, since they each have their own ChatRoomListener
* for managing chat room operations.
*
* @param msg the private message
*/
@Override
public void onUserPrivMessage(UserPrivMsg msg)
{
@ -655,6 +669,13 @@ public void onUserPrivMessage(UserPrivMsg msg)
deliverReceivedMessageToPrivateChat(chatroom, user, text);
}
/**
* Deliver a private message to the provided chat room.
*
* @param chatroom the chat room
* @param user the source user
* @param text the message
*/
private void deliverReceivedMessageToPrivateChat(ChatRoomIrcImpl chatroom,
String user, String text)
{
@ -665,6 +686,12 @@ private void deliverReceivedMessageToPrivateChat(ChatRoomIrcImpl chatroom,
ChatRoomMessageReceivedEvent.CONVERSATION_MESSAGE_RECEIVED);
}
/**
* Create a private chat room if one does not exist yet.
*
* @param user private chat room for this user
* @return returns the private chat room
*/
private ChatRoomIrcImpl initiatePrivateChatRoom(String user)
{
ChatRoomIrcImpl chatroom =
@ -1011,7 +1038,11 @@ private void processModeMessage(ChannelModeMessage msg)
{
message =
new MessageIrcImpl("channel limit set to "
+ Integer.parseInt(mode.getParams()[0]),
+ Integer.parseInt(mode.getParams()[0])
+ " by "
+ (sourceMember.getContactAddress()
.length() == 0 ? "server"
: sourceMember.getContactAddress()),
"text/plain", "UTF-8", null);
}
catch (NumberFormatException e)
@ -1022,8 +1053,16 @@ private void processModeMessage(ChannelModeMessage msg)
}
else
{
// FIXME "server" is now easily fakeable if someone
// calls himself server. There should be some other way
// to represent the server if a message comes from
// something other than a normal chat room member.
message =
new MessageIrcImpl("channel limit removed",
new MessageIrcImpl(
"channel limit removed by "
+ (sourceMember.getContactAddress()
.length() == 0 ? "server"
: sourceMember.getContactAddress()),
"text/plain", "UTF-8", null);
}
this.chatroom.fireMessageReceivedEvent(message,

Loading…
Cancel
Save