コード例 #1
0
ファイル: util.go プロジェクト: tulir293/ranssibot
// Subscribe the given UID to the notification list.
func subscribe(u config.User) bool {
	if isSubscribed(u) {
		log.Debugf("[Posts] %[1]s attempted to subscribe to the notification list, but was already subscribed", u.Name)
		return false
	}
	log.Debugf("[Posts] %[1]s successfully subscribed to the notifcation list", u.Name)
	u.SetSetting(subSetting, "true")
	config.ASave()
	return true
}
コード例 #2
0
ファイル: util.go プロジェクト: tulir293/ranssibot
// Unsubscribe the given UID from the notification list.
func unsubscribe(u config.User) bool {
	if !isSubscribed(u) {
		log.Debugf("[Posts] %[1]s attempted to unsubscribe from the notification list, but was not subscribed", u.Name)
		return false
	}
	log.Debugf("[Posts] %[1]s successfully unsubscribed from the notifcation list", u.Name)
	u.RemoveSetting(subSetting)
	config.ASave()
	return true
}
コード例 #3
0
ファイル: util.go プロジェクト: tulir293/ranssibot
func isSubscribed(u config.User) bool {
	return u.HasSetting(subSetting)
}