AV hash custom nicks
This commit is contained in:
+21
-1
@@ -150,11 +150,31 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
id := JidMustParse(u.From).Resource
|
id := JidMustParse(u.From).Resource
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
nick_label := gtk.NewLabel(JidMustParse(u.From).Resource)
|
nick_label := gtk.NewLabel(JidMustParse(u.From).Resource)
|
||||||
custom_nick, ok := loadedConfig.CustomNicks[ocu.ID]
|
|
||||||
|
var custom_nick string
|
||||||
|
|
||||||
|
var vcu VCardUpdate
|
||||||
|
ok = u.Get(&vcu)
|
||||||
if ok {
|
if ok {
|
||||||
|
av_nick, ok := loadedConfig.CustomNicksAV[vcu.Photo]
|
||||||
|
if ok {
|
||||||
|
custom_nick = av_nick
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ocu_nick, ok := loadedConfig.CustomNicks[ocu.ID]
|
||||||
|
if ok {
|
||||||
|
custom_nick = ocu_nick
|
||||||
|
}
|
||||||
|
|
||||||
|
if custom_nick != "" {
|
||||||
nick_label.SetText(custom_nick)
|
nick_label.SetText(custom_nick)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nick_label.SetEllipsize(pango.EllipsizeEnd)
|
nick_label.SetEllipsize(pango.EllipsizeEnd)
|
||||||
nick_label.AddCSSClass(mu.MucUserItem.Role)
|
nick_label.AddCSSClass(mu.MucUserItem.Role)
|
||||||
if mu.MucUserItem.Role == "visitor" {
|
if mu.MucUserItem.Role == "visitor" {
|
||||||
|
|||||||
@@ -190,6 +190,29 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
m.Get(&ocu)
|
m.Get(&ocu)
|
||||||
id := JidMustParse(m.From).Resource
|
id := JidMustParse(m.From).Resource
|
||||||
name := id
|
name := id
|
||||||
|
|
||||||
|
|
||||||
|
// Avatar hash custom nicks. This code needs to be optimised.
|
||||||
|
mo, ok := mucmembers.Load(JidMustParse(m.From).Bare())
|
||||||
|
if ok {
|
||||||
|
mm, ok := mo.(mucUnit)
|
||||||
|
if ok {
|
||||||
|
mmm, ok := mm.Members.Load(id)
|
||||||
|
if ok {
|
||||||
|
u := mmm.(stanza.Presence)
|
||||||
|
var vcu VCardUpdate
|
||||||
|
ok = u.Get(&vcu)
|
||||||
|
if ok {
|
||||||
|
av_nick, ok := loadedConfig.CustomNicksAV[vcu.Photo]
|
||||||
|
if ok {
|
||||||
|
name = av_nick
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
custom_nick, ok := loadedConfig.CustomNicks[ocu.ID]
|
custom_nick, ok := loadedConfig.CustomNicks[ocu.ID]
|
||||||
if ok {
|
if ok {
|
||||||
name = custom_nick
|
name = custom_nick
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ type lambdaConfig struct {
|
|||||||
ShowPresenceUpdates bool
|
ShowPresenceUpdates bool
|
||||||
CompactMode bool
|
CompactMode bool
|
||||||
ShowAvatarsInMemberList bool
|
ShowAvatarsInMemberList bool
|
||||||
CustomNicks map[string]string
|
CustomNicks map[string]string // Anyone with a specific Occupant ID will have this nick
|
||||||
|
CustomNicksAV map[string]string // Anyone with a specific avatar hash will have this nick
|
||||||
CheckUpdate string
|
CheckUpdate string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user