format + allow closing
This commit is contained in:
@@ -325,6 +325,7 @@ func main() {
|
||||
ok = presence.Get(&mu)
|
||||
|
||||
if ok { // This is a presence stanza from a user in a MUC
|
||||
|
||||
presence.Get(&ocu)
|
||||
// id := ocu.ID
|
||||
// if id == "" {
|
||||
@@ -333,7 +334,7 @@ func main() {
|
||||
from, _ := stanza.NewJid(presence.From)
|
||||
muc := from.Bare()
|
||||
_, ok = mucmembers.Load(muc)
|
||||
if !ok {
|
||||
if !ok && presence.Type != "unavailable" {
|
||||
mucmembers.Store(muc, mucUnit{})
|
||||
}
|
||||
|
||||
@@ -344,6 +345,14 @@ func main() {
|
||||
|
||||
typed_unit := unit.(mucUnit)
|
||||
|
||||
if mu.MucUserItem.JID == clientroot.Session.BindJid {
|
||||
tab, ok := tabs.Load(muc)
|
||||
if ok {
|
||||
typed_tab := tab.(*chatTab)
|
||||
typed_tab.current_nick = id
|
||||
}
|
||||
}
|
||||
|
||||
if presence.Type != "unavailable" {
|
||||
_, ok := typed_unit.Members.Load(id)
|
||||
if !ok && loadedConfig.ShowPresenceUpdates {
|
||||
@@ -408,7 +417,7 @@ func main() {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
showErrorDialog(err)
|
||||
showErrorDialog(err, &window.Window)
|
||||
panic(err)
|
||||
}
|
||||
client = c
|
||||
@@ -524,6 +533,13 @@ func main() {
|
||||
gesture1.Connect("pressed", func() {
|
||||
switchToTab(jid, &window.Window)
|
||||
})
|
||||
gesture2 := gtk.NewGestureClick()
|
||||
gesture2.SetButton(3)
|
||||
gesture2.Connect("pressed", func() {
|
||||
removeTab(jid, &window.Window)
|
||||
box.SetVisible(false)
|
||||
})
|
||||
|
||||
box.Append(b)
|
||||
go func() {
|
||||
new_im := getAvatar(jid, jid) // TODO: Use PEP avatar and do not use JID as hash
|
||||
@@ -604,6 +620,13 @@ func main() {
|
||||
gesture1.Connect("pressed", func() {
|
||||
switchToTab(jid, &window.Window)
|
||||
})
|
||||
|
||||
gesture2 := gtk.NewGestureClick()
|
||||
gesture2.SetButton(3)
|
||||
gesture2.Connect("pressed", func() {
|
||||
removeTab(jid, &window.Window)
|
||||
box.SetVisible(false)
|
||||
})
|
||||
box.Append(b)
|
||||
go func() {
|
||||
new_im := getAvatar(jid, jid)
|
||||
@@ -614,6 +637,7 @@ func main() {
|
||||
}()
|
||||
|
||||
box.AddController(gesture1)
|
||||
box.AddController(gesture2)
|
||||
menu.Append(box)
|
||||
menu.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
|
||||
})
|
||||
@@ -840,7 +864,7 @@ func activate(app *gtk.Application) {
|
||||
jm := func(n string, pw string) {
|
||||
err := joinMuc(client, clientroot.Session.BindJid, t, nick_entry.Text(), pw)
|
||||
if err != nil {
|
||||
showErrorDialog(err)
|
||||
showErrorDialog(err, win)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -861,7 +885,15 @@ func activate(app *gtk.Application) {
|
||||
switchToTab(t, &window.Window)
|
||||
})
|
||||
|
||||
gesture2 := gtk.NewGestureClick()
|
||||
gesture2.SetButton(3)
|
||||
gesture2.Connect("pressed", func() {
|
||||
removeTab(t, &window.Window)
|
||||
box.SetVisible(false)
|
||||
})
|
||||
|
||||
box.AddController(gesture1)
|
||||
box.AddController(gesture2)
|
||||
menu.Append(box)
|
||||
menu.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
|
||||
}
|
||||
@@ -999,9 +1031,9 @@ func activate(app *gtk.Application) {
|
||||
} else {
|
||||
allowed = false
|
||||
if result.Error != nil {
|
||||
showErrorDialog(fmt.Errorf("%s: %s - %s", loadedLocale["discoFail"], result.Error.Reason, result.Error.Text))
|
||||
showErrorDialog(fmt.Errorf("%s: %s - %s", loadedLocale["discoFail"], result.Error.Reason, result.Error.Text), win)
|
||||
} else {
|
||||
showErrorDialog(fmt.Errorf(loadedLocale["discoFail"]))
|
||||
showErrorDialog(fmt.Errorf(loadedLocale["discoFail"]), win)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1227,7 +1259,7 @@ func activate(app *gtk.Application) {
|
||||
|
||||
err := sendMessage(client, current, message_type, t, "", "", exts)
|
||||
if err != nil {
|
||||
showErrorDialog(err)
|
||||
showErrorDialog(err, &window.Window)
|
||||
}
|
||||
message_en.SetText("")
|
||||
scrollToBottomAfterUpdate(scroller)
|
||||
|
||||
Reference in New Issue
Block a user