Add DND to global status and when a contact is in On The Phone status, show it in the contact list(do not show Away).

Reorder status scales, when setting global statuses correct protocol status to be set.
Fix string in avatar menu (icons -> pictures).
cusax-fix
Damian Minkov 15 years ago
parent dfd5011bac
commit aa4069067d

@ -103,6 +103,7 @@ service.gui.statusicons.USER_NA_ICON=resources/images/impl/gui/common/statusicon
service.gui.statusicons.USER_DND_ICON=resources/images/impl/gui/common/statusicons/dnd.png
service.gui.statusicons.USER_FFC_ICON=resources/images/impl/gui/common/statusicons/freeForChat.png
service.gui.statusicons.USER_OCCUPIED_ICON=resources/images/impl/gui/common/statusicons/occupied.png
service.gui.statusicons.USER_ON_THE_PHONE_ICON=resources/images/impl/gui/common/statusicons/onThePhone.png
# service gui buttons
service.gui.buttons.CALL_BUTTON_BG=resources/images/impl/gui/buttons/callButton.png

@ -486,7 +486,7 @@ service.gui.HIDE_CERT=Hide Certificate
service.gui.avatar.CHOOSE_ICON=Choose picture
service.gui.avatar.CLEAR_RECENT=Clear recent pictures
service.gui.avatar.RECENT_ICONS=Recent icons:
service.gui.avatar.RECENT_ICONS=Recent pictures:
# service.gui.avatar.imagepicker
service.gui.avatar.imagepicker.CANCEL=Cancel
service.gui.avatar.imagepicker.CHOOSE_FILE=Choose ...

@ -84,10 +84,10 @@ public class GlobalStatusSelectorBox
*/
private final JMenuItem awayItem;
// private JMenuItem dndItem = new JMenuItem(
// GuiActivator.getResources().getI18NString("service.gui.DND_STATUS")
// .getText(),
// dndIcon);
/**
* The item corresponding to DnD status.
*/
private final JMenuItem dndItem;
/**
* The item corresponding to the free for chat status.
@ -138,6 +138,11 @@ public GlobalStatusSelectorBox(MainFrame mainFrame)
"service.gui.AWAY_STATUS",
ImageLoader.USER_AWAY_ICON,
Constants.AWAY_STATUS);
dndItem
= createMenuItem(
"service.gui.DND_STATUS",
ImageLoader.USER_DND_ICON,
Constants.DO_NOT_DISTURB_STATUS);
offlineItem
= createMenuItem(
"service.gui.OFFLINE",
@ -458,97 +463,89 @@ else if (itemName.equals(Constants.OFFLINE_STATUS))
}
else if (itemName.equals(Constants.FREE_FOR_CHAT_STATUS))
{
if (!protocolProvider.isRegistered())
continue;
OperationSetPresence presence
= protocolProvider
.getOperationSet(OperationSetPresence.class);
if (presence == null)
continue;
Iterator<PresenceStatus> statusSet
= presence.getSupportedStatusSet();
PresenceStatus status = null;
while (statusSet.hasNext())
{
PresenceStatus currentStatus = statusSet.next();
if (status == null)
status = currentStatus;
if(status.getStatus() < currentStatus.getStatus())
{
status = currentStatus;
}
}
if (status != null)
{
new PublishPresenceStatusThread(presence, status)
.start();
this.saveStatusInformation( protocolProvider,
status.getStatusName());
}
// we search for highest available status here
publishStatus(
protocolProvider,
PresenceStatus.AVAILABLE_THRESHOLD,
PresenceStatus.MAX_STATUS_VALUE);
}
else if (itemName.equals(Constants.DO_NOT_DISTURB_STATUS))
{
// status between online and away is DND
publishStatus(
protocolProvider,
PresenceStatus.ONLINE_THRESHOLD,
PresenceStatus.AWAY_THRESHOLD);
}
else if (itemName.equals(Constants.AWAY_STATUS))
{
if (!protocolProvider.isRegistered())
continue;
// a status in the away interval
publishStatus(
protocolProvider,
PresenceStatus.AWAY_THRESHOLD,
PresenceStatus.AVAILABLE_THRESHOLD);
}
}
}
OperationSetPresence presence
= protocolProvider
.getOperationSet(OperationSetPresence.class);
/**
* Publish present status. We search for the highest value in the
* given interval.
*
* @param protocolProvider the protocol provider to which we
* change the status.
* @param floorStatusValue the min status value.
* @param ceilStatusValue the max status value.
*/
private void publishStatus(
ProtocolProviderService protocolProvider,
int floorStatusValue, int ceilStatusValue)
{
if (!protocolProvider.isRegistered())
return;
if (presence == null)
continue;
OperationSetPresence presence
= protocolProvider
.getOperationSet(OperationSetPresence.class);
Iterator<PresenceStatus> statusSet
= presence.getSupportedStatusSet();
if (presence == null)
return;
PresenceStatus status = null;
Iterator<PresenceStatus> statusSet
= presence.getSupportedStatusSet();
while (statusSet.hasNext())
{
PresenceStatus currentStatus = statusSet.next();
PresenceStatus status = null;
if (status == null
&& currentStatus.getStatus()
< PresenceStatus.AVAILABLE_THRESHOLD
&& currentStatus.getStatus()
>= PresenceStatus.ONLINE_THRESHOLD)
{
status = currentStatus;
}
while (statusSet.hasNext())
{
PresenceStatus currentStatus = statusSet.next();
if (status != null)
{
if (currentStatus.getStatus()
< PresenceStatus.AVAILABLE_THRESHOLD
&& currentStatus.getStatus()
>= PresenceStatus.ONLINE_THRESHOLD
&& currentStatus.getStatus()
> status.getStatus())
{
status = currentStatus;
}
}
}
if (status == null
&& currentStatus.getStatus() < ceilStatusValue
&& currentStatus.getStatus() >= floorStatusValue)
{
status = currentStatus;
}
if (status != null)
if (status != null)
{
if (currentStatus.getStatus() < ceilStatusValue
&& currentStatus.getStatus() >= floorStatusValue
&& currentStatus.getStatus() > status.getStatus())
{
new PublishPresenceStatusThread(presence, status)
.start();
this.saveStatusInformation( protocolProvider,
status.getStatusName());
status = currentStatus;
}
}
}
if (status != null)
{
new PublishPresenceStatusThread(presence, status)
.start();
this.saveStatusInformation( protocolProvider,
status.getStatusName());
}
}
/**

@ -105,6 +105,11 @@ private void init()
JLabel titleLabel = new JLabel(GuiActivator.getResources()
.getI18NString("service.gui.avatar.RECENT_ICONS"));
titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD));
// fix for displaying text in menu
// when using a dark OS theme (as default one in ubuntu)
titleLabel.setForeground(new JMenuItem().getForeground());
panel.add(titleLabel, BorderLayout.NORTH);

@ -292,6 +292,18 @@ public static BufferedImage getStatusIcon(PresenceStatus status)
return ImageLoader
.getImage(ImageLoader.USER_OFFLINE_ICON);
}
else if(connectivity < PresenceStatus.AWAY_THRESHOLD)
{
return ImageLoader
.getImage(ImageLoader.USER_DND_ICON);
}
else if(connectivity == PresenceStatus.AWAY_THRESHOLD)
{
// the special status On The Phone is state
// between DND and AWAY states.
return ImageLoader
.getImage(ImageLoader.USER_USER_ON_THE_PHONE_ICON);
}
else if(connectivity < PresenceStatus.AVAILABLE_THRESHOLD)
{
return ImageLoader

@ -1148,6 +1148,12 @@ public class ImageLoader
public static final ImageID USER_OCCUPIED_ICON
= new ImageID("service.gui.statusicons.USER_OCCUPIED_ICON");
/**
* Contact "on the phone" icon.
*/
public static final ImageID USER_USER_ON_THE_PHONE_ICON
= new ImageID("service.gui.statusicons.USER_ON_THE_PHONE_ICON");
/**
* Owner chatroom member.
*/

@ -108,7 +108,7 @@ public SipStatusEnum(String iconPath)
loadIcon(iconPath + "/sip16x16-busy.png"));
this.onThePhoneStatus = new SipPresenceStatus(
37,
31,
ON_THE_PHONE,
loadIcon(iconPath + "/sip16x16-phone.png"));

@ -172,16 +172,30 @@ protected XCapHttpResponse get(URI uri)
new UsernamePasswordCredentials(getUserName(), password);
httpClient.getCredentialsProvider().
setCredentials(AuthScope.ANY, credentials);
HttpResponse response = httpClient.execute(getMethod);
XCapHttpResponse result = createResponse(response);
if (logger.isDebugEnabled())
{
byte[] contentBytes = result.getContent();
String contenString;
// for debug purposes print only xmls
// skip the icon queries
if(contentBytes != null && result.getContentType() != null
&& !result.getContentType().equalsIgnoreCase
(PresContentClient.CONTENT_TYPE))
contenString = new String(contentBytes);
else
contenString = "";
String logMessage = String.format(
"Getting resource %1s from the server",
uri.toString()
"Getting resource %1s from the server content:%2s",
uri.toString(),
contenString
);
logger.debug(logMessage);
}
HttpResponse response = httpClient.execute(getMethod);
return createResponse(response);
return result;
}
catch (IOException e)
{
@ -391,7 +405,7 @@ private DefaultHttpClient createHttpClient()
private XCapHttpResponse createResponse(HttpResponse response)
throws IOException
{
XCapHttpResponse XCapHttpResponse = new XCapHttpResponse();
XCapHttpResponse xcapHttpResponse = new XCapHttpResponse();
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == HttpStatus.SC_OK ||
statusCode == HttpStatus.SC_CREATED ||
@ -402,12 +416,12 @@ private XCapHttpResponse createResponse(HttpResponse response)
byte[] content = StreamUtils.read(
response.getEntity().getContent());
String eTag = getSingleHeaderValue(response, HEADER_ETAG);
XCapHttpResponse.setContentType(contentType);
XCapHttpResponse.setContent(content);
XCapHttpResponse.setETag(eTag);
xcapHttpResponse.setContentType(contentType);
xcapHttpResponse.setContent(content);
xcapHttpResponse.setETag(eTag);
}
XCapHttpResponse.setHttpCode(statusCode);
return XCapHttpResponse;
xcapHttpResponse.setHttpCode(statusCode);
return xcapHttpResponse;
}
/**

@ -35,6 +35,12 @@ public class PresenceStatus
*/
public static final int ONLINE_THRESHOLD = 20;
/**
* An integer above which all values of the status coefficient indicate both
* connectivity and availability but the person is away from the computer.
*/
public static final int AWAY_THRESHOLD = 31;
/**
* An integer above which all values of the status coefficient indicate both
* connectivity and availability.

@ -48,6 +48,14 @@ public class IcqStatusEnum
= new IcqStatusEnum(65, "Online",
loadIcon("resources/images/protocol/icq/icq16x16-online.png"));
/**
* The Away ICQ status. Indicates that the user has connectivity but might
* not be able to immediately act upon initiation of communication.
*/
public static final IcqStatusEnum AWAY
= new IcqStatusEnum(48, "Away",
loadIcon("resources/images/protocol/icq/icq16x16-away.png"));
/**
* The Invisible ICQ status. Indicates that the user has connectivity even
* though it may appear otherwise to others, to whom she would appear to be
@ -57,15 +65,6 @@ public class IcqStatusEnum
= new IcqStatusEnum(45, "Invisible",
loadIcon("resources/images/protocol/icq/icq16x16-invisible.png"));
/**
* The Away ICQ status. Indicates that the user has connectivity but might
* not be able to immediately act upon initiation of communication.
*/
public static final IcqStatusEnum AWAY
= new IcqStatusEnum(40, "Away",
loadIcon("resources/images/protocol/icq/icq16x16-away.png"));
/**
* The Not Available ICQ status. Indicates that the user has connectivity
* but might not be able to immediately act (i.e. even less immediately than

@ -40,11 +40,19 @@ public class MsnStatusEnum
= new MsnStatusEnum(65, "Online",
loadIcon("resources/images/protocol/msn/msn16x16-online.png"));
/**
* The Away status. Indicates that the user has connectivity but might
* not be able to immediately act upon initiation of communication.
*/
public static final MsnStatusEnum AWAY
= new MsnStatusEnum(48, "Away",
loadIcon("resources/images/protocol/msn/msn16x16-away.png"));
/**
* The Idle status. Indicates that the user is not using the messanger.
*/
public static final MsnStatusEnum IDLE
= new MsnStatusEnum(55, "Idle",
= new MsnStatusEnum(46, "Idle",
loadIcon("resources/images/protocol/msn/msn16x16-na.png"));
/**
@ -56,14 +64,6 @@ public class MsnStatusEnum
= new MsnStatusEnum(45, "Hide",
loadIcon("resources/images/protocol/msn/msn16x16-invisible.png"));
/**
* The Away status. Indicates that the user has connectivity but might
* not be able to immediately act upon initiation of communication.
*/
public static final MsnStatusEnum AWAY
= new MsnStatusEnum(40, "Away",
loadIcon("resources/images/protocol/msn/msn16x16-away.png"));
/**
* The Out to lunch status. Indicates that the user is eating.
*/
@ -71,13 +71,6 @@ public class MsnStatusEnum
= new MsnStatusEnum(39, "Out to lunch",
loadIcon("resources/images/protocol/msn/msn16x16-lunch.png"));
/**
* The On the phone status. Indicates that the user is talking to the phone.
*/
public static final MsnStatusEnum ON_THE_PHONE
= new MsnStatusEnum(37, "On the phone",
loadIcon("resources/images/protocol/msn/msn16x16-phone.png"));
/**
* The Not Available status. Indicates that the user has connectivity
* but might not be able to immediately act (i.e. even less immediately than
@ -88,6 +81,13 @@ public class MsnStatusEnum
= new MsnStatusEnum(35, "Be Right Back",
loadIcon("resources/images/protocol/msn/msn16x16-brb.png"));
/**
* The On the phone status. Indicates that the user is talking to the phone.
*/
public static final MsnStatusEnum ON_THE_PHONE
= new MsnStatusEnum(31, "On the phone",
loadIcon("resources/images/protocol/msn/msn16x16-phone.png"));
/**
* The DND status. Indicates that the user has connectivity but prefers
* not to be contacted.

@ -40,11 +40,20 @@ public class YahooStatusEnum
= new YahooStatusEnum(65, "Available",
loadIcon("resources/images/protocol/yahoo/yahoo16x16-online.png"));
/**
* The Not Available status. Indicates that the user has connectivity
* but might not be able to immediately act (i.e. even less immediately than
* when in an Away status ;-P ) upon initiation of communication.
*/
public static final YahooStatusEnum BE_RIGHT_BACK
= new YahooStatusEnum(48, "Be Right Back",
loadIcon("resources/images/protocol/yahoo/yahoo16x16-away.png"));
/**
* The Idle status. Indicates that the user is not using the messanger.
*/
public static final YahooStatusEnum IDLE
= new YahooStatusEnum(55, "Idle",
= new YahooStatusEnum(46, "Idle",
loadIcon("resources/images/protocol/yahoo/yahoo16x16-idle.png"));
/**
@ -78,13 +87,6 @@ public class YahooStatusEnum
= new YahooStatusEnum(38, "Not at home",
loadIcon("resources/images/protocol/yahoo/yahoo16x16-na.png"));
/**
* The On the phone status. Indicates that the user is talking to the phone.
*/
public static final YahooStatusEnum ON_THE_PHONE
= new YahooStatusEnum(37, "On the phone",
loadIcon("resources/images/protocol/yahoo/yahoo16x16-phone.png"));
/**
* The Not at desk status. Indicates that the user is not at his desk, but
* somewhere in the office.
@ -93,16 +95,6 @@ public class YahooStatusEnum
= new YahooStatusEnum(36, "Not at desk",
loadIcon("resources/images/protocol/yahoo/yahoo16x16-na.png"));
/**
* The Not Available status. Indicates that the user has connectivity
* but might not be able to immediately act (i.e. even less immediately than
* when in an Away status ;-P ) upon initiation of communication.
*
*/
public static final YahooStatusEnum BE_RIGHT_BACK
= new YahooStatusEnum(35, "Be Right Back",
loadIcon("resources/images/protocol/yahoo/yahoo16x16-away.png"));
/**
* The Not in office status. Indicates that the user is out of the office.
*/
@ -118,6 +110,13 @@ public class YahooStatusEnum
= new YahooStatusEnum(33, "On vacation",
loadIcon("resources/images/protocol/yahoo/yahoo16x16-vacation.png"));
/**
* The On the phone status. Indicates that the user is talking to the phone.
*/
public static final YahooStatusEnum ON_THE_PHONE
= new YahooStatusEnum(31, "On the phone",
loadIcon("resources/images/protocol/yahoo/yahoo16x16-phone.png"));
/**
* The DND status. Indicates that the user has connectivity but prefers
* not to be contacted.

Loading…
Cancel
Save