isVisible in the UIService interface. Checks if
* the main application window is visible.
@@ -1559,7 +1559,7 @@ public boolean isVisible()
else
return false;
}
-
+
/**
* Implements setVisible in the UIService interface. Shows or
* hides the main application window depending on the parameter
@@ -1576,15 +1576,15 @@ public void setVisible(final boolean isVisible)
public void run()
{
if(isVisible)
- {
- MainFrame.this.addNativePlugins();
- MainFrame.super.setVisible(isVisible);
- MainFrame.super.toFront();
- }
- else
- {
- MainFrame.super.setVisible(isVisible);
- }
+ {
+ MainFrame.this.addNativePlugins();
+ MainFrame.super.setVisible(isVisible);
+ MainFrame.super.toFront();
+ }
+ else
+ {
+ MainFrame.super.setVisible(isVisible);
+ }
}
});
}
@@ -1592,7 +1592,7 @@ public void run()
/**
* Adds the given component with to the container corresponding to the
* given constraints.
- *
+ *
* @param c the component to add
* @param constraints the constraints determining the container
*/
@@ -1632,7 +1632,7 @@ else if (constraints.equals(BorderLayout.EAST))
/**
* Removes the given component from the container corresponding to the given
* constraints.
- *
+ *
* @param c the component to remove
* @param constraints the constraints determining the container
*/
diff --git a/src/net/java/sip/communicator/impl/gui/main/login/DefaultSecurityAuthority.java b/src/net/java/sip/communicator/impl/gui/main/login/DefaultSecurityAuthority.java
new file mode 100644
index 000000000..03fe01e0b
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/gui/main/login/DefaultSecurityAuthority.java
@@ -0,0 +1,106 @@
+/*
+ * SIP Communicator, 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.gui.main.login;
+
+import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;
+
+/**
+ * Utility class that can be used in cases where components other than the main
+ * user interface may need to launch provider registration. At the time I am
+ * writing this, the DefaultSecurityAuthority is being used by the
+ * systray and
+ *
+ * @author Emil Ivov
+ */
+public class DefaultSecurityAuthority
+ implements SecurityAuthority
+{
+ private boolean isUserNameEditable = false;
+
+ /**
+ * The provider that this authority would be responsible for.
+ */
+ private ProtocolProviderService provider = null;
+
+ /**
+ * Creates this authority for a particular provider.
+ */
+ public DefaultSecurityAuthority(ProtocolProviderService provider)
+ {
+ this.provider = provider;
+ }
+
+ /**
+ * Used to login to the protocol providers
+ *
+ * @param realm the realm that the credentials are needed for
+ * @param userCredentials the values to propose the user by default
+ * @return The Credentials associated with the speciefied realm
+ */
+ public UserCredentials obtainCredentials(
+ String realm,
+ UserCredentials userCredentials)
+ {
+ return obtainCredentials( realm,
+ userCredentials,
+ SecurityAuthority.AUTHENTICATION_REQUIRED);
+ }
+
+
+ /**
+ * Used to login to the protocol providers
+ *
+ * @param realm the realm that the credentials are needed for
+ * @param userCredentials the values to propose the user by default
+ * @param reasonCode the reason for which we're asking for credentials
+ * @return The Credentials associated with the speciefied realm
+ */
+ public UserCredentials obtainCredentials(
+ String realm,
+ UserCredentials userCredentials,
+ int reasonCode)
+ {
+ ExportedWindow loginWindow
+ = GuiActivator.getUIService()
+ .getAuthenticationWindow(provider,
+ realm,
+ userCredentials,
+ isUserNameEditable);
+
+ loginWindow.setVisible(true);
+
+ return userCredentials;
+ }
+
+
+ /**
+ * Sets the userNameEditable property, which should indicate to the
+ * implementations of this interface if the user name could be changed
+ * by user or not.
+ *
+ * @param isUserNameEditable indicates if the user name could be changed
+ * by user in the implementation of this interface.
+ */
+ public void setUserNameEditable(boolean isUserNameEditable)
+ {
+ this.isUserNameEditable = isUserNameEditable;
+ }
+
+ /**
+ * Indicates if the user name is currently editable, i.e. could be
+ * changed by user or not.
+ *
+ * @return true if the user name could be changed and
+ * false otherwise.
+ */
+ public boolean isUserNameEditable()
+ {
+ return isUserNameEditable;
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java
index 9eafcd459..c67c0c622 100644
--- a/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java
@@ -71,7 +71,7 @@ public class MessageHistoryServiceImpl
private ConfigurationService configService;
private MessageHistoryPropertyChangeListener msgHistoryPropListener;
-
+
private static ResourceManagementService resourcesService;
public HistoryService getHistoryService()
@@ -96,7 +96,7 @@ public Collection findByStartDate(MetaContact contact, Date startDate)
Hashtable readers = getHistoryReaders(contact);
int recordsCount = countRecords(readers);
-
+
Iterator iter = readers.keySet().iterator();
while (iter.hasNext())
{
@@ -141,7 +141,7 @@ public Collection findByEndDate(MetaContact contact, Date endDate)
Hashtable readers = getHistoryReaders(contact);
int recordsCount = countRecords(readers);
-
+
Iterator iter = readers.keySet().iterator();
while (iter.hasNext())
{
@@ -186,7 +186,7 @@ public Collection findByPeriod(MetaContact contact, Date startDate, Date endDate
Hashtable readers = getHistoryReaders(contact);
int recordsCount = countRecords(readers);
-
+
Iterator iter = readers.keySet().iterator();
while (iter.hasNext())
{
@@ -353,11 +353,11 @@ public Collection findFirstMessagesAfter(MetaContact contact, Date date,
}
LinkedList resultAsList = new LinkedList(result);
-
+
int toIndex = count;
if(toIndex > resultAsList.size())
toIndex = resultAsList.size();
-
+
return resultAsList.subList(0, toIndex);
}
@@ -443,10 +443,10 @@ private History getHistory(Contact localContact, Contact remoteContact)
return retVal;
}
-
+
/**
* Returns the history by specified local contact
- * (if is null the default is used)
+ * (if is null the default is used)
* and by the chat room
*
* @param room The chat room
@@ -456,20 +456,20 @@ private History getHistory(Contact localContact, Contact remoteContact)
private History getHistoryForMultiChat(
Contact localContact,
ChatRoom room)
- throws IOException
+ throws IOException
{
AccountID account = room.getParentProvider().getAccountID();
return this.getHistoryForMultiChat(
- null,
+ null,
account.getAccountUniqueID(),
account.getService(),
room.getName());
}
-
+
/**
* Returns the history by specified local contact
- * (if is null the default is used)
+ * (if is null the default is used)
* and by accountUniqueID, channel and server
* used by the multichat account.
*
@@ -485,7 +485,7 @@ private History getHistoryForMultiChat(
String account,
String server,
String channel)
- throws IOException
+ throws IOException
{
History retVal = null;
@@ -494,8 +494,8 @@ private History getHistoryForMultiChat(
HistoryID historyId = HistoryID.createFromRawID(
new String[] { "messages",
- localId,
- account,
+ localId,
+ account,
channel + "@" + server });
if (this.historyService.isHistoryExisting(historyId))
@@ -550,9 +550,9 @@ private Object convertHistoryRecordToMessageEvent(HistoryRecord hr, Contact cont
contact,
timestamp);
}
-
+
/**
- * Used to convert HistoryRecord in ChatRoomMessageDeliveredEvent or
+ * Used to convert HistoryRecord in ChatRoomMessageDeliveredEvent or
* ChatRoomMessageReceivedEvent
* which are returned by the finder methods
*
@@ -580,10 +580,10 @@ private Object convertHistoryRecordToMessageEvent(
}
else
timestamp = hr.getTimestamp();
-
+
// 5 is the index of the subject in the structure
String fromStr = hr.getPropertyValues()[5];
-
+
ChatRoomMember from = new ChatRoomMemberImpl(fromStr, room, null);
if(msg.isOutgoing)
@@ -669,15 +669,15 @@ public void start(BundleContext bc)
configService = (ConfigurationService)
bundleContext.getService(refConfig);
- // Check if the message history is enabled in the configuration
+ // Check if the message history is enabled in the configuration
// service, and if not do not register the service.
String isMessageHistoryEnabledPropertyString =
"net.java.sip.communicator.impl.msghistory.isMessageHistoryEnabled";
String isMessageHistoryEnabledString = configService.getString(
isMessageHistoryEnabledPropertyString);
-
+
if(isMessageHistoryEnabledString == null)
- isMessageHistoryEnabledString =
+ isMessageHistoryEnabledString =
getResources().
getSettingsString(isMessageHistoryEnabledPropertyString);
@@ -737,19 +737,19 @@ public void messageDelivered(MessageDeliveredEvent evt)
public void messageDeliveryFailed(MessageDeliveryFailedEvent evt)
{
}
-
+
// //////////////////////////////////////////////////////////////////////////
// ChatRoomMessageListener implementation methods
-
+
public void messageReceived(ChatRoomMessageReceivedEvent evt)
{
- try
+ try
{
History history = this.getHistoryForMultiChat(
- null,
+ null,
evt.getSourceChatRoom());
-
- writeMessage(history, "in", evt.getSourceChatRoomMember(),
+
+ writeMessage(history, "in", evt.getSourceChatRoomMember(),
evt.getMessage(), evt.getTimestamp());
} catch (IOException e)
{
@@ -759,13 +759,13 @@ public void messageReceived(ChatRoomMessageReceivedEvent evt)
public void messageDelivered(ChatRoomMessageDeliveredEvent evt)
{
- try
+ try
{
History history = this.
getHistoryForMultiChat(
- null,
+ null,
evt.getSourceChatRoom());
-
+
writeMessage(history, "out", evt.getMessage(), evt.getTimestamp());
} catch (IOException e)
{
@@ -776,11 +776,11 @@ public void messageDelivered(ChatRoomMessageDeliveredEvent evt)
public void messageDeliveryFailed(ChatRoomMessageDeliveryFailedEvent evt)
{
}
-
+
/**
* Writes message to the history
* @param direction String direction of the message
- * @param source The source Contact
+ * @param source The source Contact
* @param destination The destiantion Contact
* @param message Message message to be written
* @param messageTimestamp Date this is the timestamp when was message received
@@ -791,14 +791,14 @@ private void writeMessage(String direction, Contact source,
{
try {
History history = this.getHistory(source, destination);
-
+
writeMessage(history, direction, message, messageTimestamp);
} catch (IOException e)
{
logger.error("Could not add message to history", e);
}
}
-
+
/**
* Writes message to the history
* @param history The history to which will write the message
@@ -821,7 +821,7 @@ private void writeMessage(History history, String direction,
logger.error("Could not add message to history", e);
}
}
-
+
/**
* Writes message to the history
* @param history The history to which will write the message
@@ -838,7 +838,7 @@ private void writeMessage(History history, String direction,
historyWriter.addRecord(new String[] { direction,
message.getContent(), message.getContentType(),
message.getEncoding(), message.getMessageUID(),
- from.getContactAddress(),
+ from.getContactAddress(),
String.valueOf(messageTimestamp.getTime()) },
new Date()); // this date is when the history record is written
} catch (IOException e)
@@ -846,7 +846,7 @@ private void writeMessage(History history, String direction,
logger.error("Could not add message to history", e);
}
}
-
+
// //////////////////////////////////////////////////////////////////////////
/**
@@ -942,7 +942,7 @@ private void handleProviderAdded(ProtocolProviderService provider)
{
logger.trace("Service did not have a im op. set.");
}
-
+
OperationSetMultiUserChat opSetMultiUChat
= (OperationSetMultiUserChat) provider
.getSupportedOperationSets().get(
@@ -950,7 +950,7 @@ private void handleProviderAdded(ProtocolProviderService provider)
if (opSetMultiUChat != null)
{
- Iterator iter =
+ Iterator iter =
opSetMultiUChat.getCurrentlyJoinedChatRooms().iterator();
while(iter.hasNext())
@@ -958,7 +958,7 @@ private void handleProviderAdded(ProtocolProviderService provider)
ChatRoom room = (ChatRoom)iter.next();
room.addMessageListener(this);
}
-
+
opSetMultiUChat.addPresenceListener(this);
}
else
@@ -984,7 +984,7 @@ private void handleProviderRemoved(ProtocolProviderService provider)
{
opSetIm.removeMessageListener(this);
}
-
+
OperationSetMultiUserChat opSetMultiUChat
= (OperationSetMultiUserChat) provider
.getSupportedOperationSets().get(
@@ -992,9 +992,9 @@ private void handleProviderRemoved(ProtocolProviderService provider)
if (opSetMultiUChat != null)
{
- Iterator iter =
+ Iterator iter =
opSetMultiUChat.getCurrentlyJoinedChatRooms().iterator();
-
+
while(iter.hasNext())
{
ChatRoom room = (ChatRoom)iter.next();
@@ -1002,7 +1002,7 @@ private void handleProviderRemoved(ProtocolProviderService provider)
}
}
}
-
+
/**
* Called to notify interested parties that a change in our presence in
* a chat room has occured. Changes may include us being kicked, join,
@@ -1012,7 +1012,7 @@ private void handleProviderRemoved(ProtocolProviderService provider)
*/
public void localUserPresenceChanged(LocalUserChatRoomPresenceChangeEvent evt)
{
- if(evt.getEventType() ==
+ if(evt.getEventType() ==
LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_JOINED)
{
if (!evt.getChatRoom().isSystem())
@@ -1119,7 +1119,7 @@ public Collection findByPeriod(MetaContact contact, Date startDate,
Hashtable readers = getHistoryReaders(contact);
int recordsCount = countRecords(readers);
-
+
Iterator iter = readers.keySet().iterator();
while (iter.hasNext())
{
@@ -1167,7 +1167,7 @@ public Collection findByKeyword(MetaContact contact, String keyword,
Hashtable readers = getHistoryReaders(contact);
int recordsCount = countRecords(readers);
-
+
Iterator iter = readers.keySet().iterator();
while (iter.hasNext())
{
@@ -1215,7 +1215,7 @@ public Collection findByKeywords(MetaContact contact, String[] keywords,
Hashtable readers = getHistoryReaders(contact);
int recordsCount = countRecords(readers);
-
+
Iterator iter = readers.keySet().iterator();
while (iter.hasNext())
{
@@ -1269,22 +1269,22 @@ private Hashtable getHistoryReaders(MetaContact contact)
}
return readers;
}
-
+
/**
* Total count of records for supplied history readers will read through
- *
+ *
* @param readers hashtable with pairs contact <-> history reader
* @return the number of searched messages
- * @throws UnsupportedOperationException
+ * @throws UnsupportedOperationException
* Thrown if an exception occurs during the execution of the
* query, such as internal IO error.
*/
public int countRecords(Hashtable readers)
{
int result = 0;
-
+
Enumeration readersEnum = readers.elements();
-
+
while (readersEnum.hasMoreElements())
{
HistoryReader r = (HistoryReader)readersEnum.nextElement();
@@ -1293,9 +1293,9 @@ public int countRecords(Hashtable readers)
return result;
}
-
+
/**
- * Returns all the messages exchanged in the supplied
+ * Returns all the messages exchanged in the supplied
* chat room after the given date
*
* @param room The chat room
@@ -1310,7 +1310,7 @@ public Collection findByStartDate(ChatRoom room, Date startDate)
try
{
// get the readers for this room
- HistoryReader reader =
+ HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
@@ -1328,12 +1328,12 @@ public Collection findByStartDate(ChatRoom room, Date startDate)
{
logger.error("Could not read history", e);
}
-
+
return result;
}
/**
- * Returns all the messages exchanged
+ * Returns all the messages exchanged
* in the supplied chat room before the given date
*
* @param room The chat room
@@ -1348,7 +1348,7 @@ public Collection findByEndDate(ChatRoom room, Date endDate)
try
{
// get the readers for this room
- HistoryReader reader =
+ HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
@@ -1371,7 +1371,7 @@ public Collection findByEndDate(ChatRoom room, Date endDate)
}
/**
- * Returns all the messages exchanged
+ * Returns all the messages exchanged
* in the supplied chat room between the given dates
*
* @param room The chat room
@@ -1387,7 +1387,7 @@ public Collection findByPeriod(ChatRoom room, Date startDate, Date endDate)
try
{
// get the readers for this room
- HistoryReader reader =
+ HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
@@ -1405,12 +1405,12 @@ public Collection findByPeriod(ChatRoom room, Date startDate, Date endDate)
{
logger.error("Could not read history", e);
}
-
+
return result;
}
/**
- * Returns all the messages exchanged
+ * Returns all the messages exchanged
* in the supplied chat room between the given dates and having the given
* keywords
*
@@ -1421,7 +1421,7 @@ public Collection findByPeriod(ChatRoom room, Date startDate, Date endDate)
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
- public Collection findByPeriod(ChatRoom room,
+ public Collection findByPeriod(ChatRoom room,
Date startDate, Date endDate, String[] keywords)
throws RuntimeException
{
@@ -1429,7 +1429,7 @@ public Collection findByPeriod(ChatRoom room,
}
/**
- * Returns all the messages exchanged
+ * Returns all the messages exchanged
* in the supplied chat room between the given dates and having the given
* keywords
*
@@ -1449,7 +1449,7 @@ public Collection findByPeriod(ChatRoom room, Date startDate, Date endDate,
try
{
// get the readers for this room
- HistoryReader reader =
+ HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
@@ -1468,12 +1468,12 @@ public Collection findByPeriod(ChatRoom room, Date startDate, Date endDate,
{
logger.error("Could not read history", e);
}
-
+
return result;
}
/**
- * Returns all the messages exchanged
+ * Returns all the messages exchanged
* in the supplied room having the given keyword
*
* @param room The Chat room
@@ -1488,7 +1488,7 @@ public Collection findByKeyword(ChatRoom room, String keyword)
}
/**
- * Returns all the messages exchanged
+ * Returns all the messages exchanged
* in the supplied chat room having the given keyword
*
* @param room The chat room
@@ -1497,7 +1497,7 @@ public Collection findByKeyword(ChatRoom room, String keyword)
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
- public Collection findByKeyword(ChatRoom room, String keyword,
+ public Collection findByKeyword(ChatRoom room, String keyword,
boolean caseSensitive)
throws RuntimeException
{
@@ -1505,7 +1505,7 @@ public Collection findByKeyword(ChatRoom room, String keyword,
try
{
// get the readers for this room
- HistoryReader reader =
+ HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
@@ -1529,7 +1529,7 @@ public Collection findByKeyword(ChatRoom room, String keyword,
}
/**
- * Returns all the messages exchanged
+ * Returns all the messages exchanged
* in the supplied chat room having the given keywords
*
* @param room The chat room
@@ -1544,7 +1544,7 @@ public Collection findByKeywords(ChatRoom room, String[] keywords)
}
/**
- * Returns all the messages exchanged
+ * Returns all the messages exchanged
* in the supplied chat room having the given keywords
*
* @param room The chat room
@@ -1553,7 +1553,7 @@ public Collection findByKeywords(ChatRoom room, String[] keywords)
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
- public Collection findByKeywords(ChatRoom room, String[] keywords,
+ public Collection findByKeywords(ChatRoom room, String[] keywords,
boolean caseSensitive)
throws RuntimeException
{
@@ -1561,7 +1561,7 @@ public Collection findByKeywords(ChatRoom room, String[] keywords,
try
{
// get the readers for this room
- HistoryReader reader =
+ HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
@@ -1580,12 +1580,12 @@ public Collection findByKeywords(ChatRoom room, String[] keywords,
{
logger.error("Could not read history", e);
}
-
+
return result;
}
/**
- * Returns the supplied number of recent messages exchanged
+ * Returns the supplied number of recent messages exchanged
* in the supplied chat room
*
* @param room The chat room
@@ -1597,12 +1597,12 @@ public Collection findLast(ChatRoom room, int count)
throws RuntimeException
{
TreeSet result = new TreeSet(new ChatRoomMessageEventComparator());
-
+
try
{
// get the readers for this room
- HistoryReader reader =
- this.getHistoryForMultiChat(null, room).getReader();
+ HistoryReader reader =
+ this.getHistoryForMultiChat(null, room).getReader();
Iterator recs = reader.findLast(count);
while (recs.hasNext())
{
@@ -1616,7 +1616,7 @@ public Collection findLast(ChatRoom room, int count)
{
logger.error("Could not read history", e);
}
-
+
LinkedList resultAsList = new LinkedList(result);
int startIndex = resultAsList.size() - count;
@@ -1643,7 +1643,7 @@ public Collection findFirstMessagesAfter(ChatRoom room, Date date, int count)
try
{
- HistoryReader reader =
+ HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
Iterator recs = reader.findFirstRecordsAfter(date, count);
while (recs.hasNext())
@@ -1660,11 +1660,11 @@ public Collection findFirstMessagesAfter(ChatRoom room, Date date, int count)
}
LinkedList resultAsList = new LinkedList(result);
-
+
int toIndex = count;
if(toIndex > resultAsList.size())
toIndex = resultAsList.size();
-
+
return resultAsList.subList(0, toIndex);
}
@@ -1685,7 +1685,7 @@ public Collection findLastMessagesBefore(ChatRoom room, Date date, int count)
try
{
- HistoryReader reader =
+ HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
Iterator recs = reader.findLastRecordsBefore(date, count);
while (recs.hasNext())
@@ -1709,7 +1709,7 @@ public Collection findLastMessagesBefore(ChatRoom room, Date date, int count)
return resultAsList.subList(startIndex, resultAsList.size());
}
-
+
public static ResourceManagementService getResources()
{
if (resourcesService == null)
@@ -1719,8 +1719,8 @@ public static ResourceManagementService getResources()
if(serviceReference == null)
return null;
-
- resourcesService = (ResourceManagementService)
+
+ resourcesService = (ResourceManagementService)
MessageHistoryActivator.bundleContext
.getService(serviceReference);
}
@@ -1742,7 +1742,7 @@ private class SearchProgressWrapper
double accumulatedRatio = 0;
double currentProgress = 0;
double lastHistoryProgress = 0;
-
+
// used for more precise calculations with double values
int raiser = 1000;
@@ -1750,12 +1750,12 @@ private class SearchProgressWrapper
{
this.listener = listener;
}
-
+
private void setCurrentValues(HistoryReader currentReader, int allRecords)
{
this.allRecords = allRecords;
this.reader = currentReader;
- currentReaderProgressRatio =
+ currentReaderProgressRatio =
(double)currentReader.countRecords()/allRecords * raiser;
accumulatedRatio += currentReaderProgressRatio;
}
@@ -1779,15 +1779,15 @@ public void progressChanged(ProgressEvent evt)
*/
private int getProgressMapping(ProgressEvent evt)
{
- double tmpHistoryProgress =
+ double tmpHistoryProgress =
currentReaderProgressRatio * evt.getProgress();
-
+
currentProgress += tmpHistoryProgress - lastHistoryProgress;
-
+
if(evt.getProgress() == HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE)
{
lastHistoryProgress = 0;
-
+
// this is the last one and the last event fire the max
// there will be looses in currentProgress due to the devision
if((int)accumulatedRatio == raiser)
@@ -1796,7 +1796,7 @@ private int getProgressMapping(ProgressEvent evt)
}
else
lastHistoryProgress = tmpHistoryProgress;
-
+
return (int)currentProgress;
}
@@ -1804,7 +1804,7 @@ private int getProgressMapping(ProgressEvent evt)
* clear the values
*/
void clear()
- {
+ {
allRecords = 0;
currentProgress = 0;
lastHistoryProgress = 0;
@@ -1866,9 +1866,9 @@ else if(o2 instanceof MessageReceivedEvent)
return date1.compareTo(date2);
}
}
-
+
/**
- * Used to compare ChatRoomMessageDeliveredEvent
+ * Used to compare ChatRoomMessageDeliveredEvent
* or ChatRoomMessageReceivedEvent
* and to be ordered in TreeSet according their timestamp
*/
@@ -1879,7 +1879,7 @@ public int compare(Object o1, Object o2)
{
Date date1 = null;
Date date2 = null;
-
+
if(o1 instanceof ChatRoomMessageDeliveredEvent)
date1 = ((ChatRoomMessageDeliveredEvent)o1).getTimestamp();
else if(o1 instanceof ChatRoomMessageReceivedEvent)
@@ -1897,7 +1897,7 @@ else if(o2 instanceof ChatRoomMessageReceivedEvent)
return date1.compareTo(date2);
}
}
-
+
/**
* Simple ChatRoomMember implementation.
*/
@@ -1908,7 +1908,7 @@ class ChatRoomMemberImpl
private String name;
private ChatRoomMemberRole role;
- public ChatRoomMemberImpl(String name, ChatRoom chatRoom,
+ public ChatRoomMemberImpl(String name, ChatRoom chatRoom,
ChatRoomMemberRole role)
{
this.chatRoom = chatRoom;
@@ -1941,7 +1941,7 @@ public ChatRoomMemberRole getRole()
return role;
}
}
-
+
/**
* Handles PropertyChangeEvent triggered from the modification of
* the isMessageHistoryEnabled property.
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
index a04f23b51..ec23e105a 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
@@ -155,6 +155,14 @@ public Call createCall(Contact callee) throws OperationFailedException
private synchronized CallSipImpl createOutgoingCall(Address calleeAddress)
throws OperationFailedException
{
+ if(!protocolProvider.isRegistered())
+ {
+ throw new OperationFailedException(
+ "The protocol provider should be registered "
+ +"before placing an outgoing call.",
+ OperationFailedException.PROVIDER_NOT_REGISTERED);
+ }
+
// create the invite request
Request invite = createInviteRequest(calleeAddress);
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
index 586eb3466..8764a6e98 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
@@ -27,7 +27,8 @@ public class ProtocolProviderFactorySipImpl
/**
* The table that we store our accounts in.
*/
- private Hashtable registeredAccounts = new Hashtable();
+ private Hashtable+ * @param newState a reference to the RegistrationState that we're currently + * detaining. + * @param reasonCode one of the REASON_XXX error codes specified in + * {@link RegistrationStateChangeEvent}. + * @param reason a reason String further explaining the reasonCode. + */ + @Override + public void setRegistrationState(RegistrationState newState, + int reasonCode, + String reason) + { + if( currentRegistrationState.equals(newState) ) + { + return; + } + + RegistrationState oldState = currentRegistrationState; + this.currentRegistrationState = newState; + + sipProvider.fireRegistrationStateChanged( + oldState, newState, reasonCode, reason); + } + + /** + * Returns the address of this connection's registrar. + * + * @return the InetAddress of our registrar server. + */ + @Override + public InetAddress getRegistrarAddress() + { + try + { + return InetAddress.getByAddress("2001:1890:1112:1::20", + new byte[]{(byte) 20, (byte) 01, (byte) 18, (byte) 90, + (byte) 11, (byte) 11, (byte) 12, (byte) 00, + (byte) 01, (byte) 00, (byte) 00, (byte) 00, + (byte) 00, (byte) 00, (byte) 00, (byte) 20}); + } catch (UnknownHostException ex) + { + logger.error("Failed to generate a dummy registrar addr", ex); + return null; + } + } + + /** + * Returns the listening point that should be used for communication with our + * current registrar. + * + * @return the listening point that should be used for communication with our + * current registrar. + */ + @Override + public ListeningPoint getRegistrarListeningPoint() + { + return sipProvider.getDefaultListeningPoint(); + } + + /** + * Returns a string representation of this connection instance + * instance including information that would permit to distinguish it among + * other sip listeners when reading a log file. + *
+ * @return a string representation of this operation set.
+ */
+ @Override
+ public String toString()
+ {
+ String className = getClass().getName();
+ try
+ {
+ className = className.substring(className.lastIndexOf('.') + 1);
+ }
+ catch (Exception ex)
+ {
+ // we don't want to fail in this method because we've messed up
+ //something with indexes, so just ignore.
+ }
+ return className + "-[dn=" + sipProvider.getOurDisplayName()
+ +" addr="+sipProvider.getOurSipAddress() + "]";
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/UriHandlerSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/UriHandlerSipImpl.java
new file mode 100644
index 000000000..695784281
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/protocol/sip/UriHandlerSipImpl.java
@@ -0,0 +1,524 @@
+/*
+ * SIP Communicator, 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.sip;
+
+import java.text.*;
+import java.util.*;
+
+import org.osgi.framework.*;
+
+import net.java.sip.communicator.impl.systray.*;
+import net.java.sip.communicator.service.argdelegation.*;
+import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.event.*;
+import net.java.sip.communicator.util.*;
+
+/**
+ * The sip implementation of the URI handler. This class handles sip URIs by
+ * trying to establish a call to them.
+ *
+ * @author Emil Ivov
+ */
+public class UriHandlerSipImpl
+ implements UriHandler,
+ ServiceListener
+
+{
+ private static final Logger logger =
+ Logger.getLogger(UriHandlerSipImpl.class);
+
+ /**
+ * The protocol provider factory that created us.
+ */
+ private ProtocolProviderFactory protoFactory = null;
+
+ /**
+ * A reference to the OSGi registration we create with this handler.
+ */
+ private ServiceRegistration ourServiceRegistration = null;
+
+ /**
+ * The object that we are using to synchronize our service registration.
+ */
+ private Object registrationLock = new Object();
+
+ /**
+ * Creates an instance of this uri handler, so that it would start handling
+ * URIs by passing them to the providers registered by protoFactory.
+ *
+ * @param parentProvider the provider that created us.
+ *
+ * @throws NullPointerException if protoFactory is null.
+ */
+ protected UriHandlerSipImpl(ProtocolProviderFactory protoFactory)
+ throws NullPointerException
+ {
+ if(protoFactory == null)
+ {
+ throw new NullPointerException(
+ "The ProtocolProviderFactory that a UriHandler is created with "
+ + " cannot be null.");
+ }
+
+ this.protoFactory = protoFactory;
+
+ //we listen for service events so that we can disable ourselves in
+ //case our protocol factory decides to leave.
+ SipActivator.bundleContext.addServiceListener(this);
+
+ registerHandlerService();
+ }
+
+ /**
+ * Registers this UriHandler with the bundle context so that it could
+ * start handling URIs
+ */
+ private void registerHandlerService()
+ {
+ synchronized(registrationLock)
+ {
+ if (ourServiceRegistration != null)
+ {
+ // ... we are already registered (this is probably
+ // happening during startup)
+ return;
+ }
+
+ Hashtable
* A way to show different types of simple windows is provided to allow other
* modules to show different simple messages, like warning or error messages.
- * In order to show a simple warning message, a module should invoke the
+ * In order to show a simple warning message, a module should invoke the
* getPopupDialog method and then one of the showXXX methods, which corresponds
- * best to the required dialog.
+ * best to the required dialog.
*
* Certain components within the GUI, like "AddContact" window for example,
* could be also shown from outside the ui. To make one of
* these component exportable, the UIService implementation should attach
* to it an WindowID. A window then could be shown, by invoking
- *
+ * There are three possible outcomes of this method. 1. We lock
+ * successfully; 2. We fail to lock because another instance of SIP
+ * Communicator is already running; 3. We fail to lock for some unknown
+ * error. Each of these cases is represented by an error code returned as a
+ * result.
+ *
+ * @param args
+ * the array of arguments that we are to submit in case an
+ * instance of SIP Communicator has already been started.
+ *
+ * @return an error or success code indicating the outcome of the lock
+ * operation.
+ */
+ public int tryLock(String[] args)
+ {
+ // first check whether we have a file.
+ File lockFile = getLockFile();
+
+ if (lockFile.exists())
+ {
+ InetSocketAddress lockAddress = readLockFile(lockFile);
+
+ if (lockAddress != null)
+ {
+ // we have a valid lockAddress and hence possibly an already
+ // running instance of SC. Try to communicate with it.
+ if (interInstanceConnect(lockAddress, args) == SUCCESS)
+ {
+ return ALREADY_STARTED;
+ }
+ }
+
+ // our lockFile is probably stale and left from a previous instance.
+ // or an instance that is still running but is not responding.
+ lockFile.delete();
+ }
+
+ // if we get here then this means that we should go for a real lock
+ // initialization
+ // create a new socket,
+ // right the bind address in the file
+ try
+ {
+ lockFile.createNewFile();
+ }
+ catch (IOException e)
+ {
+ logger.error("Failed to create lock file", e);
+ }
+
+ lockFile.deleteOnExit();
+
+ return lock(lockFile);
+ }
+
+ /**
+ * Locks the configuration directory by binding our lock socket and
+ * recording the lock file into the configuration directory. Returns SUCCESS
+ * if everything goes well and ERROR if something fails. This method does
+ * not return the ALREADY_RUNNING code as it is assumed that this has
+ * already been checked before calling this method.
+ *
+ * @param lockFile
+ * the file that we should use to lock the configuration
+ * directory.
+ *
+ * @return the SUCCESS or ERROR codes defined by this class.
+ */
+ private int lock(File lockFile)
+ {
+ InetAddress lockAddress = getRandomBindAddress();
+
+ if (lockAddress == null)
+ {
+ return LOCK_ERROR;
+ }
+
+ int port = getRandomPortNumber();
+
+ InetSocketAddress serverSocketAddress = new InetSocketAddress(
+ lockAddress, port);
+
+ writeLockFile(lockFile, serverSocketAddress);
+
+ startLockServer(serverSocketAddress);
+
+ return SUCCESS;
+ }
+
+ /**
+ * Creates and binds a socket on lockAddress and then starts a
+ * LockServer instance so that we would start interacting with
+ * other instances of SIP Communicator that are trying to start.
+ *
+ * @return the ERROR code if something goes wrong and
+ * SUCCESS otherwise.
+ */
+ private int startLockServer(InetSocketAddress localAddress)
+ {
+ try
+ {
+ // check config directory
+ instanceServerSocket = new ServerSocket();
+ }
+ catch (IOException exc)
+ {
+ // Just checked the impl and this doesn't seem to ever be thrown
+ // .... ignore ...
+ logger.error("Couldn't create server socket", exc);
+ return LOCK_ERROR;
+ }
+
+ try
+ {
+ instanceServerSocket.bind(localAddress, 16);// Why 16? 'cos I say
+ // so.
+ }
+ catch (IOException exc)
+ {
+ logger.error("Couldn't create server socket", exc);
+ return LOCK_ERROR;
+ }
+
+ LockServer lockServ = new LockServer(instanceServerSocket);
+
+ lockServ.start();
+
+ return SUCCESS;
+ }
+
+ /**
+ * Returns a randomly chosen socket address using a loopback interface (or
+ * another one in case the loopback is not available) that we should bind
+ * on.
+ *
+ * @return an InetAddress (most probably a loopback) that we can use to bind
+ * our semaphore socket on.
+ */
+ private InetAddress getRandomBindAddress()
+ {
+ NetworkInterface loopback;
+ try
+ {
+ // find a loopback interface
+ Enumerationtrue if the user name could be changed,
- * false - otherwise.
- */
- public boolean isUserNameEditable()
- {
- return isUserNameEditable;
- }
}
diff --git a/src/net/java/sip/communicator/launcher/SIPCommunicator.java b/src/net/java/sip/communicator/launcher/SIPCommunicator.java
index ca35e990a..e3d65fafc 100644
--- a/src/net/java/sip/communicator/launcher/SIPCommunicator.java
+++ b/src/net/java/sip/communicator/launcher/SIPCommunicator.java
@@ -9,25 +9,28 @@
import java.awt.*;
import java.io.*;
+import net.java.sip.communicator.util.launchutils.*;
+
import org.apache.felix.main.*;
/**
* Starts the SIP Communicator.
- *
+ *
* @author Yana Stamcheva
* @author Lubomir Marinov
+ * @author Emil Ivov
*/
public class SIPCommunicator
{
- private static final String PNAME_SC_HOME_DIR_LOCATION =
+ public static final String PNAME_SC_HOME_DIR_LOCATION =
"net.java.sip.communicator.SC_HOME_DIR_LOCATION";
- private static final String PNAME_SC_HOME_DIR_NAME =
+ public static final String PNAME_SC_HOME_DIR_NAME =
"net.java.sip.communicator.SC_HOME_DIR_NAME";
/**
* Starts the SIP Communicator.
- *
+ *
* @param args
*/
public static void main(String[] args)
@@ -68,6 +71,51 @@ else if (osName.startsWith("Windows"))
return;
}
+ //first - pass the arguments to our arg handler
+ LaunchArgHandler argHandler = LaunchArgHandler.getInstance();
+ int argHandlerRes = argHandler.handleArgs(args);
+
+ if ( argHandlerRes == LaunchArgHandler.ACTION_EXIT
+ || argHandlerRes == LaunchArgHandler.ACTION_ERROR)
+ {
+ System.exit(argHandler.getErrorCode());
+ }
+
+ //lock our config di so that we would only have a single instance of
+ //sip communicator, no matter how many times we start it (use mainly
+ //for handling sip: uris after starting the application)
+ if ( argHandlerRes != LaunchArgHandler.ACTION_CONTINUE_MULTIINSTANCE )
+ {
+ SipCommunicatorLock lock = new SipCommunicatorLock();
+
+ int lockResult = lock.tryLock(args);
+
+ if( lockResult == SipCommunicatorLock.LOCK_ERROR )
+ {
+ System.err.print("Failed to lock SIP Communicator's "
+ +"configuration directory.\n"
+ +"Try launching with the --multiple param.");
+ System.exit(SipCommunicatorLock.LOCK_ERROR);
+
+ }
+ else if(lockResult == SipCommunicatorLock.ALREADY_STARTED)
+ {
+ System.err.print(
+ "SIP Communicator is already running and will "
+ +"handle your parameters (if any).\n"
+ +"Launch with the --multiple param to override this "
+ +"behaviour.");
+
+ //we exit with succes because for the user that's what it is.
+ System.exit(SipCommunicatorLock.SUCCESS);
+ }
+ else if(lockResult == SipCommunicatorLock.SUCCESS)
+ {
+ //Successfully locked, continue as normal.
+ }
+ }
+
+ //there was no error, continue;
Main.main(args);
}
@@ -75,13 +123,12 @@ else if (osName.startsWith("Windows"))
* Sets the system properties net.java.sip.communicator.SC_HOME_DIR_LOCATION
* and net.java.sip.communicator.SC_HOME_DIR_NAME (if they aren't already
* set) in accord with the OS conventions specified by the name of the OS.
- *
+ *
* @param osName the name of the OS according to which the SC_HOME_DIR_*
* properties are to be set
*/
private static void setScHomeDir(String osName)
{
-
/*
* Though we'll be setting the SC_HOME_DIR_* property values depending
* on the OS running the application, we have to make sure we are
diff --git a/src/net/java/sip/communicator/service/argdelegation/UriHandler.java b/src/net/java/sip/communicator/service/argdelegation/UriHandler.java
new file mode 100644
index 000000000..d533dc18d
--- /dev/null
+++ b/src/net/java/sip/communicator/service/argdelegation/UriHandler.java
@@ -0,0 +1,35 @@
+/*
+ * SIP Communicator, 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.argdelegation;
+
+/**
+ * This interface is meant to be implemented by all bundles that wish to handle
+ * URIs passed as invocation arguments.
+ *
+ * @author Emil Ivov getExportedWindow(WindowID) and then
+ * getExportedWindow(WindowID) and then
* show. The WindowID above should be obtained from
* getSupportedExportedWindows.
- *
+ *
* @author Yana Stamcheva
*/
public interface UIService
@@ -47,52 +47,52 @@ public interface UIService
* Returns TRUE if the application is visible and FALSE otherwise.
* This method is meant to be used by the systray service in order to
* detect the visibility of the application.
- *
+ *
* @return true if the application is visible and
* false otherwise.
- *
+ *
* @see #setVisible(boolean)
*/
public boolean isVisible();
-
+
/**
* Shows or hides the main application window depending on the value of
* parameter visible. Meant to be used by the systray when it
* needs to show or hide the application.
- *
+ *
* @param visible if true, shows the main application window;
* otherwise, hides the main application window.
- *
+ *
* @see #isVisible()
*/
public void setVisible(boolean visible);
-
+
/**
* Minimizes the main application window.
*/
public void minimize();
-
+
/**
* Mawimizes the main application window.
*/
public void maximize();
-
+
/**
* Restores the main application window.
*/
public void restore();
-
+
/**
* Resizes the main application window with the given width and height.
- *
+ *
* @param width The new width.
* @param height The new height.
*/
public void resize(int width, int height);
-
+
/**
* Moves the main application window to the given coordinates.
- *
+ *
* @param x The x coordinate.
* @param y The y coordinate.
*/
@@ -103,29 +103,29 @@ public interface UIService
* application by simply closing the main application window (by clicking
* the X button or pressing Alt-F4). When set to FALSE the main application
* window will be only hidden.
- *
+ *
* @param exitOnClose When TRUE, the user could exit the
* application by simply closing the main application window (by clicking
* the X button or pressing Alt-F4). When set to FALSE the main application
* window will be only hidden.
*/
public void setExitOnMainWindowClose(boolean exitOnClose);
-
+
/**
* Returns TRUE if the application could be exited by closing the main
* application window, otherwise returns FALSE.
- *
+ *
* @return Returns TRUE if the application could be exited by closing the
* main application window, otherwise returns FALSE
*/
public boolean getExitOnMainWindowClose();
-
+
/**
* Returns an exported window given by the WindowID.
* This could be for example the "Add contact" window or any other window
* within the application. The windowID should be one of the
* WINDOW_XXX obtained by the getSupportedExportedWindows method.
- *
+ *
* @param windowID One of the WINDOW_XXX WindowID-s.
* @throws IllegalArgumentException if the specified windowID
* is not recognized by the implementation (note that implementations
@@ -135,20 +135,20 @@ public interface UIService
*/
public ExportedWindow getExportedWindow(WindowID windowID)
throws IllegalArgumentException;
-
+
/**
* Returns a configurable popup dialog, that could be used to show either
* a warning message, error message, information message, etc. or to prompt
* user for simple one field input or to question the user.
- *
+ *
* @return a PopupDialog.
* @see PopupDialog
*/
public PopupDialog getPopupDialog();
-
+
/**
* Returns the Chat corresponding to the given Contact.
- *
+ *
* @param contact the Contact for which the searched chat is about.
* @return the Chat corresponding to the given Contact.
*/
@@ -156,7 +156,7 @@ public ExportedWindow getExportedWindow(WindowID windowID)
/**
* Returns the Chat corresponding to the given ChatRoom.
- *
+ *
* @param chatRoom the ChatRoom for which the searched chat is
* about.
* @return the Chat corresponding to the given ChatRoom.
@@ -165,18 +165,18 @@ public ExportedWindow getExportedWindow(WindowID windowID)
/**
* Returns the selected Chat.
- *
+ *
* @return the selected Chat.
*/
public Chat getCurrentChat();
-
+
/**
* Returns an ExportableComponent that corresponds to an
* authentication window for the given protocol provider and user
* inromation. Initially this method is meant to be used by the
* SystrayService in order to show a login window when user tries
* to connect using the systray menu.
- *
+ *
* @param protocolProvider the ProtocolProviderService for which
* the authentication window is about.
* @param realm the realm
@@ -193,6 +193,22 @@ public ExportedWindow getAuthenticationWindow(
UserCredentials userCredentials,
boolean isUserNameEditable);
+ /**
+ * Returns a default implementation of the SecurityAuthority
+ * interface that can be used by non-UI components that would like to launch
+ * the registration process for a protocol provider. Initially this method
+ * was meant for use by the systray bundle and the protocol URI handlers.
+ *
+ * @param protocolProvider the ProtocolProviderService for which
+ * the authentication window is about.
+ *
+ * @return a default implementation of the SecurityAuthority
+ * interface that can be used by non-UI components that would like to launch
+ * the registration process for a protocol provider.
+ */
+ public SecurityAuthority getDefaultSecurityAuthority(
+ ProtocolProviderService protocolProvider);
+
/**
* Returns an iterator over a set of windowID-s. Each WindowID
* points to a window in the current UI implementation. Each
@@ -201,25 +217,25 @@ public ExportedWindow getAuthenticationWindow(
* bundles that would like to have access to some windows in the gui
* - for example the "Add contact" window, the "Settings" window, the
* "Chat window", etc.
- *
- * @return Iterator An iterator to a set containing WindowID-s
+ *
+ * @return Iterator An iterator to a set containing WindowID-s
* representing all exported windows supported by the current UI
* implementation.
*/
public Iterator getSupportedExportedWindows();
-
+
/**
* Chechks if a window with the given WindowID is contained in the
* current UI implementation.
- *
+ *
* @param windowID one of the WindowID-s, defined in the
- * ExportedWindow interface.
+ * ExportedWindow interface.
* @return true if the component with the given
* WindowID is contained in the current UI implementation,
* false otherwise.
*/
public boolean isExportedWindowSupported(WindowID windowID);
-
+
/**
* Returns the WizardContainer for the current
* UIService implementation. The WizardContainer
@@ -228,7 +244,7 @@ public ExportedWindow getAuthenticationWindow(
* s. Each of these wizards is made for a given protocol and should provide
* a sequence of user interface forms through which the user could
* registrate a new account.
- *
+ *
* @return Returns the AccountRegistrationWizardContainer for the
* current UIService implementation.
*/
@@ -238,12 +254,12 @@ public ExportedWindow getAuthenticationWindow(
* Returns an iterator over a set containing containerID-s pointing to
* containers supported by the current UI implementation. Each containerID
* in the set is one of the CONTAINER_XXX constants. The method is meant to
- * be used by plugins or bundles that would like to add components to the
+ * be used by plugins or bundles that would like to add components to the
* user interface. Before adding any component they should use this method
* to obtain all possible places, which could contain external components,
* like different menus, toolbars, etc.
- *
- * @return Iterator An iterator to a set containing containerID-s
+ *
+ * @return Iterator An iterator to a set containing containerID-s
* representing all containers supported by the current UI implementation.
*/
public Iterator getSupportedContainers();
@@ -251,9 +267,9 @@ public ExportedWindow getAuthenticationWindow(
/**
* Chechks if the container with the given Container is supported
* from the current UI implementation.
- *
- * @param containderID One of the CONTAINER_XXX Container-s.
- * @return true if the contaner with the given
+ *
+ * @param containderID One of the CONTAINER_XXX Container-s.
+ * @return true if the contaner with the given
* Container is supported from the current UI implementation,
* false otherwise.
*/
diff --git a/src/net/java/sip/communicator/service/protocol/OperationFailedException.java b/src/net/java/sip/communicator/service/protocol/OperationFailedException.java
index 19b13221b..d87749732 100644
--- a/src/net/java/sip/communicator/service/protocol/OperationFailedException.java
+++ b/src/net/java/sip/communicator/service/protocol/OperationFailedException.java
@@ -121,11 +121,16 @@ public class OperationFailedException
*/
public static final int AUTHENTICATION_CANCELED = 15;
+ /**
+ * Indicates that the operation has been canceled by the user.
+ */
+ public static final int OPERATION_CANCELED = 16;
+
/**
* The error code of the exception
*/
private int errorCode = GENERAL_ERROR;
-
+
/**
* Creates an exception with the specified error message and error code.
* @param message A message containing details on the error that caused the
diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
index 97410fb30..3501cd50b 100644
--- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
+++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
@@ -133,12 +133,12 @@ public abstract class ProtocolProviderFactory
* resource property.
*/
public static final String RESOURCE = "RESOURCE";
-
+
/**
* The name of the property under which we store resource priority.
*/
public static final String RESOURCE_PRIORITY = "RESOURCE_PRIORITY";
-
+
/**
* The name of the property under which we store the boolean value
* indicating if the user name should be automatically changed if the
@@ -146,44 +146,44 @@ public abstract class ProtocolProviderFactory
* implementations.
*/
public static final String AUTO_CHANGE_USER_NAME = "AUTO_CHANGE_USER_NAME";
-
+
/**
* The name of the property under which we store the boolean value
* indicating if a password is required. Initially this property is meant to
* be used by IRC implementations.
*/
public static final String NO_PASSWORD_REQUIRED = "NO_PASSWORD_REQUIRED";
-
+
/**
* The name of the property under which we store if the presence is enabled.
*/
public static final String IS_PRESENCE_ENABLED = "IS_PRESENCE_ENABLED";
-
+
/**
* The name of the property under which we store if the p2p mode for SIMPLE
* should be forced.
*/
public static final String FORCE_P2P_MODE = "FORCE_P2P_MODE";
-
+
/**
* The name of the property under which we store the offline contact polling
* period for SIMPLE.
*/
- public static final String POLLING_PERIOD = "POLLING_PERIOD";
-
+ public static final String POLLING_PERIOD = "POLLING_PERIOD";
+
/**
* The name of the property under which we store the chosen default
* subscription expiration value for SIMPLE.
*/
public static final String SUBSCRIPTION_EXPIRATION
= "SUBSCRIPTION_EXPIRATION";
-
+
/**
* Indicates if the server address has been validated.
*/
public static final String SERVER_ADDRESS_VALIDATED
= "SERVER_ADDRESS_VALIDATED";
-
+
/**
* Indicates if the proxy address has been validated.
*/
@@ -240,7 +240,7 @@ public abstract AccountID installAccount(String userID,
* the modified account.
* @param accountProperties a set of protocol (or implementation) specific
* properties defining the new account.
- *
+ *
* @throws java.lang.NullPointerException if any of the arguments is null.
*/
public abstract void modifyAccount(
@@ -254,7 +254,7 @@ public abstract void modifyAccount(
* @return a copy of the list containing the AccountIDs of all
* accounts currently registered in this protocol provider.
*/
- public abstract ArrayList getRegisteredAccounts();
+ public abstract ArrayList