Added style tweaks and license header.

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

@ -1,3 +1,8 @@
/*
* 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.impl.protocol.irc; package net.java.sip.communicator.impl.protocol.irc;
import java.util.*; import java.util.*;

@ -1,3 +1,8 @@
/*
* 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.impl.protocol.irc; package net.java.sip.communicator.impl.protocol.irc;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;

@ -1,3 +1,8 @@
/*
* 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.impl.protocol.irc; package net.java.sip.communicator.impl.protocol.irc;
import java.util.*; import java.util.*;

@ -1,3 +1,8 @@
/*
* 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.impl.protocol.irc; package net.java.sip.communicator.impl.protocol.irc;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;

@ -14,15 +14,17 @@
/** /**
* Implementation of support for Persistent Presence for IRC. * Implementation of support for Persistent Presence for IRC.
* *
* @author Danny van Heumen * @author Danny van Heumen
*/ */
public class OperationSetPersistentPresenceIrcImpl extends AbstractOperationSetPersistentPresence<ProtocolProviderServiceIrcImpl> public class OperationSetPersistentPresenceIrcImpl
extends
AbstractOperationSetPersistentPresence<ProtocolProviderServiceIrcImpl>
{ {
/** /**
* Logger. * Logger.
*/ */
private final Logger LOGGER = Logger private static final Logger LOGGER = Logger
.getLogger(OperationSetPersistentPresenceIrcImpl.class); .getLogger(OperationSetPersistentPresenceIrcImpl.class);
/** /**
@ -33,16 +35,22 @@ public class OperationSetPersistentPresenceIrcImpl extends AbstractOperationSetP
/** /**
* IRC implementation for OperationSetPersistentPresence. * IRC implementation for OperationSetPersistentPresence.
* *
* @param parentProvider IRC instance of protocol provider service. * @param parentProvider IRC instance of protocol provider service.
*/ */
protected OperationSetPersistentPresenceIrcImpl( protected OperationSetPersistentPresenceIrcImpl(
ProtocolProviderServiceIrcImpl parentProvider) final ProtocolProviderServiceIrcImpl parentProvider)
{ {
super(parentProvider); super(parentProvider);
} }
private ContactIrcImpl createVolatileContact(String id) /**
* Create a volatile contact.
*
* @param id contact id
* @return returns instance of volatile contact
*/
private ContactIrcImpl createVolatileContact(final String id)
{ {
// Get non-persistent group for volatile contacts. // Get non-persistent group for volatile contacts.
ContactGroupIrcImpl volatileGroup = getNonPersistentGroup(); ContactGroupIrcImpl volatileGroup = getNonPersistentGroup();
@ -58,6 +66,11 @@ private ContactIrcImpl createVolatileContact(String id)
return newVolatileContact; return newVolatileContact;
} }
/**
* Get group for non-persistent contacts.
*
* @return returns group instance
*/
private ContactGroupIrcImpl getNonPersistentGroup() private ContactGroupIrcImpl getNonPersistentGroup()
{ {
String groupName String groupName
@ -67,10 +80,12 @@ private ContactGroupIrcImpl getNonPersistentGroup()
for (int i = 0; i < getRootGroup().countSubgroups(); i++) for (int i = 0; i < getRootGroup().countSubgroups(); i++)
{ {
ContactGroupIrcImpl gr = ContactGroupIrcImpl gr =
(ContactGroupIrcImpl)getRootGroup().getGroup(i); (ContactGroupIrcImpl) getRootGroup().getGroup(i);
if(!gr.isPersistent() && gr.getGroupName().equals(groupName)) if (!gr.isPersistent() && gr.getGroupName().equals(groupName))
{
return gr; return gr;
}
} }
ContactGroupIrcImpl volatileGroup = ContactGroupIrcImpl volatileGroup =
@ -85,13 +100,18 @@ private ContactGroupIrcImpl getNonPersistentGroup()
return volatileGroup; return volatileGroup;
} }
/**
* Get root contact group.
*
* @return returns root contact group
*/
public ContactGroup getRootGroup() public ContactGroup getRootGroup()
{ {
return rootGroup; return rootGroup;
} }
@Override @Override
public void subscribe(String contactIdentifier) public void subscribe(final String contactIdentifier)
throws IllegalArgumentException, throws IllegalArgumentException,
IllegalStateException, IllegalStateException,
OperationFailedException OperationFailedException
@ -259,14 +279,23 @@ public Contact createUnresolvedContact(String address, String persistentData)
return null; return null;
} }
Contact findOrCreateContactByID(String name) /**
* Find or create contact by ID.
*
* Try to find a contact by its ID. If a contact cannot be found, then
* create one.
*
* @param id id of the contact
* @return returns instance of contact
*/
Contact findOrCreateContactByID(final String id)
{ {
Contact contact = findContactByID(name); Contact contact = findContactByID(id);
if (contact == null) if (contact == null)
{ {
contact = createVolatileContact(name); contact = createVolatileContact(id);
LOGGER.debug("No existing contact found. Created volatile contact" LOGGER.debug("No existing contact found. Created volatile contact"
+ " for nick name '" + name + "'."); + " for nick name '" + id + "'.");
} }
return contact; return contact;
} }

Loading…
Cancel
Save