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

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

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

Loading…
Cancel
Save