Add blocking, add note to self to tabs and add snit's default avatar img
This commit is contained in:
@@ -208,15 +208,26 @@ func main() {
|
||||
})
|
||||
|
||||
router.HandleFunc("message", func(s xmpp.Sender, p stanza.Packet) {
|
||||
var blocked bool
|
||||
m, ok := p.(stanza.Message)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
e := stanza.PubSubEvent{}
|
||||
ok = m.Get(&e)
|
||||
oi := new(OccupantID)
|
||||
ok = m.Get(oi)
|
||||
if ok {
|
||||
fmt.Println(e)
|
||||
id := oi.ID
|
||||
va, ok := loadedConfig.BlockingOI[id]
|
||||
if ok {
|
||||
if va {
|
||||
if loadedConfig.BlockingMode == Drop {
|
||||
return
|
||||
} else {
|
||||
blocked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
originator := JidMustParse(m.From).Bare()
|
||||
@@ -300,13 +311,13 @@ func main() {
|
||||
fmt.Println("Got message when the tab does not exist!")
|
||||
}
|
||||
|
||||
untyped_box, valid := generateMessageWidget(p)
|
||||
untyped_box, valid := generateMessageWidget(p, blocked)
|
||||
ba, converted_successfully := untyped_box.(*gtk.Box)
|
||||
|
||||
if valid && converted_successfully {
|
||||
typed_tab.msgs.Append(b)
|
||||
b.Append(ba)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -525,6 +536,33 @@ func main() {
|
||||
</iq>
|
||||
`, clientroot.Session.BindJid))
|
||||
|
||||
// Create note to self
|
||||
jid := JidMustParse(clientroot.Session.BindJid).Bare()
|
||||
name := "Note To Self"
|
||||
createTab(jid, false, name)
|
||||
glib.IdleAdd(func() {
|
||||
box := gtk.NewBox(gtk.OrientationHorizontal, 10)
|
||||
b := gtk.NewLabel(name)
|
||||
gesture1 := gtk.NewGestureClick()
|
||||
gesture1.SetButton(1)
|
||||
gesture1.Connect("pressed", func() {
|
||||
switchToTab(jid, &window.Window)
|
||||
})
|
||||
|
||||
box.Append(b)
|
||||
go func() {
|
||||
new_im := getAvatar(jid, jid) // TODO: Use PEP avatar and do not use JID as hash
|
||||
glib.IdleAdd(func() {
|
||||
new_im.SetPixelSize(40)
|
||||
box.Prepend(new_im)
|
||||
})
|
||||
}()
|
||||
|
||||
box.AddController(gesture1)
|
||||
menu.Append(box)
|
||||
menu.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
|
||||
})
|
||||
|
||||
// Fetch roster
|
||||
i, err := stanza.NewIQ(stanza.Attrs{
|
||||
Type: "get",
|
||||
|
||||
Reference in New Issue
Block a user