Adds message source service custom status, to be able to show custom status icon for msg src contacts when needed.

fix-message-formatting 5183
Damian Minkov 12 years ago
parent f4ad84e3ec
commit dfc91fa636

@ -99,7 +99,7 @@ service.gui.icons.KICK_16x16=resources/images/impl/gui/common/kick16x16.png
service.gui.icons.VOICEMAIL=resources/images/impl/gui/common/voicemail.png
service.gui.icons.SEND_SMS=resources/images/impl/gui/common/sendSMSButton.png
service.gui.icons.SEND_SMS_SELECTED=resources/images/impl/gui/common/sendSMSSelectedButton.png
service.gui.icons.SMS_ICON=resources/images/impl/gui/common/phoneAvatar.png
service.gui.icons.SMS_STATUS_ICON=resources/images/impl/gui/common/smsStatusIcon.png
service.gui.icons.SMS_BUTTON_ICON=resources/images/impl/gui/common/smsButton.png
service.gui.icons.TYPING=resources/images/impl/gui/common/typing.gif
service.gui.icons.WINDOW_RESIZE_ICON=resources/images/impl/gui/common/windowResizeIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -15,6 +15,7 @@
import javax.swing.text.html.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.service.msghistory.*;
import net.java.sip.communicator.service.muc.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@ -273,6 +274,12 @@ else if(connectivity <
return ImageLoader
.getImage(ImageLoader.CHAT_ROOM_ONLINE_ICON);
}
else if(connectivity == MessageSourceContactPresenceStatus
.MSG_SRC_CONTACT_ONLINE_THRESHOLD)
{
return ImageLoader
.getImage(ImageLoader.MSG_SRC_CONTACT_ONLINE_ICON);
}
else if(connectivity < PresenceStatus.MAX_STATUS_VALUE)
{
return ImageLoader

@ -988,7 +988,7 @@ public class ImageLoader
*/
public static final ImageID CHAT_ROOM_MENU_ICON
= new ImageID("service.gui.icons.CHAT_ROOM_16x16_ICON");
/**
* The image used for joined chat rooms.
*/
@ -1020,6 +1020,12 @@ public class ImageLoader
public static final ImageID JOIN_AS_ICON
= new ImageID("service.gui.icons.JOIN_AS_ICON");
/**
* The image can be used for message source contact presence status.
*/
public static final ImageID MSG_SRC_CONTACT_ONLINE_ICON
= new ImageID("service.gui.icons.SMS_STATUS_ICON");
/**
* The image used to set to the chat room "leave" right button menu.
*/

@ -7,6 +7,7 @@
package net.java.sip.communicator.impl.msghistory;
import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.msghistory.*;
import net.java.sip.communicator.service.muc.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
@ -246,6 +247,12 @@ else if(source instanceof ChatRoomMessageReceivedEvent)
this.timestamp = e.getTimestamp();
}
if(service.isSMSEnabled())
{
this.status
= MessageSourceContactPresenceStatus.MSG_SRC_CONTACT_ONLINE;
}
updateMessageContent();
}

@ -15,6 +15,7 @@
import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.history.*;
import net.java.sip.communicator.service.history.records.*;
import net.java.sip.communicator.service.msghistory.*;
import net.java.sip.communicator.service.muc.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
@ -171,6 +172,10 @@ public class MessageSourceService
RECENT_MSGS_VER
= conf.getString(VER_OF_RECENT_MSGS_PROP, RECENT_MSGS_VER);
MessageSourceContactPresenceStatus.MSG_SRC_CONTACT_ONLINE
.setStatusIcon(MessageHistoryActivator.getResources()
.getImageInBytes("service.gui.icons.SMS_STATUS_ICON"));
}
/**

@ -0,0 +1,77 @@
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.msghistory;
import net.java.sip.communicator.service.protocol.*;
/**
* Special message source contact status, can be used to display
* only one (online) status for all message source contacts.
* @author Damian Minkov
*/
public class MessageSourceContactPresenceStatus
extends PresenceStatus
{
/**
* An integer for this status.
*/
public static final int MSG_SRC_CONTACT_ONLINE_THRESHOLD = 89;
/**
* Indicates that is connected and ready to communicate.
*/
public static final String ONLINE_STATUS = "Online";
/**
* An image that graphically represents the status.
*/
private byte[] statusIcon;
/**
* The Online status. Indicate that the user is able and willing to
* communicate in the chat room.
*/
public static final MessageSourceContactPresenceStatus
MSG_SRC_CONTACT_ONLINE = new MessageSourceContactPresenceStatus(
MSG_SRC_CONTACT_ONLINE_THRESHOLD,
ONLINE_STATUS);
/**
* Constructs special message source contact status.
* @param status
* @param statusName
*/
protected MessageSourceContactPresenceStatus(int status, String statusName)
{
super(status, statusName);
}
@Override
public boolean isOnline()
{
return true;
}
/**
* Sets the icon.
* @param statusIcon
*/
public void setStatusIcon(byte[] statusIcon)
{
this.statusIcon = statusIcon;
}
/**
* Returns an image that graphically represents the status.
*
* @return a byte array containing the image that graphically represents the
* status or null if no such image is available.
*/
public byte[] getStatusIcon()
{
return statusIcon;
}
}
Loading…
Cancel
Save