public final class Skype extends Object
All IO exceptions that might be thrown by any action are catched and passed to the registered error listener and disconnect the interface immediately.
Note: All strings passed to user/group/skype objects will have their control characters removed (0x00-0x1F and 0x7F-0x9F) except for CR and LF which will be replaced with CRLF if needed.
If you want to report a bug, please enable debug/logs with setDebug(Path)
, before using connect()
.
Constructor and Description |
---|
Skype(String username,
String password)
Builds a new Skype connection without connecting to anything.
|
Modifier and Type | Method and Description |
---|---|
void |
addGroupMessageListener(GroupMessageListener groupMessageListener)
Adds a group message listener.
|
void |
addGroupPropertiesListener(GroupPropertiesListener groupPropertiesListener)
Adds a group properties listener.
|
void |
addUserMessageListener(UserMessageListener userMessageListener)
Adds a user message listener.
|
void |
addUserPresenceListener(UserPresenceListener userPresenceListener)
Adds a user presence listener.
|
void |
changePresence(Presence presence)
Changes the presence of the Skype account.
|
void |
connect()
Calls
connect(Presence.CONNECTED) . |
void |
connect(Presence presence)
Connects the Skype interface.
|
void |
disconnect()
Disconnects the Skype interface.
|
List<ContactRequest> |
getContactRequests() |
List<User> |
getContacts() |
List<Group> |
getGroups() |
User |
getSelf() |
boolean |
isConnected() |
void |
removeGroupMessageListener(GroupMessageListener groupMessageListener)
Removes a group message listener.
|
void |
removeGroupPropertiesListener(GroupPropertiesListener groupPropertiesListener)
Removes a group properties listener.
|
void |
removeUserMessageListener(UserMessageListener userMessageListener)
Removes a user message listener.
|
void |
removeUserPresenceListener(UserPresenceListener userPresenceListener)
Removes a user presence listener.
|
static void |
setDebug(Path path)
Enables or disables debug of the Skype library (globally).
|
void |
setErrorListener(ErrorListener errorListener)
Sets an error listener for the Skype interface.
|
public void connect() throws IOException, InterruptedException
connect(Presence.CONNECTED)
.IOException
- If an error is thrown while connecting.InterruptedException
- If the connection is interrupted.connect(Presence)
public void connect(Presence presence) throws IOException, InterruptedException
presence
- The initial presence of the Skype account after connection. Cannot be Presence.OFFLINE
.IOException
- If an error is thrown while connecting.InterruptedException
- If the connection is interrupted.public void disconnect()
All User, Group, and ContactRequest objects will remain valid for the next connections. Make sure to reconnect (start) before triggering actions from these, however, or they will throw an IllegalStateException.
public List<ContactRequest> getContactRequests()
public List<Group> getGroups()
public User getSelf()
public List<User> getContacts()
public void changePresence(Presence presence)
All presence values are valid except Presence.OFFLINE
: to disconnect, use disconnect()
.
presence
- The new presence of the Skype account.Presence
public boolean isConnected()
public static void setDebug(Path path) throws IOException
If enabled, debug information and logs will be written to a log file at the specified path. If the path is null, the debug will be disabled.
path
- The path at which to write debugging information, or null to disable logging.IOException
- may be thrown when adding a file handler to the loggerpublic void addUserMessageListener(UserMessageListener userMessageListener)
userMessageListener
- The user message listener to add.public void removeUserMessageListener(UserMessageListener userMessageListener)
userMessageListener
- The user message listener to remove.public void addGroupMessageListener(GroupMessageListener groupMessageListener)
groupMessageListener
- The group message listener to add.public void removeGroupMessageListener(GroupMessageListener groupMessageListener)
groupMessageListener
- The group message listener to remove.public void addUserPresenceListener(UserPresenceListener userPresenceListener)
userPresenceListener
- The user presence listener to add.public void removeUserPresenceListener(UserPresenceListener userPresenceListener)
userPresenceListener
- The user presence listener to remove.public void addGroupPropertiesListener(GroupPropertiesListener groupPropertiesListener)
groupPropertiesListener
- The group properties listener to add.public void removeGroupPropertiesListener(GroupPropertiesListener groupPropertiesListener)
groupPropertiesListener
- The group properties listener to remove.public void setErrorListener(ErrorListener errorListener)
errorListener
- The error listener to set.Copyright © 2015–2016. All rights reserved.