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 java.lang.Object
- implements Plugin
Method Summary |
BuddyPluginBuddy |
addBuddy(java.lang.String key,
int subsystem)
|
protected BuddyPluginBuddy |
addBuddy(java.lang.String key,
int subsystem,
boolean authorised)
|
void |
addListener(BuddyPluginListener listener)
|
void |
addPublicTagOrCategory(java.lang.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 java.lang.String |
decodeString(byte[] bytes)
|
protected BuddyPlugin.cryptoResult |
decrypt(BuddyPluginBuddy buddy,
byte[] content,
java.lang.String forName)
|
BuddyPlugin.cryptoResult |
decrypt(java.lang.String public_key,
byte[] content)
|
protected void |
deleteConfig()
|
protected BuddyPlugin.cryptoResult |
encrypt(BuddyPluginBuddy buddy,
byte[] payload)
|
BuddyPlugin.cryptoResult |
encrypt(java.lang.String pk,
byte[] payload,
java.lang.String forWho)
|
protected java.lang.String |
escape(java.lang.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 java.util.List<BuddyPluginBuddy> |
getAllBuddies()
|
BuddyPluginAZ2 |
getAZ2Handler()
|
BuddyPluginBeta |
getBeta()
|
java.util.List<BuddyPluginBuddy> |
getBuddies()
Returns authorised buddies only |
protected java.io.File |
getBuddyConfigDir()
|
BuddyPluginBuddy |
getBuddyFromPublicKey(java.lang.String key)
|
protected int |
getCurrentStatusSeq()
|
BooleanParameter |
getEnableChatNotificationsParameter()
|
protected MagnetPlugin |
getMagnetPlugin()
|
protected GenericMessageRegistration |
getMessageRegistration()
|
java.lang.String |
getNickname()
|
int |
getOnlineStatus()
|
java.lang.String |
getOnlineStatus(int status)
|
boolean |
getPeersAreLANLocal()
|
PluginInterface |
getPluginInterface()
|
java.lang.String |
getPublicKey()
|
BuddyPlugin.feedDetails |
getRSS(BuddyPluginBuddy buddy,
java.lang.String tag_or_category,
java.lang.String if_mod)
|
byte[] |
getRSSTorrent(BuddyPluginBuddy buddy,
java.lang.String category,
byte[] hash)
|
protected SESecurityManager |
getSecurityManager()
|
protected DistributedDatabaseKey |
getStatusKey(byte[] public_key,
java.lang.String reason)
|
protected BuddyPluginViewInterface |
getSWTUI()
|
BuddyPluginTracker |
getTracker()
|
protected DistributedDatabaseKey |
getYGMKey(byte[] public_key,
java.lang.String reason)
|
java.io.InputStream |
handleUPRSS(AZPluginConnection connection,
BuddyPluginBuddy buddy,
java.lang.String tag_or_category)
|
java.io.InputStream |
handleUPTorrent(AZPluginConnection connection,
BuddyPluginBuddy buddy,
java.lang.String tag_or_category,
byte[] hash)
|
java.io.InputStream |
handleURLProtocol(AZPluginConnection connection,
java.lang.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(java.lang.String cat)
|
static void |
load(PluginInterface plugin_interface)
|
protected void |
loadConfig()
|
void |
log(java.lang.String str)
|
void |
log(java.lang.String str,
java.lang.Throwable e)
|
void |
logMessage(java.lang.String str)
|
void |
logMessage(java.lang.String str,
boolean is_error)
|
void |
logMessage(java.lang.String str,
java.lang.Throwable e)
|
protected java.lang.String |
normaliseCat(java.lang.String str)
|
protected void |
normaliseCats(java.util.Set<java.lang.String> cats)
|
protected void |
persistentDispatchInit()
|
protected void |
persistentDispatchPending(BuddyPluginBuddy buddy)
|
protected java.util.Map |
processInternalRequest(BuddyPluginBuddy from_buddy,
java.util.Map request)
|
protected java.util.Map |
readConfig()
|
protected java.util.Map |
readConfigFile(java.io.File name)
|
protected void |
registerMessageHandler()
|
protected void |
removeBuddy(BuddyPluginBuddy buddy)
|
void |
removeListener(BuddyPluginListener listener)
|
void |
removePublicTagOrCategory(java.lang.String cat)
|
void |
removeRequestListener(BuddyPluginBuddyRequestListener listener)
|
protected java.util.Map |
requestReceived(BuddyPluginBuddy from_buddy,
int subsystem,
java.util.Map content)
|
protected void |
rethrow(java.lang.String reason,
java.lang.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(java.lang.String str)
|
void |
setOnlineStatus(int status)
|
protected void |
setPublicTagsOrCategories(java.util.Set<java.lang.String> new_pub_tags_or_cats,
boolean persist)
|
protected void |
setPublicTagsOrCategories(java.lang.String str,
boolean persist)
|
protected void |
setupDisablePrompt(UIInstance ui)
|
void |
showConfig()
|
byte[] |
sign(byte[] payload)
|
protected byte[] |
signAndInsert(java.util.Map plain_stuff,
java.lang.String reason)
|
protected void |
startup()
|
protected boolean |
stringsEqual(java.lang.String s1,
java.lang.String s2)
|
protected boolean |
tooManyUnauthConnections(java.lang.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(java.lang.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(java.lang.String pk,
byte[] payload,
byte[] signature)
|
protected java.util.Map |
verifyAndExtract(byte[] signed_stuff,
byte[] public_key)
|
boolean |
verifyPublicKey(java.lang.String key)
|
protected void |
writeConfig(java.util.Map map)
|
protected boolean |
writeConfigFile(java.io.File name,
java.util.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 java.lang.String[] STATUS_VALUES
STATUS_KEYS
public static final java.lang.String[] STATUS_KEYS
STATUS_STRINGS
public static final java.lang.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
getPeersAreLANLocal
public boolean getPeersAreLANLocal()
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 java.lang.String getNickname()
setNickname
public void setNickname(java.lang.String str)
setOnlineStatus
public void setOnlineStatus(int status)
getOnlineStatus
public int getOnlineStatus()
getEnableChatNotificationsParameter
public BooleanParameter getEnableChatNotificationsParameter()
normaliseCat
protected java.lang.String normaliseCat(java.lang.String str)
normaliseCats
protected void normaliseCats(java.util.Set<java.lang.String> cats)
isPublicTagOrCategory
public boolean isPublicTagOrCategory(java.lang.String cat)
addPublicTagOrCategory
public void addPublicTagOrCategory(java.lang.String cat)
removePublicTagOrCategory
public void removePublicTagOrCategory(java.lang.String cat)
setPublicTagsOrCategories
protected void setPublicTagsOrCategories(java.lang.String str,
boolean persist)
setPublicTagsOrCategories
protected void setPublicTagsOrCategories(java.util.Set<java.lang.String> new_pub_tags_or_cats,
boolean persist)
registerMessageHandler
protected void registerMessageHandler()
addRateLimiters
protected void addRateLimiters(GenericMessageConnection connection)
tooManyUnauthConnections
protected boolean tooManyUnauthConnections(java.lang.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 java.util.Map processInternalRequest(BuddyPluginBuddy from_buddy,
java.util.Map request)
throws BuddyPluginException
- Throws:
BuddyPluginException
updateListenPorts
protected void updateListenPorts()
updateIP
protected void updateIP()
updateNickName
protected void updateNickName(java.lang.String new_nick)
updateOnlineStatus
protected void updateOnlineStatus(int new_status)
getOnlineStatus
public java.lang.String getOnlineStatus(int status)
stringsEqual
protected boolean stringsEqual(java.lang.String s1,
java.lang.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,
java.lang.String reason)
throws java.lang.Exception
- Throws:
java.lang.Exception
getYGMKey
protected DistributedDatabaseKey getYGMKey(byte[] public_key,
java.lang.String reason)
throws java.lang.Exception
- Throws:
java.lang.Exception
setConfigDirty
protected void setConfigDirty()
loadConfig
protected void loadConfig()
decodeString
protected java.lang.String decodeString(byte[] bytes)
saveConfig
protected void saveConfig()
saveConfig
protected void saveConfig(boolean force)
addBuddy
public BuddyPluginBuddy addBuddy(java.lang.String key,
int subsystem)
addBuddy
protected BuddyPluginBuddy addBuddy(java.lang.String key,
int subsystem,
boolean authorised)
removeBuddy
protected void removeBuddy(BuddyPluginBuddy buddy)
readConfig
protected java.util.Map readConfig()
writeConfig
protected void writeConfig(java.util.Map map)
deleteConfig
protected void deleteConfig()
readConfigFile
protected java.util.Map readConfigFile(java.io.File name)
writeConfigFile
protected boolean writeConfigFile(java.io.File name,
java.util.Map data)
getBuddyConfigDir
protected java.io.File getBuddyConfigDir()
getAZ2Handler
public BuddyPluginAZ2 getAZ2Handler()
getPublicKey
public java.lang.String getPublicKey()
verifyPublicKey
public boolean verifyPublicKey(java.lang.String key)
checkBuddiesAndRepublish
protected void checkBuddiesAndRepublish()
updateBuddys
protected void updateBuddys()
updateBuddyStatus
protected void updateBuddyStatus(BuddyPluginBuddy buddy)
verifyAndExtract
protected java.util.Map verifyAndExtract(byte[] signed_stuff,
byte[] public_key)
throws BuddyPluginException
- Throws:
BuddyPluginException
signAndInsert
protected byte[] signAndInsert(java.util.Map plain_stuff,
java.lang.String reason)
throws BuddyPluginException
- Throws:
BuddyPluginException
verify
public boolean verify(java.lang.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(java.lang.String pk,
byte[] payload,
java.lang.String forWho)
throws BuddyPluginException
- Throws:
BuddyPluginException
decrypt
protected BuddyPlugin.cryptoResult decrypt(BuddyPluginBuddy buddy,
byte[] content,
java.lang.String forName)
throws BuddyPluginException
- Throws:
BuddyPluginException
decrypt
public BuddyPlugin.cryptoResult decrypt(java.lang.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(java.lang.String key)
getPluginInterface
public PluginInterface getPluginInterface()
getSecurityManager
protected SESecurityManager getSecurityManager()
getMessageRegistration
protected GenericMessageRegistration getMessageRegistration()
getBuddies
public java.util.List<BuddyPluginBuddy> getBuddies()
- Returns authorised buddies only
getAllBuddies
protected java.util.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 java.util.Map requestReceived(BuddyPluginBuddy from_buddy,
int subsystem,
java.util.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(java.lang.String reason,
java.lang.Throwable e)
throws BuddyPluginException
- Throws:
BuddyPluginException
handleURLProtocol
public java.io.InputStream handleURLProtocol(AZPluginConnection connection,
java.lang.String arg_str)
throws IPCException
- Throws:
IPCException
handleUPRSS
public java.io.InputStream handleUPRSS(AZPluginConnection connection,
BuddyPluginBuddy buddy,
java.lang.String tag_or_category)
throws IPCException
- Throws:
IPCException
handleUPTorrent
public java.io.InputStream handleUPTorrent(AZPluginConnection connection,
BuddyPluginBuddy buddy,
java.lang.String tag_or_category,
byte[] hash)
throws IPCException
- Throws:
IPCException
getMagnetPlugin
protected MagnetPlugin getMagnetPlugin()
getRSS
public BuddyPlugin.feedDetails getRSS(BuddyPluginBuddy buddy,
java.lang.String tag_or_category,
java.lang.String if_mod)
throws BuddyPluginException
- Throws:
BuddyPluginException
getRSSTorrent
public byte[] getRSSTorrent(BuddyPluginBuddy buddy,
java.lang.String category,
byte[] hash)
throws BuddyPluginException
- Throws:
BuddyPluginException
getAddedTime
protected long getAddedTime(Download download)
escape
protected java.lang.String escape(java.lang.String str)
addRequestListener
public void addRequestListener(BuddyPluginBuddyRequestListener listener)
removeRequestListener
public void removeRequestListener(BuddyPluginBuddyRequestListener listener)
logMessage
public void logMessage(java.lang.String str,
java.lang.Throwable e)
logMessage
public void logMessage(java.lang.String str)
logMessage
public void logMessage(java.lang.String str,
boolean is_error)
log
public void log(java.lang.String str)
log
public void log(java.lang.String str,
java.lang.Throwable e)