grim/wasdead

Don't output errors directly to the channel, commands should be handling that themselves
package presence
type Provider interface {
HandleURL(url string) bool
GetPresenceFromURL(url string) (Presence, error)
GetPresenceFromUsername(username string) (Presence, error)
}
var providers map[string]Provider
func init() {
providers = map[string]Provider{}
}
// AddProvider adds the given provider with the given name
func AddProvider(name string, provider Provider) {
providers[name] = provider
}
// NumProviders returns how many presence providers have been configured
func NumProviders() int {
return len(providers)
}
// ProviderAvailable returns whether or not a
func ProviderAvailable(name string) bool {
_, found := providers[name]
return found
}
// GetProvider returns the provider with the given name or nil
func GetProvider(name string) Provider {
return providers[name]
}