Disable presence updates on UserQuit event.

fix-message-formatting
Danny van Heumen 11 years ago
parent c878830f7b
commit 4cd76ab90b

@ -37,8 +37,8 @@ public class ContactIrcImpl
* @param id Contact id.
* @param parentGroup The parent group of the contact.
*/
public ContactIrcImpl(ProtocolProviderServiceIrcImpl provider, String id,
ContactGroupIrcImpl parentGroup, PresenceStatus initialStatus)
public ContactIrcImpl(final ProtocolProviderServiceIrcImpl provider,
final String id, final ContactGroupIrcImpl parentGroup)
{
if (provider == null)
{
@ -55,8 +55,7 @@ public ContactIrcImpl(ProtocolProviderServiceIrcImpl provider, String id,
throw new IllegalArgumentException("parentGroup cannot be null");
}
this.parentGroup = parentGroup;
this.presence =
initialStatus == null ? IrcStatusEnum.ONLINE : initialStatus;
this.presence = IrcStatusEnum.ONLINE;
}
/**

@ -1269,41 +1269,45 @@ public void onUserAction(final UserActionMsg msg)
* @param msg Quit message
*/
@Override
public void onUserQuit(QuitMessage msg)
public void onUserQuit(final QuitMessage msg)
{
final String userNick = msg.getSource().getNick();
final Contact user =
IrcStack.this.provider.getPersistentPresence().findContactByID(
userNick);
if (user == null)
{
LOGGER
.trace("User not in contact list. Not updating user presence status.");
return;
}
final PresenceStatus previousStatus = user.getPresenceStatus();
if (previousStatus == IrcStatusEnum.OFFLINE)
{
LOGGER.trace("User already off-line, not updating user "
+ "presence status.");
return;
}
if (!(user instanceof ContactIrcImpl))
{
LOGGER.warn("Unexpected type of contact, expected "
+ "ContactIrcImpl but got " + user.getClass().getName()
+ ". Not updating presence.");
return;
}
final ContactGroup parentGroup = user.getParentContactGroup();
final ContactIrcImpl member = (ContactIrcImpl) user;
member.setPresenceStatus(IrcStatusEnum.OFFLINE);
IrcStack.this.provider.getPersistentPresence()
.fireContactPresenceStatusChangeEvent(user, parentGroup,
previousStatus, member.getPresenceStatus(), true);
// FIXME Disabled user presence status updates, probably not going
// to do user presence, since we cannot detect all changes and Jitsi
// does act upon different presence statuses.
// final String userNick = msg.getSource().getNick();
// final Contact user =
// IrcStack.this.provider.getPersistentPresence().findContactByID(
// userNick);
// if (user == null)
// {
// LOGGER
// .trace("User not in contact list. Not updating user presence status.");
// return;
// }
//
// final PresenceStatus previousStatus = user.getPresenceStatus();
// if (previousStatus == IrcStatusEnum.OFFLINE)
// {
// LOGGER.trace("User already off-line, not updating user "
// + "presence status.");
// return;
// }
//
// if (!(user instanceof ContactIrcImpl))
// {
// LOGGER.warn("Unexpected type of contact, expected "
// + "ContactIrcImpl but got " + user.getClass().getName()
// + ". Not updating presence.");
// return;
// }
//
// final ContactGroup parentGroup = user.getParentContactGroup();
// final ContactIrcImpl member = (ContactIrcImpl) user;
// member.setPresenceStatus(IrcStatusEnum.OFFLINE);
// IrcStack.this.provider.getPersistentPresence()
// .fireContactPresenceStatusChangeEvent(user, parentGroup,
// previousStatus, member.getPresenceStatus(), true);
// TODO Update status to online in case a message arrives from this
// particular user.

@ -49,8 +49,7 @@ private ContactIrcImpl createVolatileContact(String id)
// Create volatile contact
ContactIrcImpl newVolatileContact =
new ContactIrcImpl(this.parentProvider, id, volatileGroup,
IrcStatusEnum.ONLINE);
new ContactIrcImpl(this.parentProvider, id, volatileGroup);
volatileGroup.addContact(newVolatileContact);
this.fireSubscriptionEvent(newVolatileContact, volatileGroup,

Loading…
Cancel
Save