com.aelitis.azureus.plugins.net.buddy
Class BuddyPlugin
java.lang.Object
com.aelitis.azureus.plugins.net.buddy.BuddyPlugin
- All Implemented Interfaces:
- Plugin
public class BuddyPlugin
- extends Object
- implements Plugin
Method Summary |
BuddyPluginBuddy |
addBuddy(String key,
int subsystem)
|
protected BuddyPluginBuddy |
addBuddy(String key,
int subsystem,
boolean authorised)
|
void |
addListener(BuddyPluginListener listener)
|
void |
addPublicTagOrCategory(String cat)
|
protected void |
addRateLimiters(GenericMessageConnection connection)
|
void |
addRequestListener(BuddyPluginBuddyRequestListener listener)
|
protected void |
checkAvailable()
|
protected void |
checkBuddiesAndRepublish()
|
protected void |
checkMaxMessageSize(int size)
|
void |
checkMessagePending(int tick_count)
|
protected void |
checkPersistentDispatch()
|
protected void |
checkUnauthBloom()
|
protected void |
closedown()
|
protected String |
decodeString(byte[] bytes)
|
protected BuddyPlugin.cryptoResult |
decrypt(BuddyPluginBuddy buddy,
byte[] content,
String forName)
|
BuddyPlugin.cryptoResult |
decrypt(String public_key,
byte[] content)
|
protected void |
deleteConfig()
|
protected BuddyPlugin.cryptoResult |
encrypt(BuddyPluginBuddy buddy,
byte[] payload)
|
BuddyPlugin.cryptoResult |
encrypt(String pk,
byte[] payload,
String forWho)
|
protected String |
escape(String str)
|
protected void |
fireAdded(BuddyPluginBuddy buddy)
|
protected void |
fireClassicInitialised(boolean ok)
|
protected void |
fireDetailsChanged(BuddyPluginBuddy buddy)
|
protected void |
fireEnabledStateChanged()
|
protected void |
fireRemoved(BuddyPluginBuddy buddy)
|
protected void |
fireUpdated()
|
protected void |
fireYGM(BuddyPluginBuddy[] from_buddies)
|
protected long |
getAddedTime(Download download)
|
protected List<BuddyPluginBuddy> |
getAllBuddies()
|
BuddyPluginAZ2 |
getAZ2Handler()
|
BuddyPluginBeta |
getBeta()
|
List<BuddyPluginBuddy> |
getBuddies()
Returns authorised buddies only |
protected File |
getBuddyConfigDir()
|
BuddyPluginBuddy |
getBuddyFromPublicKey(String key)
|
protected int |
getCurrentStatusSeq()
|
BooleanParameter |
getEnableChatNotificationsParameter()
|
protected MagnetPlugin |
getMagnetPlugin()
|
protected GenericMessageRegistration |
getMessageRegistration()
|
String |
getNickname()
|
int |
getOnlineStatus()
|
String |
getOnlineStatus(int status)
|
PluginInterface |
getPluginInterface()
|
String |
getPublicKey()
|
BuddyPlugin.feedDetails |
getRSS(BuddyPluginBuddy buddy,
String tag_or_category,
String if_mod)
|
byte[] |
getRSSTorrent(BuddyPluginBuddy buddy,
String category,
byte[] hash)
|
protected SESecurityManager |
getSecurityManager()
|
protected DistributedDatabaseKey |
getStatusKey(byte[] public_key,
String reason)
|
protected BuddyPluginViewInterface |
getSWTUI()
|
BuddyPluginTracker |
getTracker()
|
protected DistributedDatabaseKey |
getYGMKey(byte[] public_key,
String reason)
|
InputStream |
handleUPRSS(AZPluginConnection connection,
BuddyPluginBuddy buddy,
String tag_or_category)
|
InputStream |
handleUPTorrent(AZPluginConnection connection,
BuddyPluginBuddy buddy,
String tag_or_category,
byte[] hash)
|
InputStream |
handleURLProtocol(AZPluginConnection connection,
String arg_str)
|
void |
initialize(PluginInterface _plugin_interface)
This method is called when the Plugin is loaded by Azureus |
boolean |
isAvailable()
|
boolean |
isBetaEnabled()
|
boolean |
isClassicEnabled()
|
boolean |
isPublicTagOrCategory(String cat)
|
static void |
load(PluginInterface plugin_interface)
|
protected void |
loadConfig()
|
void |
log(String str)
|
void |
log(String str,
Throwable e)
|
void |
logMessage(String str)
|
void |
logMessage(String str,
boolean is_error)
|
void |
logMessage(String str,
Throwable e)
|
protected String |
normaliseCat(String str)
|
protected void |
normaliseCats(Set<String> cats)
|
protected void |
persistentDispatchInit()
|
protected void |
persistentDispatchPending(BuddyPluginBuddy buddy)
|
protected Map |
processInternalRequest(BuddyPluginBuddy from_buddy,
Map request)
|
protected Map |
readConfig()
|
protected Map |
readConfigFile(File name)
|
protected void |
registerMessageHandler()
|
protected void |
removeBuddy(BuddyPluginBuddy buddy)
|
void |
removeListener(BuddyPluginListener listener)
|
void |
removePublicTagOrCategory(String cat)
|
void |
removeRequestListener(BuddyPluginBuddyRequestListener listener)
|
protected Map |
requestReceived(BuddyPluginBuddy from_buddy,
int subsystem,
Map content)
|
protected void |
rethrow(String reason,
Throwable e)
|
protected void |
saveConfig()
|
protected void |
saveConfig(boolean force)
|
void |
setClassicEnabled(boolean enabled)
|
protected void |
setClassicEnabledInternal(boolean _enabled)
|
protected void |
setConfigDirty()
|
protected void |
setMessagePending(BuddyPluginBuddy buddy,
BuddyPlugin.operationListener listener)
|
void |
setNickname(String str)
|
void |
setOnlineStatus(int status)
|
protected void |
setPublicTagsOrCategories(Set<String> new_pub_tags_or_cats,
boolean persist)
|
protected void |
setPublicTagsOrCategories(String str,
boolean persist)
|
protected void |
setupDisablePrompt(UIInstance ui)
|
void |
showConfig()
|
byte[] |
sign(byte[] payload)
|
protected byte[] |
signAndInsert(Map plain_stuff,
String reason)
|
protected void |
startup()
|
protected boolean |
stringsEqual(String s1,
String s2)
|
protected boolean |
tooManyUnauthConnections(String originator)
|
protected void |
updateBuddys()
|
protected void |
updateBuddyStatus(BuddyPluginBuddy buddy)
|
protected void |
updateIP()
|
protected void |
updateKey()
|
protected void |
updateListenPorts()
|
protected void |
updateLocale(LocaleUtilities lu)
|
protected void |
updateNickName(String new_nick)
|
protected void |
updateOnlineStatus(int new_status)
|
protected void |
updatePublish(com.aelitis.azureus.plugins.net.buddy.BuddyPlugin.publishDetails details)
|
protected void |
updatePublishSupport(com.aelitis.azureus.plugins.net.buddy.BuddyPlugin.publishDetails details)
|
protected boolean |
verify(BuddyPluginBuddy buddy,
byte[] payload,
byte[] signature)
|
protected boolean |
verify(byte[] pk,
byte[] payload,
byte[] signature)
|
boolean |
verify(String pk,
byte[] payload,
byte[] signature)
|
protected Map |
verifyAndExtract(byte[] signed_stuff,
byte[] public_key)
|
boolean |
verifyPublicKey(String key)
|
protected void |
writeConfig(Map map)
|
protected boolean |
writeConfigFile(File name,
Map data)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SUPPORT_ONLINE_STATUS
public static final boolean SUPPORT_ONLINE_STATUS
- See Also:
- Constant Field Values
VERSION_INITIAL
public static final int VERSION_INITIAL
- See Also:
- Constant Field Values
VERSION_CHAT
public static final int VERSION_CHAT
- See Also:
- Constant Field Values
VERSION_CURRENT
public static final int VERSION_CURRENT
- See Also:
- Constant Field Values
MT_V3_CHAT
public static final int MT_V3_CHAT
- See Also:
- Constant Field Values
MAX_MESSAGE_SIZE
public static final int MAX_MESSAGE_SIZE
- See Also:
- Constant Field Values
SUBSYSTEM_INTERNAL
public static final int SUBSYSTEM_INTERNAL
- See Also:
- Constant Field Values
SUBSYSTEM_AZ2
public static final int SUBSYSTEM_AZ2
- See Also:
- Constant Field Values
SUBSYSTEM_AZ3
public static final int SUBSYSTEM_AZ3
- See Also:
- Constant Field Values
SUBSYSTEM_MSG_TYPE_BASE
protected static final int SUBSYSTEM_MSG_TYPE_BASE
- See Also:
- Constant Field Values
STATUS_ONLINE
public static final int STATUS_ONLINE
- See Also:
- Constant Field Values
STATUS_AWAY
public static final int STATUS_AWAY
- See Also:
- Constant Field Values
STATUS_NOT_AVAILABLE
public static final int STATUS_NOT_AVAILABLE
- See Also:
- Constant Field Values
STATUS_BUSY
public static final int STATUS_BUSY
- See Also:
- Constant Field Values
STATUS_APPEAR_OFFLINE
public static final int STATUS_APPEAR_OFFLINE
- See Also:
- Constant Field Values
STATUS_VALUES
public static final String[] STATUS_VALUES
STATUS_KEYS
public static final String[] STATUS_KEYS
STATUS_STRINGS
public static final String[] STATUS_STRINGS
RT_INTERNAL_REQUEST_PING
protected static final int RT_INTERNAL_REQUEST_PING
- See Also:
- Constant Field Values
RT_INTERNAL_REPLY_PING
protected static final int RT_INTERNAL_REPLY_PING
- See Also:
- Constant Field Values
RT_INTERNAL_REQUEST_CLOSE
protected static final int RT_INTERNAL_REQUEST_CLOSE
- See Also:
- Constant Field Values
RT_INTERNAL_REPLY_CLOSE
protected static final int RT_INTERNAL_REPLY_CLOSE
- See Also:
- Constant Field Values
RT_INTERNAL_FRAGMENT
protected static final int RT_INTERNAL_FRAGMENT
- See Also:
- Constant Field Values
TRACE
protected static final boolean TRACE
- See Also:
- Constant Field Values
TIMER_PERIOD
public static final int TIMER_PERIOD
- See Also:
- Constant Field Values
STATUS_REPUBLISH_PERIOD
protected static final int STATUS_REPUBLISH_PERIOD
- See Also:
- Constant Field Values
PERSISTENT_MSG_RETRY_PERIOD
public static final int PERSISTENT_MSG_RETRY_PERIOD
- See Also:
- Constant Field Values
STREAM_CRYPTO
public static final int STREAM_CRYPTO
- See Also:
- Constant Field Values
BLOCK_CRYPTO
public static final int BLOCK_CRYPTO
- See Also:
- Constant Field Values
BuddyPlugin
public BuddyPlugin()
load
public static void load(PluginInterface plugin_interface)
initialize
public void initialize(PluginInterface _plugin_interface)
- Description copied from interface:
Plugin
- This method is called when the Plugin is loaded by Azureus
- Specified by:
initialize
in interface Plugin
- Parameters:
_plugin_interface
- the interface that the plugin must use to communicate with Azureus
updateLocale
protected void updateLocale(LocaleUtilities lu)
setupDisablePrompt
protected void setupDisablePrompt(UIInstance ui)
- Since:
- 3.0.5.3
showConfig
public void showConfig()
startup
protected void startup()
isClassicEnabled
public boolean isClassicEnabled()
setClassicEnabled
public void setClassicEnabled(boolean enabled)
setClassicEnabledInternal
protected void setClassicEnabledInternal(boolean _enabled)
isBetaEnabled
public boolean isBetaEnabled()
getBeta
public BuddyPluginBeta getBeta()
getTracker
public BuddyPluginTracker getTracker()
getNickname
public String getNickname()
setNickname
public void setNickname(String str)
setOnlineStatus
public void setOnlineStatus(int status)
getOnlineStatus
public int getOnlineStatus()
getEnableChatNotificationsParameter
public BooleanParameter getEnableChatNotificationsParameter()
normaliseCat
protected String normaliseCat(String str)
normaliseCats
protected void normaliseCats(Set<String> cats)
isPublicTagOrCategory
public boolean isPublicTagOrCategory(String cat)
addPublicTagOrCategory
public void addPublicTagOrCategory(String cat)
removePublicTagOrCategory
public void removePublicTagOrCategory(String cat)
setPublicTagsOrCategories
protected void setPublicTagsOrCategories(String str,
boolean persist)
setPublicTagsOrCategories
protected void setPublicTagsOrCategories(Set<String> new_pub_tags_or_cats,
boolean persist)
registerMessageHandler
protected void registerMessageHandler()
addRateLimiters
protected void addRateLimiters(GenericMessageConnection connection)
tooManyUnauthConnections
protected boolean tooManyUnauthConnections(String originator)
checkUnauthBloom
protected void checkUnauthBloom()
checkMaxMessageSize
protected void checkMaxMessageSize(int size)
throws BuddyPluginException
- Throws:
BuddyPluginException
checkPersistentDispatch
protected void checkPersistentDispatch()
persistentDispatchInit
protected void persistentDispatchInit()
persistentDispatchPending
protected void persistentDispatchPending(BuddyPluginBuddy buddy)
processInternalRequest
protected Map processInternalRequest(BuddyPluginBuddy from_buddy,
Map request)
throws BuddyPluginException
- Throws:
BuddyPluginException
updateListenPorts
protected void updateListenPorts()
updateIP
protected void updateIP()
updateNickName
protected void updateNickName(String new_nick)
updateOnlineStatus
protected void updateOnlineStatus(int new_status)
getOnlineStatus
public String getOnlineStatus(int status)
stringsEqual
protected boolean stringsEqual(String s1,
String s2)
updateKey
protected void updateKey()
updatePublish
protected void updatePublish(com.aelitis.azureus.plugins.net.buddy.BuddyPlugin.publishDetails details)
updatePublishSupport
protected void updatePublishSupport(com.aelitis.azureus.plugins.net.buddy.BuddyPlugin.publishDetails details)
getCurrentStatusSeq
protected int getCurrentStatusSeq()
closedown
protected void closedown()
getStatusKey
protected DistributedDatabaseKey getStatusKey(byte[] public_key,
String reason)
throws Exception
- Throws:
Exception
getYGMKey
protected DistributedDatabaseKey getYGMKey(byte[] public_key,
String reason)
throws Exception
- Throws:
Exception
setConfigDirty
protected void setConfigDirty()
loadConfig
protected void loadConfig()
decodeString
protected String decodeString(byte[] bytes)
saveConfig
protected void saveConfig()
saveConfig
protected void saveConfig(boolean force)
addBuddy
public BuddyPluginBuddy addBuddy(String key,
int subsystem)
addBuddy
protected BuddyPluginBuddy addBuddy(String key,
int subsystem,
boolean authorised)
removeBuddy
protected void removeBuddy(BuddyPluginBuddy buddy)
readConfig
protected Map readConfig()
writeConfig
protected void writeConfig(Map map)
deleteConfig
protected void deleteConfig()
readConfigFile
protected Map readConfigFile(File name)
writeConfigFile
protected boolean writeConfigFile(File name,
Map data)
getBuddyConfigDir
protected File getBuddyConfigDir()
getAZ2Handler
public BuddyPluginAZ2 getAZ2Handler()
getPublicKey
public String getPublicKey()
verifyPublicKey
public boolean verifyPublicKey(String key)
checkBuddiesAndRepublish
protected void checkBuddiesAndRepublish()
updateBuddys
protected void updateBuddys()
updateBuddyStatus
protected void updateBuddyStatus(BuddyPluginBuddy buddy)
verifyAndExtract
protected Map verifyAndExtract(byte[] signed_stuff,
byte[] public_key)
throws BuddyPluginException
- Throws:
BuddyPluginException
signAndInsert
protected byte[] signAndInsert(Map plain_stuff,
String reason)
throws BuddyPluginException
- Throws:
BuddyPluginException
verify
public boolean verify(String pk,
byte[] payload,
byte[] signature)
throws BuddyPluginException
- Throws:
BuddyPluginException
verify
protected boolean verify(BuddyPluginBuddy buddy,
byte[] payload,
byte[] signature)
throws BuddyPluginException
- Throws:
BuddyPluginException
verify
protected boolean verify(byte[] pk,
byte[] payload,
byte[] signature)
throws BuddyPluginException
- Throws:
BuddyPluginException
sign
public byte[] sign(byte[] payload)
throws BuddyPluginException
- Throws:
BuddyPluginException
encrypt
protected BuddyPlugin.cryptoResult encrypt(BuddyPluginBuddy buddy,
byte[] payload)
throws BuddyPluginException
- Throws:
BuddyPluginException
encrypt
public BuddyPlugin.cryptoResult encrypt(String pk,
byte[] payload,
String forWho)
throws BuddyPluginException
- Throws:
BuddyPluginException
decrypt
protected BuddyPlugin.cryptoResult decrypt(BuddyPluginBuddy buddy,
byte[] content,
String forName)
throws BuddyPluginException
- Throws:
BuddyPluginException
decrypt
public BuddyPlugin.cryptoResult decrypt(String public_key,
byte[] content)
throws BuddyPluginException
- Throws:
BuddyPluginException
setMessagePending
protected void setMessagePending(BuddyPluginBuddy buddy,
BuddyPlugin.operationListener listener)
throws BuddyPluginException
- Throws:
BuddyPluginException
checkMessagePending
public void checkMessagePending(int tick_count)
getBuddyFromPublicKey
public BuddyPluginBuddy getBuddyFromPublicKey(String key)
getPluginInterface
public PluginInterface getPluginInterface()
getSecurityManager
protected SESecurityManager getSecurityManager()
getMessageRegistration
protected GenericMessageRegistration getMessageRegistration()
getBuddies
public List<BuddyPluginBuddy> getBuddies()
- Returns authorised buddies only
getAllBuddies
protected List<BuddyPluginBuddy> getAllBuddies()
isAvailable
public boolean isAvailable()
checkAvailable
protected void checkAvailable()
throws BuddyPluginException
- Throws:
BuddyPluginException
fireClassicInitialised
protected void fireClassicInitialised(boolean ok)
addListener
public void addListener(BuddyPluginListener listener)
removeListener
public void removeListener(BuddyPluginListener listener)
requestReceived
protected Map requestReceived(BuddyPluginBuddy from_buddy,
int subsystem,
Map content)
throws BuddyPluginException
- Throws:
BuddyPluginException
fireAdded
protected void fireAdded(BuddyPluginBuddy buddy)
fireRemoved
protected void fireRemoved(BuddyPluginBuddy buddy)
fireDetailsChanged
protected void fireDetailsChanged(BuddyPluginBuddy buddy)
fireYGM
protected void fireYGM(BuddyPluginBuddy[] from_buddies)
fireEnabledStateChanged
protected void fireEnabledStateChanged()
fireUpdated
protected void fireUpdated()
getSWTUI
protected BuddyPluginViewInterface getSWTUI()
rethrow
protected void rethrow(String reason,
Throwable e)
throws BuddyPluginException
- Throws:
BuddyPluginException
handleURLProtocol
public InputStream handleURLProtocol(AZPluginConnection connection,
String arg_str)
throws IPCException
- Throws:
IPCException
handleUPRSS
public InputStream handleUPRSS(AZPluginConnection connection,
BuddyPluginBuddy buddy,
String tag_or_category)
throws IPCException
- Throws:
IPCException
handleUPTorrent
public InputStream handleUPTorrent(AZPluginConnection connection,
BuddyPluginBuddy buddy,
String tag_or_category,
byte[] hash)
throws IPCException
- Throws:
IPCException
getMagnetPlugin
protected MagnetPlugin getMagnetPlugin()
getRSS
public BuddyPlugin.feedDetails getRSS(BuddyPluginBuddy buddy,
String tag_or_category,
String if_mod)
throws BuddyPluginException
- Throws:
BuddyPluginException
getRSSTorrent
public byte[] getRSSTorrent(BuddyPluginBuddy buddy,
String category,
byte[] hash)
throws BuddyPluginException
- Throws:
BuddyPluginException
getAddedTime
protected long getAddedTime(Download download)
escape
protected String escape(String str)
addRequestListener
public void addRequestListener(BuddyPluginBuddyRequestListener listener)
removeRequestListener
public void removeRequestListener(BuddyPluginBuddyRequestListener listener)
logMessage
public void logMessage(String str,
Throwable e)
logMessage
public void logMessage(String str)
logMessage
public void logMessage(String str,
boolean is_error)
log
public void log(String str)
log
public void log(String str,
Throwable e)