Do not let ebassi see this code
This commit is contained in:
@@ -134,287 +134,63 @@ var mucPersistentBytes []byte
|
|||||||
//go:embed assets/muc_temporary.png
|
//go:embed assets/muc_temporary.png
|
||||||
var mucTemporaryBytes []byte
|
var mucTemporaryBytes []byte
|
||||||
|
|
||||||
func init() {
|
//go:embed assets/moderate.png
|
||||||
|
var moderateBytes []byte
|
||||||
|
|
||||||
|
func loadAsset(key string, data []byte) {
|
||||||
loader := gdkpixbuf.NewPixbufLoader()
|
loader := gdkpixbuf.NewPixbufLoader()
|
||||||
|
loader.Write(data)
|
||||||
loader.Write(defaultAvatarBytes)
|
|
||||||
loader.Close()
|
loader.Close()
|
||||||
clientAssets["DefaultAvatar"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
clientAssets[key] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
||||||
|
}
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(failedBytes)
|
func init() {
|
||||||
loader.Close()
|
for key, data := range map[string][]byte{
|
||||||
|
"DefaultAvatar": defaultAvatarBytes,
|
||||||
clientAssets["FailedAvatar"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
"FailedAvatar": failedBytes,
|
||||||
|
"owner": ownerMedalBytes,
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
"admin": adminMedalBytes,
|
||||||
|
"member": memberMedalBytes,
|
||||||
loader.Write(ownerMedalBytes)
|
"none": noneMedalBytes,
|
||||||
loader.Close()
|
"outcast": outcastMedalBytes,
|
||||||
|
"cancel": cancelBytes,
|
||||||
clientAssets["owner"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
"tag": tagBytes,
|
||||||
|
"disabled_logo": logoDisabledBytes,
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
"group": groupBytes,
|
||||||
|
"door_in": doorInBytes,
|
||||||
loader.Write(cancelBytes)
|
"door_out": doorOutBytes,
|
||||||
loader.Close()
|
"large_group": largeGroupBytes,
|
||||||
|
"world": worldBytes,
|
||||||
clientAssets["cancel"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
"disconnect": disconnectBytes,
|
||||||
|
"chart_bar": barBytes,
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
"chart_bar_laggy": barLaggyBytes,
|
||||||
|
"ok": okBytes,
|
||||||
loader.Write(tagBytes)
|
"hourglass": hourglassBytes,
|
||||||
loader.Close()
|
"connect": connectBytes,
|
||||||
|
"comment": commentBytes,
|
||||||
clientAssets["tag"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
"information": informationBytes,
|
||||||
|
"status_away": sABytes,
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
"status_dnd": sBBytes,
|
||||||
|
"status_chat": sCBytes,
|
||||||
loader.Write(adminMedalBytes)
|
"status_xa": xaBytes,
|
||||||
loader.Close()
|
"status_": sOBytes,
|
||||||
|
"car": carBytes,
|
||||||
clientAssets["admin"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
"car_high": carHighBytes,
|
||||||
|
"muc_open": mucOpenBytes,
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
"muc_membersonly": mucMembersOnlyBytes,
|
||||||
|
"muc_passwordprotected": mucPasswordProtectedBytes,
|
||||||
loader.Write(memberMedalBytes)
|
"muc_unsecured": mucUnsecuredBytes,
|
||||||
loader.Close()
|
"muc_hidden": mucHiddenBytes,
|
||||||
|
"muc_public": mucPublicBytes,
|
||||||
clientAssets["member"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
"muc_unmoderated": mucUnmoderatedBytes,
|
||||||
|
"muc_moderated": mucModeratedBytes,
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
"muc_nonanonymous": mucNonAnonymousBytes,
|
||||||
|
"muc_semianonymous": mucSemiAnonymousBytes,
|
||||||
loader.Write(noneMedalBytes)
|
"muc_persistent": mucPersistentBytes,
|
||||||
loader.Close()
|
"muc_temporary": mucTemporaryBytes,
|
||||||
|
"moderate": moderateBytes,
|
||||||
clientAssets["none"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
} {
|
||||||
|
loadAsset(key, data)
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
}
|
||||||
|
|
||||||
loader.Write(outcastMedalBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["outcast"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(logoDisabledBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["disabled_logo"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(groupBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["group"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(doorInBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["door_in"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(doorOutBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["door_out"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(largeGroupBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["large_group"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(worldBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["world"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(disconnectBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["disconnect"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(barBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["chart_bar"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(barLaggyBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["chart_bar_laggy"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(okBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["ok"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(hourglassBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["hourglass"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(connectBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["connect"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(commentBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["comment"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(informationBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["information"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(sABytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["status_away"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(sBBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["status_dnd"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(sCBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["status_chat"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(xaBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["status_xa"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(sOBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["status_"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(carBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["car"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(carHighBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["car_high"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
|
|
||||||
loader.Write(mucOpenBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_open"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucMembersOnlyBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_membersonly"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucPasswordProtectedBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_passwordprotected"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucUnsecuredBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_unsecured"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucHiddenBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_hidden"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucPublicBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_public"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucUnmoderatedBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_unmoderated"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucModeratedBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_moderated"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucNonAnonymousBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_nonanonymous"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucSemiAnonymousBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_semianonymous"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucPersistentBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_persistent"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
|
||||||
loader.Write(mucTemporaryBytes)
|
|
||||||
loader.Close()
|
|
||||||
|
|
||||||
clientAssets["muc_temporary"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 793 B |
+21
-21
@@ -40,7 +40,7 @@ func createTab(jid string, isMuc bool, name string) bool {
|
|||||||
newTab.msgs.SetShowSeparators(true)
|
newTab.msgs.SetShowSeparators(true)
|
||||||
newTab.name = name
|
newTab.name = name
|
||||||
|
|
||||||
newTab.msgs.Append(gtk.NewButtonWithLabel("Get past messages..."))
|
newTab.msgs.Append(gtk.NewButtonWithLabel(loadedLocale["getPastMessages"]))
|
||||||
tabs.Store(jid, newTab)
|
tabs.Store(jid, newTab)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -68,12 +68,12 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
mm := ma.Members
|
mm := ma.Members
|
||||||
gen := gtk.NewBox(gtk.OrientationVertical, 0)
|
gen := gtk.NewBox(gtk.OrientationVertical, 10)
|
||||||
|
|
||||||
i := 0
|
i := 0
|
||||||
rangeOrdered(&mm, (func(k, v any) bool {
|
rangeOrdered(&mm, (func(k, v any) bool {
|
||||||
i++
|
i++
|
||||||
userbox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
userbox := gtk.NewBox(gtk.OrientationHorizontal, 2)
|
||||||
|
|
||||||
u := v.(stanza.Presence)
|
u := v.(stanza.Presence)
|
||||||
var mu MucUser
|
var mu MucUser
|
||||||
@@ -99,7 +99,7 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
nick_label.SetOpacity(0.5)
|
nick_label.SetOpacity(0.5)
|
||||||
}
|
}
|
||||||
|
|
||||||
userbox.SetTooltipText(fmt.Sprintf("%s\n%s\n%s\nClick for more information", u.From, mu.MucUserItem.Role, mu.MucUserItem.Affiliation))
|
userbox.SetTooltipText(fmt.Sprintf("%s\n%s\n%s\n%s", u.From, mu.MucUserItem.Role, mu.MucUserItem.Affiliation, loadedLocale["clickForMoreInfo"]))
|
||||||
userbox.Append(nick_label)
|
userbox.Append(nick_label)
|
||||||
|
|
||||||
var hats Hats
|
var hats Hats
|
||||||
@@ -159,10 +159,10 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
popover.SetParent(userbox)
|
popover.SetParent(userbox)
|
||||||
|
|
||||||
rc_box := gtk.NewBox(gtk.OrientationVertical, 0)
|
rc_box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||||
bb := gtk.NewButtonWithLabel("Ban")
|
bb := gtk.NewButtonWithLabel(loadedLocale["ban"])
|
||||||
kb := gtk.NewButtonWithLabel("Kick")
|
kb := gtk.NewButtonWithLabel(loadedLocale["kick"])
|
||||||
ab := gtk.NewButtonWithLabel("Set affil")
|
ab := gtk.NewButtonWithLabel(loadedLocale["setAffil"])
|
||||||
rb := gtk.NewButtonWithLabel("Set role")
|
rb := gtk.NewButtonWithLabel(loadedLocale["setRole"])
|
||||||
|
|
||||||
kb.ConnectClicked(func() {
|
kb.ConnectClicked(func() {
|
||||||
client.SendRaw(fmt.Sprintf(`
|
client.SendRaw(fmt.Sprintf(`
|
||||||
@@ -207,12 +207,12 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
win.SetResizable(false)
|
win.SetResizable(false)
|
||||||
|
|
||||||
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||||
box.Append(gtk.NewLabel("Set " + JidMustParse(u.From).Resource + "'s affiliation"))
|
box.Append(gtk.NewLabel(loadedLocale["setAffilDescPartOne"] + JidMustParse(u.From).Resource + loadedLocale["setAffilDescPartTwo"]))
|
||||||
|
|
||||||
the_entry := gtk.NewEntry()
|
the_entry := gtk.NewEntry()
|
||||||
the_entry.SetText(mu.MucUserItem.Affiliation)
|
the_entry.SetText(mu.MucUserItem.Affiliation)
|
||||||
|
|
||||||
submit := gtk.NewButtonWithLabel("Submit")
|
submit := gtk.NewButtonWithLabel(loadedLocale["submit"])
|
||||||
submit.ConnectClicked(func() {
|
submit.ConnectClicked(func() {
|
||||||
client.SendRaw(fmt.Sprintf(`
|
client.SendRaw(fmt.Sprintf(`
|
||||||
<iq from='%s'
|
<iq from='%s'
|
||||||
@@ -246,13 +246,13 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
win.SetResizable(false)
|
win.SetResizable(false)
|
||||||
|
|
||||||
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||||
box.Append(gtk.NewLabel("Set " + JidMustParse(u.From).Resource + "'s role"))
|
box.Append(gtk.NewLabel(loadedLocale["setRoleDescPartOne"] + JidMustParse(u.From).Resource + loadedLocale["setRoleDescPartTwo"]))
|
||||||
box.Append(gtk.NewLabel("Important: if you want this to be permanent, set their affiliation instead"))
|
box.Append(gtk.NewLabel(loadedLocale["setRoleWarning"]))
|
||||||
|
|
||||||
the_entry := gtk.NewEntry()
|
the_entry := gtk.NewEntry()
|
||||||
the_entry.SetText(mu.MucUserItem.Role)
|
the_entry.SetText(mu.MucUserItem.Role)
|
||||||
|
|
||||||
submit := gtk.NewButtonWithLabel("Submit")
|
submit := gtk.NewButtonWithLabel(loadedLocale["submit"])
|
||||||
submit.ConnectClicked(func() {
|
submit.ConnectClicked(func() {
|
||||||
|
|
||||||
client.SendRaw(fmt.Sprintf(`
|
client.SendRaw(fmt.Sprintf(`
|
||||||
@@ -295,7 +295,7 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
win.SetDefaultSize(400, 400)
|
win.SetDefaultSize(400, 400)
|
||||||
profile_box := gtk.NewBox(gtk.OrientationVertical, 0)
|
profile_box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||||
nick := gtk.NewLabel(JidMustParse(u.From).Resource)
|
nick := gtk.NewLabel(JidMustParse(u.From).Resource)
|
||||||
ver_text := gtk.NewLabel("Getting version...")
|
ver_text := gtk.NewLabel(loadedLocale["gettingVersion"])
|
||||||
ver_text.AddCSSClass("visitor")
|
ver_text.AddCSSClass("visitor")
|
||||||
|
|
||||||
win.SetTitle(JidMustParse(u.From).Resource)
|
win.SetTitle(JidMustParse(u.From).Resource)
|
||||||
@@ -343,8 +343,8 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
ji.SetSelectable(true)
|
ji.SetSelectable(true)
|
||||||
profile_box.Append(ji)
|
profile_box.Append(ji)
|
||||||
}
|
}
|
||||||
profile_box.Append(gtk.NewLabel("Connected with role " + mu.MucUserItem.Role))
|
profile_box.Append(gtk.NewLabel(loadedLocale["connectedWithRole"] + mu.MucUserItem.Role))
|
||||||
profile_box.Append(gtk.NewLabel("Affiliated as " + mu.MucUserItem.Affiliation))
|
profile_box.Append(gtk.NewLabel(loadedLocale["affiliatedAs"] + mu.MucUserItem.Affiliation))
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
@@ -408,13 +408,13 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
|
|
||||||
vr := fmt.Sprintf("%s %s %s", name, version, os)
|
vr := fmt.Sprintf("%s %s %s", name, version, os)
|
||||||
if name == "" && version == "" && os == "" {
|
if name == "" && version == "" && os == "" {
|
||||||
ver_text.SetText("Client responded with empty version")
|
ver_text.SetText(loadedLocale["versionQueryEmpty"])
|
||||||
} else {
|
} else {
|
||||||
ver_text.SetText(vr)
|
ver_text.SetText(vr)
|
||||||
ver_text.RemoveCSSClass("visitor")
|
ver_text.RemoveCSSClass("visitor")
|
||||||
}
|
}
|
||||||
} else if result.Error != nil && result.Error.Type != "" {
|
} else if result.Error != nil && result.Error.Type != "" {
|
||||||
ver_text.SetText("Got error trying to get version")
|
ver_text.SetText(loadedLocale["versionQueryError"])
|
||||||
ver_text.SetTooltipText(result.Error.Reason + ": " + result.Error.Text)
|
ver_text.SetTooltipText(result.Error.Reason + ": " + result.Error.Text)
|
||||||
ver_text.RemoveCSSClass("visitor")
|
ver_text.RemoveCSSClass("visitor")
|
||||||
ver_text.AddCSSClass("error")
|
ver_text.AddCSSClass("error")
|
||||||
@@ -470,7 +470,7 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
} else {
|
} else {
|
||||||
headerBox.Append(gtk.NewImageFromPaintable(clientAssets["group"]))
|
headerBox.Append(gtk.NewImageFromPaintable(clientAssets["group"]))
|
||||||
}
|
}
|
||||||
headerBox.Append(gtk.NewLabel(fmt.Sprintf("%d participant(s)", i)))
|
headerBox.Append(gtk.NewLabel(fmt.Sprintf("%d %s", i, loadedLocale["participants"])))
|
||||||
gen.Prepend(headerBox)
|
gen.Prepend(headerBox)
|
||||||
|
|
||||||
muci := getAvatar(jid, jid)
|
muci := getAvatar(jid, jid)
|
||||||
@@ -488,7 +488,7 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
|
|
||||||
func showErrorDialog(err error) {
|
func showErrorDialog(err error) {
|
||||||
err_win := gtk.NewWindow()
|
err_win := gtk.NewWindow()
|
||||||
err_win.SetTitle("Error")
|
err_win.SetTitle(loadedLocale["error"])
|
||||||
err_win.SetDefaultSize(400, 200)
|
err_win.SetDefaultSize(400, 200)
|
||||||
err_win.SetResizable(false)
|
err_win.SetResizable(false)
|
||||||
|
|
||||||
@@ -497,7 +497,7 @@ func showErrorDialog(err error) {
|
|||||||
err_label.SetSelectable(true)
|
err_label.SetSelectable(true)
|
||||||
box.Append(err_label)
|
box.Append(err_label)
|
||||||
|
|
||||||
close_btn := gtk.NewButtonWithLabel("Close")
|
close_btn := gtk.NewButtonWithLabel(loadedLocale["close"])
|
||||||
close_btn.ConnectClicked(func() {
|
close_btn.ConnectClicked(func() {
|
||||||
err_win.SetVisible(false)
|
err_win.SetVisible(false)
|
||||||
})
|
})
|
||||||
|
|||||||
+9
-9
@@ -23,7 +23,7 @@ func generatePresenceWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
presence, ok := p.(stanza.Presence)
|
presence, ok := p.(stanza.Presence)
|
||||||
if !ok {
|
if !ok {
|
||||||
return gtk.NewLabel("Unsupported message.")
|
return gtk.NewLabel(loadedLocale["unsupportedMessage"])
|
||||||
}
|
}
|
||||||
|
|
||||||
if presence.Type == stanza.PresenceTypeUnavailable {
|
if presence.Type == stanza.PresenceTypeUnavailable {
|
||||||
@@ -32,7 +32,7 @@ func generatePresenceWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
if ok {
|
if ok {
|
||||||
if mu.MucUserItem.Affiliation == "outcast" {
|
if mu.MucUserItem.Affiliation == "outcast" {
|
||||||
b.Append(gtk.NewImageFromPaintable(clientAssets["outcast"]))
|
b.Append(gtk.NewImageFromPaintable(clientAssets["outcast"]))
|
||||||
b.Append(gtk.NewLabel(JidMustParse(presence.From).Resource + " has been banned by " + mu.MucUserItem.Actor.Nick + "!"))
|
b.Append(gtk.NewLabel(JidMustParse(presence.From).Resource + loadedLocale["bannedWidget"] + mu.MucUserItem.Actor.Nick + "!"))
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
ok = m.Get(&readmarker)
|
ok = m.Get(&readmarker)
|
||||||
if ok {
|
if ok {
|
||||||
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
b.Append(gtk.NewLabel(fmt.Sprintf("%s has read to this point", JidMustParse(m.From).Resource)))
|
b.Append(gtk.NewLabel(fmt.Sprintf("%s%s", JidMustParse(m.From).Resource, loadedLocale["readWidget"])))
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
ok = m.Get(&composing)
|
ok = m.Get(&composing)
|
||||||
if ok {
|
if ok {
|
||||||
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
b.Append(gtk.NewLabel(fmt.Sprintf("%s is typing...", JidMustParse(m.From).Resource)))
|
b.Append(gtk.NewLabel(fmt.Sprintf("%s%s", JidMustParse(m.From).Resource, loadedLocale["isTyping"])))
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
sid := StanzaID{}
|
sid := StanzaID{}
|
||||||
m.Get(&sid)
|
m.Get(&sid)
|
||||||
|
|
||||||
mainBox := gtk.NewBox(gtk.OrientationVertical, 0)
|
mainBox := gtk.NewBox(gtk.OrientationVertical, 10)
|
||||||
gesture := gtk.NewGestureClick()
|
gesture := gtk.NewGestureClick()
|
||||||
gesture.SetButton(3) // Right click
|
gesture.SetButton(3) // Right click
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
authorBox.Append(im)
|
authorBox.Append(im)
|
||||||
}
|
}
|
||||||
} else if m.Type == stanza.MessageTypeChat {
|
} else if m.Type == stanza.MessageTypeChat {
|
||||||
al.SetText(al.Text() + " whispers")
|
al.SetText(al.Text() + loadedLocale["whispers"])
|
||||||
}
|
}
|
||||||
|
|
||||||
authorBox.Append(al)
|
authorBox.Append(al)
|
||||||
@@ -204,7 +204,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
|
|
||||||
mlabel := gtk.NewLabel(m.Body)
|
mlabel := gtk.NewLabel(m.Body)
|
||||||
if m.Body == "" {
|
if m.Body == "" {
|
||||||
mlabel.SetText("No body set")
|
mlabel.SetText(loadedLocale["noBodySet"])
|
||||||
mlabel.AddCSSClass("visitor")
|
mlabel.AddCSSClass("visitor")
|
||||||
}
|
}
|
||||||
mlabel.SetWrap(true)
|
mlabel.SetWrap(true)
|
||||||
@@ -214,7 +214,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
mum := MucUser{}
|
mum := MucUser{}
|
||||||
ok = m.Get(&mum)
|
ok = m.Get(&mum)
|
||||||
if ok {
|
if ok {
|
||||||
mlabel.SetText(fmt.Sprintf("%s's affiliation has been changed to %s", mum.MucUserItem.JID, mum.MucUserItem.Affiliation))
|
mlabel.SetText(fmt.Sprintf("%s%s%s", mum.MucUserItem.JID, loadedLocale["affilChange"], mum.MucUserItem.Affiliation))
|
||||||
}
|
}
|
||||||
|
|
||||||
contentBox.Append(mlabel)
|
contentBox.Append(mlabel)
|
||||||
@@ -266,7 +266,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
lp_box.Append(lp_desc)
|
lp_box.Append(lp_desc)
|
||||||
|
|
||||||
warning := gtk.NewLabel("⚠️")
|
warning := gtk.NewLabel("⚠️")
|
||||||
warning.SetTooltipText("This link preview was generated by the client sending it and may not be accurate of the actual website content")
|
warning.SetTooltipText(loadedLocale["linkPreviewWarning"])
|
||||||
lp_box.Append(warning)
|
lp_box.Append(warning)
|
||||||
|
|
||||||
mainBox.Append(lp_box)
|
mainBox.Append(lp_box)
|
||||||
|
|||||||
+7
-7
@@ -35,12 +35,12 @@ func dropToSignInPage(err error) {
|
|||||||
nickname_box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
nickname_box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
insecure_box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
insecure_box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
|
|
||||||
server_label := gtk.NewLabel("Server: ")
|
server_label := gtk.NewLabel(loadedLocale["SIServerLabel"])
|
||||||
username_label := gtk.NewLabel("JID: ")
|
username_label := gtk.NewLabel(loadedLocale["SIUsernameLabel"])
|
||||||
password_label := gtk.NewLabel("Password: ")
|
password_label := gtk.NewLabel(loadedLocale["SIPasswordLabel"])
|
||||||
nickname_label := gtk.NewLabel("Nickname: ")
|
nickname_label := gtk.NewLabel(loadedLocale["SINicknameLabel"])
|
||||||
insecure_label := gtk.NewLabel("Insecure: (?)")
|
insecure_label := gtk.NewLabel(loadedLocale["SIInsecureLabel"])
|
||||||
insecure_label.SetTooltipText("Tick this if you need to connect without TLS, usually for connecting to Tor XMPP servers")
|
insecure_label.SetTooltipText(loadedLocale["SIInsecureLabelTooltip"])
|
||||||
|
|
||||||
server_entry := gtk.NewEntry()
|
server_entry := gtk.NewEntry()
|
||||||
server_entry.SetHAlign(gtk.AlignEnd)
|
server_entry.SetHAlign(gtk.AlignEnd)
|
||||||
@@ -83,7 +83,7 @@ func dropToSignInPage(err error) {
|
|||||||
form_box.Append(nickname_box)
|
form_box.Append(nickname_box)
|
||||||
form_box.Append(insecure_box)
|
form_box.Append(insecure_box)
|
||||||
|
|
||||||
sumbit_btn := gtk.NewButtonWithLabel("Submit")
|
sumbit_btn := gtk.NewButtonWithLabel(loadedLocale["submit"])
|
||||||
sumbit_btn.ConnectClicked(func() {
|
sumbit_btn.ConnectClicked(func() {
|
||||||
conf := new(lambdaConfig)
|
conf := new(lambdaConfig)
|
||||||
conf.Server = server_entry.Text()
|
conf.Server = server_entry.Text()
|
||||||
|
|||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
// Default language is en_GB
|
||||||
|
var loadedLocale = make(map[string]string)
|
||||||
|
|
||||||
|
var enGB = map[string]string{ // British English
|
||||||
|
// main.go
|
||||||
|
|
||||||
|
"appName": "Lambda",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"submit": "Submit",
|
||||||
|
"join": "Join",
|
||||||
|
"send": "Send",
|
||||||
|
"error": "Error",
|
||||||
|
"close": "Close",
|
||||||
|
"userRequested": "User requested",
|
||||||
|
"configResourceEmptyWarning": "Config resource is empty! Generating a random one",
|
||||||
|
"attention": "Attention",
|
||||||
|
"disconnected": "Disconnected: ",
|
||||||
|
"connecting": "Connecting...",
|
||||||
|
"milliseconds": "ms",
|
||||||
|
"KBPerSecond": "KB/s",
|
||||||
|
"connectedAs": "Connected as ",
|
||||||
|
"bindedJid": "Binded JID: ",
|
||||||
|
"usingTLS": "Using TLS: ",
|
||||||
|
"joinMUCMenu": "Join MUC",
|
||||||
|
"joinMUCJIDEntry": "MUC JID:",
|
||||||
|
"joinMUCNickEntry": "Nick:",
|
||||||
|
"joinMUCDiscoCheck": "Check MUC features before joining",
|
||||||
|
"joinMUCDiscoCheckTooltip": "If you are creating a MUC through this window then turn this off",
|
||||||
|
"joinPreviewTitle": "Joining ",
|
||||||
|
"joinPasswordRequired": "Password required",
|
||||||
|
"muc_passwordprotected_description": "This MUC is password-protected",
|
||||||
|
"muc_unsecured_description": "This MUC does not require a password",
|
||||||
|
"muc_membersonly_description": "Only members can join this MUC",
|
||||||
|
"muc_open_description": "Anyone can join this MUC",
|
||||||
|
"muc_moderated_description": "Only members can speak in this MUC",
|
||||||
|
"muc_unmoderated_description": "Anyone can speak in this MUC",
|
||||||
|
"muc_nonanonymous_description": "This MUC is non-anonymous, your JID will be visible to other users",
|
||||||
|
"muc_semianonymous_description": "This MUC is semi-anonymous, only moderators will see your full JID",
|
||||||
|
"muc_persistent_description": "This MUC is persistent, it will not be deleted when the last user leaves",
|
||||||
|
"muc_temporary_description": "This MUC is temporary, it will be deleted when the last user leaves",
|
||||||
|
"muc_public_description": "This MUC can be found in directories and search engines",
|
||||||
|
"muc_hidden_description": "This MUC is hidden and cannot be found in directories or search engines",
|
||||||
|
"urn:xmpp:mam_description": "This MUC supports archiving via MAM",
|
||||||
|
"urn:xmpp:message-moderate_description": "This MUC supports message moderation",
|
||||||
|
"discoFail": "Failed to get Disco info",
|
||||||
|
"startDMMenu": "Start DM",
|
||||||
|
"destroyMUCMenu": "Destroy MUC",
|
||||||
|
"aboutMenu": "About",
|
||||||
|
"destroyMUCWarningOne": "Are you sure? This MUC will be gone forever! (a very long time)",
|
||||||
|
"destroyMUCWarningTwo": "If you wish to continue, type 'I understand'",
|
||||||
|
"destroyMUCPassword": "I understand",
|
||||||
|
"destroyMUCActionButton": "Destroy",
|
||||||
|
"destroyMUCNotOwnerWarning": "You are not an owner of this MUC and thus will most likely not be able to delete it",
|
||||||
|
"pingBarTooltip": "Ping between you and your XMPP server\nRight-click to see graph",
|
||||||
|
"pingGraphTitle": "Server latency",
|
||||||
|
"pingGraphYAxis": "Ping (ms)",
|
||||||
|
"throughputTooltip": "Throughput of your XMPP connection in KB/s",
|
||||||
|
"messageEntryPlaceholder": "Say something, what else are you going to do here?",
|
||||||
|
|
||||||
|
// gtk-message.go
|
||||||
|
|
||||||
|
"unsupportedMessage": "Unsupported message.",
|
||||||
|
"bannedWidget": " has been banned by ",
|
||||||
|
"readWidget": " has read to this point",
|
||||||
|
"isTyping": " is typing...",
|
||||||
|
"whispers": " whispers",
|
||||||
|
"noBodySet": "No body set",
|
||||||
|
"affilChange": "'s affiliation has been changed to ",
|
||||||
|
"linkPreviewWarning": "This link preview was generated by the client sending it and may not be accurate of the actual website content",
|
||||||
|
|
||||||
|
// gtk-helpers.go
|
||||||
|
|
||||||
|
"getPastMessages": "Get past messages...",
|
||||||
|
"clickForMoreInfo": "Click for more information",
|
||||||
|
"ban": "Ban",
|
||||||
|
"kick": "Kick",
|
||||||
|
"setAffil": "Set affiliation",
|
||||||
|
"setAffilDescPartOne": "Set ",
|
||||||
|
"setAffilDescPartTwo": "'s affiliation",
|
||||||
|
"setRole": "Set role",
|
||||||
|
"setRoleDescPartOne": "Set ",
|
||||||
|
"setRoleDescPartTwo": "'s role",
|
||||||
|
"setRoleWarning": "Important: if you want this to be permanent, set their affiliation instead",
|
||||||
|
"gettingVersion": "Getting version...",
|
||||||
|
"connectedWithRole": "Connected with role ",
|
||||||
|
"affiliatedAs": "Affiliated as ",
|
||||||
|
"participants": "participant(s)",
|
||||||
|
"versionQueryEmpty": "Client responded with empty version",
|
||||||
|
"versionQueryError": "Got error trying to get version",
|
||||||
|
|
||||||
|
// gtk-signin.go
|
||||||
|
|
||||||
|
"SIServerLabel": "Server: ",
|
||||||
|
"SIUsernameLabel": "Username: ",
|
||||||
|
"SIPasswordLabel": "Password: ",
|
||||||
|
"SINicknameLabel": "Nickname: ",
|
||||||
|
"SIInsecureLabel": "Insecure: (?)",
|
||||||
|
"SIInsecureLabelTooltip": "Tick this if you need to connect without TLS, usually for connecting to Tor XMPP servers",
|
||||||
|
}
|
||||||
|
|
||||||
|
var kaGE = map[string]string { // Georgian (Georgia)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var roRo = map[string]string { // Romanian (Romania)
|
||||||
|
"appName": "Lambda",
|
||||||
|
"cancel": "Canselează",
|
||||||
|
"submit": "A preda",
|
||||||
|
"join": "Intră",
|
||||||
|
"send": "Trimite",
|
||||||
|
"error": "Eroare",
|
||||||
|
"close": "închide",
|
||||||
|
"userRequested": "Uzator cerut",
|
||||||
|
"configResourceEmptyWarning": "Resursa configurată este goala! Creiez unu aleatoriu",
|
||||||
|
"attention": "Atenție",
|
||||||
|
"disconnected": "Deconectat",
|
||||||
|
"connecting": "Conectat",
|
||||||
|
"bindedJid": "Lipit JID",
|
||||||
|
"joinMUCMenu": "Intră pe MUC",
|
||||||
|
"joinMUCJIDEntry": "MUC JID:",
|
||||||
|
"joinMUCNickEntry": "Poreclă:",
|
||||||
|
"joinMUCDiscoCheck": "Verifica detalile de MUC înainte sa intri",
|
||||||
|
"joinMUCDiscoCheckTooltip": "Dacă creiezi un MUC prin această oglindă închido",
|
||||||
|
}
|
||||||
|
|
||||||
|
var enUS = enGB // American English
|
||||||
|
|
||||||
|
|
||||||
|
var locales = map[string]map[string]string {
|
||||||
|
"en_GB": enGB,
|
||||||
|
"ka_GE": kaGE,
|
||||||
|
"en_US": enUS,
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Load locale according to user configuration
|
||||||
|
func init() {
|
||||||
|
loadedLocale = locales["en_GB"]
|
||||||
|
}
|
||||||
@@ -47,10 +47,8 @@ var typingStatus *gtk.Label
|
|||||||
|
|
||||||
var pingStatus *gtk.Label
|
var pingStatus *gtk.Label
|
||||||
|
|
||||||
// var msgs *gtk.ListBox
|
|
||||||
var content *gtk.Widgetter
|
var content *gtk.Widgetter
|
||||||
|
|
||||||
// var tabs map[string]*chatTab = make(map[string]*chatTab)
|
|
||||||
var tabs sync.Map
|
var tabs sync.Map
|
||||||
var current string
|
var current string
|
||||||
|
|
||||||
@@ -81,7 +79,7 @@ var clientAssets map[string]gdk.Paintabler = make(map[string]gdk.Paintabler)
|
|||||||
var xmlLog *os.File
|
var xmlLog *os.File
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
beeep.AppName = "Lambda"
|
beeep.AppName = loadedLocale["appName"]
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for fn := range uiQueue {
|
for fn := range uiQueue {
|
||||||
@@ -115,7 +113,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if loadedConfig.Resource == "" {
|
if loadedConfig.Resource == "" {
|
||||||
fmt.Println("Config resource is empty! Generating a random one")
|
fmt.Println(loadedLocale["configResourceEmptyWarning"])
|
||||||
loadedConfig.Resource = randomClientResource()
|
loadedConfig.Resource = randomClientResource()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +194,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v := &stanza.Version{}
|
v := &stanza.Version{}
|
||||||
v = v.SetInfo("Lambda", lambda_version, runtime.GOOS) // TODO: Allow spoofing on user request
|
v = v.SetInfo(loadedLocale["appName"], lambda_version, runtime.GOOS) // TODO: Allow spoofing on user request
|
||||||
|
|
||||||
iqResp.Payload = v
|
iqResp.Payload = v
|
||||||
s.Send(iqResp)
|
s.Send(iqResp)
|
||||||
@@ -226,7 +224,7 @@ func main() {
|
|||||||
at := new(Attention)
|
at := new(Attention)
|
||||||
ok = m.Get(at)
|
ok = m.Get(at)
|
||||||
if ok {
|
if ok {
|
||||||
beeep.Notify("Attention", fmt.Sprintf("%s: %s", JidMustParse(m.From).Resource, m.Body), commentBytes) // TODO: Use localpart if DM
|
beeep.Notify(loadedLocale["attention"], fmt.Sprintf("%s: %s", JidMustParse(m.From).Resource, m.Body), commentBytes) // TODO: Use localpart if DM
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle mentions
|
// Handle mentions
|
||||||
@@ -270,7 +268,7 @@ func main() {
|
|||||||
composing := stanza.StateComposing{}
|
composing := stanza.StateComposing{}
|
||||||
ok = m.Get(&composing)
|
ok = m.Get(&composing)
|
||||||
if ok && current == JidMustParse(m.From).Bare() {
|
if ok && current == JidMustParse(m.From).Bare() {
|
||||||
typingStatus.SetText(fmt.Sprintf("%s is typing...", m.From))
|
typingStatus.SetText(fmt.Sprintf("%s %s", m.From, loadedLocale["isTyping"]))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,7 +433,7 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
c, err := xmpp.NewClient(&config, router, func(err error) {
|
c, err := xmpp.NewClient(&config, router, func(err error) {
|
||||||
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
|
connectionStatus.SetText(fmt.Sprintf("%s%s", loadedLocale["disconnected"], err.Error()))
|
||||||
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
|
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -469,7 +467,7 @@ func main() {
|
|||||||
|
|
||||||
pingStatus.RemoveCSSClass("pending")
|
pingStatus.RemoveCSSClass("pending")
|
||||||
delay := time.Since(before) / time.Millisecond
|
delay := time.Since(before) / time.Millisecond
|
||||||
pingStatus.SetText(fmt.Sprintf("%d ms", delay))
|
pingStatus.SetText(fmt.Sprintf("%d %s", delay, loadedLocale["milliseconds"]))
|
||||||
pingTimes[0] = append(pingTimes[0], float64(delay))
|
pingTimes[0] = append(pingTimes[0], float64(delay))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -496,13 +494,13 @@ func main() {
|
|||||||
sIcon.SetFromPaintable(clientAssets["car"])
|
sIcon.SetFromPaintable(clientAssets["car"])
|
||||||
}
|
}
|
||||||
|
|
||||||
sStatus.SetText(fmt.Sprintf("%.2fKB/s", diff))
|
sStatus.SetText(fmt.Sprintf("%.2f%s", diff, loadedLocale["KBPerSecond"]))
|
||||||
oldsize = stat.Size()
|
oldsize = stat.Size()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
connectionStatus.SetText(fmt.Sprintf("Connected as %s", JidMustParse(clientroot.Session.BindJid).Bare()))
|
connectionStatus.SetText(fmt.Sprintf("%s%s", loadedLocale["connectedAs"], JidMustParse(clientroot.Session.BindJid).Bare()))
|
||||||
connectionStatus.SetTooltipText(fmt.Sprintf("Binded JID: %s\nUsing TLS: %t", clientroot.Session.BindJid, clientroot.Session.TlsEnabled))
|
connectionStatus.SetTooltipText(fmt.Sprintf("%s%s\n%s%t", loadedLocale["bindedJid"], clientroot.Session.BindJid, loadedLocale["usingTLS"], clientroot.Session.TlsEnabled))
|
||||||
connectionIcon.SetFromPaintable(clientAssets["connect"])
|
connectionIcon.SetFromPaintable(clientAssets["connect"])
|
||||||
// Enable carbons
|
// Enable carbons
|
||||||
client.SendRaw(fmt.Sprintf(
|
client.SendRaw(fmt.Sprintf(
|
||||||
@@ -593,13 +591,13 @@ func main() {
|
|||||||
|
|
||||||
conc := func() {
|
conc := func() {
|
||||||
time.Sleep(3 * time.Second)
|
time.Sleep(3 * time.Second)
|
||||||
connectionStatus.SetText("Connecting...")
|
connectionStatus.SetText(loadedLocale["connecting"])
|
||||||
connectionIcon.SetFromPaintable(clientAssets["hourglass"])
|
connectionIcon.SetFromPaintable(clientAssets["hourglass"])
|
||||||
|
|
||||||
err = cm.Run()
|
err = cm.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
|
connectionStatus.SetText(fmt.Sprintf("%s%s", loadedLocale["disconnected"], err.Error()))
|
||||||
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
|
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -626,9 +624,9 @@ func activate(app *gtk.Application) {
|
|||||||
the_menu := gio.NewMenu()
|
the_menu := gio.NewMenu()
|
||||||
|
|
||||||
fileMenu := gio.NewMenu()
|
fileMenu := gio.NewMenu()
|
||||||
fileMenu.Append("Join MUC", "app.join")
|
fileMenu.Append(loadedLocale["joinMUCMenu"], "app.join")
|
||||||
fileMenu.Append("Start DM", "app.dm")
|
fileMenu.Append(loadedLocale["startDMMenu"], "app.dm")
|
||||||
fileMenu.Append("Destroy MUC", "app.destroymuc")
|
fileMenu.Append(loadedLocale["destroyMUCMenu"], "app.destroymuc")
|
||||||
|
|
||||||
helpMenu := gio.NewMenu()
|
helpMenu := gio.NewMenu()
|
||||||
helpMenu.Append("About", "app.about")
|
helpMenu.Append("About", "app.about")
|
||||||
@@ -646,24 +644,24 @@ func activate(app *gtk.Application) {
|
|||||||
cur := cur.(*chatTab)
|
cur := cur.(*chatTab)
|
||||||
if cur.isMuc {
|
if cur.isMuc {
|
||||||
win := gtk.NewWindow()
|
win := gtk.NewWindow()
|
||||||
win.SetTitle("Destroy MUC")
|
win.SetTitle(loadedLocale["destroyMUCMenu"])
|
||||||
win.SetDefaultSize(400, 1)
|
win.SetDefaultSize(400, 1)
|
||||||
win.SetResizable(false)
|
win.SetResizable(false)
|
||||||
|
|
||||||
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
box := gtk.NewBox(gtk.OrientationVertical, 10)
|
||||||
box.Append(gtk.NewLabel("Are you sure? This MUC will be gone forever! (a very long time)"))
|
box.Append(gtk.NewLabel(loadedLocale["destroyMUCWarningOne"]))
|
||||||
box.Append(gtk.NewLabel("If you wish to continue, type 'I understand'"))
|
box.Append(gtk.NewLabel(loadedLocale["destroyMUCWarningTwo"]))
|
||||||
cancel := gtk.NewButtonWithLabel("Cancel")
|
cancel := gtk.NewButtonWithLabel(loadedLocale["cancel"])
|
||||||
cancel.ConnectClicked(func() {
|
cancel.ConnectClicked(func() {
|
||||||
win.SetVisible(false)
|
win.SetVisible(false)
|
||||||
})
|
})
|
||||||
en := gtk.NewEntry()
|
en := gtk.NewEntry()
|
||||||
en.SetPlaceholderText("...")
|
en.SetPlaceholderText("...")
|
||||||
|
|
||||||
submit := gtk.NewButtonWithLabel("Destroy")
|
submit := gtk.NewButtonWithLabel(loadedLocale["destroyMUCActionButton"])
|
||||||
submit.ConnectClicked(func() {
|
submit.ConnectClicked(func() {
|
||||||
fmt.Println(en.Text())
|
fmt.Println(en.Text())
|
||||||
if en.Text() == "I understand" {
|
if en.Text() == loadedLocale["destroyMUCPassword"] {
|
||||||
cur, ok := tabs.Load(current)
|
cur, ok := tabs.Load(current)
|
||||||
if ok {
|
if ok {
|
||||||
cur := cur.(*chatTab)
|
cur := cur.(*chatTab)
|
||||||
@@ -675,11 +673,11 @@ func activate(app *gtk.Application) {
|
|||||||
type='set'>
|
type='set'>
|
||||||
<query xmlns='http://jabber.org/protocol/muc#owner'>
|
<query xmlns='http://jabber.org/protocol/muc#owner'>
|
||||||
<destroy jid='%s'>
|
<destroy jid='%s'>
|
||||||
<reason>User requested</reason>
|
<reason>%s</reason>
|
||||||
</destroy>
|
</destroy>
|
||||||
</query>
|
</query>
|
||||||
</iq>
|
</iq>
|
||||||
`, clientroot.Session.BindJid, current, JidMustParse(clientroot.Session.BindJid).Bare()))
|
`, clientroot.Session.BindJid, current, JidMustParse(clientroot.Session.BindJid).Bare(), loadedLocale["userRequested"]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
win.SetVisible(false)
|
win.SetVisible(false)
|
||||||
@@ -702,7 +700,7 @@ func activate(app *gtk.Application) {
|
|||||||
if mu.MucUserItem.JID != "" {
|
if mu.MucUserItem.JID != "" {
|
||||||
if JidMustParse(mu.MucUserItem.JID).Bare() == JidMustParse(clientroot.Session.BindJid).Bare() {
|
if JidMustParse(mu.MucUserItem.JID).Bare() == JidMustParse(clientroot.Session.BindJid).Bare() {
|
||||||
if mu.MucUserItem.Affiliation != "owner" {
|
if mu.MucUserItem.Affiliation != "owner" {
|
||||||
box.Append(gtk.NewLabel("You are not an owner of this MUC and thus will most likely not be able to delete it"))
|
box.Append(gtk.NewLabel(loadedLocale["destroyMUCNotOwnerWarning"]))
|
||||||
}
|
}
|
||||||
// return false
|
// return false
|
||||||
}
|
}
|
||||||
@@ -728,10 +726,10 @@ func activate(app *gtk.Application) {
|
|||||||
|
|
||||||
joinAction := gio.NewSimpleAction("join", nil)
|
joinAction := gio.NewSimpleAction("join", nil)
|
||||||
joinAction.ConnectActivate(func(p *glib.Variant) {
|
joinAction.ConnectActivate(func(p *glib.Variant) {
|
||||||
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
box := gtk.NewBox(gtk.OrientationVertical, 10)
|
||||||
jid_box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
jid_box := gtk.NewBox(gtk.OrientationHorizontal, 10)
|
||||||
nick_box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
nick_box := gtk.NewBox(gtk.OrientationHorizontal, 10)
|
||||||
disco_box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
disco_box := gtk.NewBox(gtk.OrientationHorizontal, 10)
|
||||||
|
|
||||||
jid_entry := gtk.NewEntry()
|
jid_entry := gtk.NewEntry()
|
||||||
nick_entry := gtk.NewEntry()
|
nick_entry := gtk.NewEntry()
|
||||||
@@ -745,28 +743,28 @@ func activate(app *gtk.Application) {
|
|||||||
|
|
||||||
nick_entry.SetText(loadedConfig.Nick)
|
nick_entry.SetText(loadedConfig.Nick)
|
||||||
|
|
||||||
jid_box.Append(gtk.NewLabel("MUC JID:"))
|
jid_box.Append(gtk.NewLabel(loadedLocale["joinMUCJIDEntry"]))
|
||||||
jid_box.Append(jid_entry)
|
jid_box.Append(jid_entry)
|
||||||
|
|
||||||
nick_box.Append(gtk.NewLabel("Nick:"))
|
nick_box.Append(gtk.NewLabel(loadedLocale["joinMUCNickEntry"]))
|
||||||
nick_box.Append(nick_entry)
|
nick_box.Append(nick_entry)
|
||||||
|
|
||||||
disco_check.SetActive(true)
|
disco_check.SetActive(true)
|
||||||
disco_box.Append(gtk.NewLabel("Check MUC features before joining"))
|
disco_box.Append(gtk.NewLabel(loadedLocale["joinMUCDiscoCheck"]))
|
||||||
disco_box.Append(disco_check)
|
disco_box.Append(disco_check)
|
||||||
disco_box.SetTooltipText("If you are creating a MUC through this window then turn this off")
|
disco_box.SetTooltipText(loadedLocale["joinMUCDiscoCheckTooltip"])
|
||||||
|
|
||||||
box.Append(jid_box)
|
box.Append(jid_box)
|
||||||
box.Append(nick_box)
|
box.Append(nick_box)
|
||||||
box.Append(disco_box)
|
box.Append(disco_box)
|
||||||
|
|
||||||
btn := gtk.NewButtonWithLabel("Submit")
|
btn := gtk.NewButtonWithLabel(loadedLocale["submit"])
|
||||||
btn.SetVAlign(gtk.AlignBaseline)
|
btn.SetVAlign(gtk.AlignBaseline)
|
||||||
|
|
||||||
box.Append(btn)
|
box.Append(btn)
|
||||||
|
|
||||||
win := gtk.NewWindow()
|
win := gtk.NewWindow()
|
||||||
win.SetTitle("Join MUC")
|
win.SetTitle(loadedLocale["joinMUCMenu"])
|
||||||
win.SetDefaultSize(400, 1)
|
win.SetDefaultSize(400, 1)
|
||||||
win.SetResizable(false)
|
win.SetResizable(false)
|
||||||
win.SetChild(box)
|
win.SetChild(box)
|
||||||
@@ -829,11 +827,12 @@ func activate(app *gtk.Application) {
|
|||||||
password_protected := false
|
password_protected := false
|
||||||
password := ""
|
password := ""
|
||||||
warning_win := gtk.NewWindow()
|
warning_win := gtk.NewWindow()
|
||||||
warning_win.SetTitle(fmt.Sprintf("Joining %s", res.Identity[0].Name))
|
warning_win.SetTitle(fmt.Sprintf("%s%s", loadedLocale["joinPreviewTitle"], res.Identity[0].Name))
|
||||||
warning_win.SetDefaultSize(400, 400)
|
warning_win.SetDefaultSize(400, 1)
|
||||||
warning_win.SetResizable(false)
|
warning_win.SetResizable(false)
|
||||||
|
|
||||||
buttons := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
buttons := gtk.NewBox(gtk.OrientationHorizontal, 10)
|
||||||
|
|
||||||
join_button := gtk.NewButtonWithLabel("Join")
|
join_button := gtk.NewButtonWithLabel("Join")
|
||||||
join_button.ConnectClicked(func() {
|
join_button.ConnectClicked(func() {
|
||||||
warning_win.SetVisible(false)
|
warning_win.SetVisible(false)
|
||||||
@@ -841,13 +840,12 @@ func activate(app *gtk.Application) {
|
|||||||
allowed = false
|
allowed = false
|
||||||
|
|
||||||
password_win := gtk.NewWindow()
|
password_win := gtk.NewWindow()
|
||||||
password_win.SetTitle("Password required")
|
password_win.SetTitle(loadedLocale["joinPasswordRequired"])
|
||||||
password_win.SetDefaultSize(400, 1)
|
password_win.SetDefaultSize(400, 1)
|
||||||
password_win.SetResizable(false)
|
password_win.SetResizable(false)
|
||||||
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
box := gtk.NewBox(gtk.OrientationVertical, 10)
|
||||||
en := gtk.NewEntry()
|
en := gtk.NewPasswordEntry()
|
||||||
en.SetPlaceholderText("Password")
|
submit := gtk.NewButtonWithLabel(loadedLocale["submit"])
|
||||||
submit := gtk.NewButtonWithLabel("Submit")
|
|
||||||
submit.ConnectClicked(func() {
|
submit.ConnectClicked(func() {
|
||||||
password = en.Text()
|
password = en.Text()
|
||||||
jm(res.Identity[0].Name, password)
|
jm(res.Identity[0].Name, password)
|
||||||
@@ -862,79 +860,62 @@ func activate(app *gtk.Application) {
|
|||||||
jm(res.Identity[0].Name, password)
|
jm(res.Identity[0].Name, password)
|
||||||
})
|
})
|
||||||
|
|
||||||
cancel_button := gtk.NewButtonWithLabel("Cancel")
|
cancel_button := gtk.NewButtonWithLabel(loadedLocale["cancel"])
|
||||||
cancel_button.ConnectClicked(func() {
|
cancel_button.ConnectClicked(func() {
|
||||||
warning_win.SetVisible(false)
|
warning_win.SetVisible(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
join_button.SetHExpand(true)
|
||||||
|
cancel_button.SetHExpand(true)
|
||||||
|
|
||||||
buttons.Append(join_button)
|
buttons.Append(join_button)
|
||||||
buttons.Append(cancel_button)
|
buttons.Append(cancel_button)
|
||||||
warning_box := gtk.NewBox(gtk.OrientationVertical, 0)
|
warning_box := gtk.NewBox(gtk.OrientationVertical, 10)
|
||||||
header := gtk.NewLabel(res.Identity[0].Name)
|
header := gtk.NewLabel(res.Identity[0].Name)
|
||||||
warning_box.Append(header)
|
warning_box.Append(header)
|
||||||
|
addFeature := func(icon string, description string) {
|
||||||
|
box := gtk.NewBox(gtk.OrientationHorizontal, 10)
|
||||||
|
box.Append(gtk.NewImageFromPaintable(clientAssets[icon]))
|
||||||
|
box.Append(gtk.NewLabel(description))
|
||||||
|
warning_box.Append(box)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for _, feature := range features {
|
for _, feature := range features {
|
||||||
switch feature.Var {
|
switch feature.Var {
|
||||||
case "muc_passwordprotected":
|
case "muc_passwordprotected":
|
||||||
password_protected = true
|
password_protected = true
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_passwordprotected", loadedLocale["muc_passwordprotected_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_passwordprotected"]))
|
|
||||||
box.Append(gtk.NewLabel("This MUC is password-protected"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_unsecured":
|
case "muc_unsecured":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_unsecured", loadedLocale["muc_unsecured_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_unsecured"]))
|
|
||||||
box.Append(gtk.NewLabel("This MUC does not require a password"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_membersonly":
|
case "muc_membersonly":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_membersonly", loadedLocale["muc_membersonly_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_membersonly"]))
|
|
||||||
box.Append(gtk.NewLabel("Only members can join this MUC"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_open":
|
case "muc_open":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_open", loadedLocale["muc_open_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_open"]))
|
|
||||||
box.Append(gtk.NewLabel("Anyone can join this MUC"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_moderated":
|
case "muc_moderated":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_moderated", loadedLocale["muc_moderated_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_moderated"]))
|
|
||||||
box.Append(gtk.NewLabel("Only members can speak in this MUC"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_unmoderated":
|
case "muc_unmoderated":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_unmoderated", loadedLocale["muc_unmoderated_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_unmoderated"]))
|
|
||||||
box.Append(gtk.NewLabel("Anyone can speak in this MUC"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_nonanonymous":
|
case "muc_nonanonymous":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_nonanonymous", loadedLocale["muc_nonanonymous_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_nonanonymous"]))
|
|
||||||
box.Append(gtk.NewLabel("This MUC is non-anonymous, your JID will be visible to other users"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_semianonymous":
|
case "muc_semianonymous":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_semianonymous", loadedLocale["muc_semianonymous_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_semianonymous"]))
|
|
||||||
box.Append(gtk.NewLabel("This MUC is semi-anonymous, only moderators will see your full JID"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_persistent":
|
case "muc_persistent":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_persistent", loadedLocale["muc_persistent_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_persistent"]))
|
|
||||||
box.Append(gtk.NewLabel("This MUC is persistent, it will not be deleted when the last user leaves"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_temporary":
|
case "muc_temporary":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_temporary", loadedLocale["muc_temporary_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_temporary"]))
|
|
||||||
box.Append(gtk.NewLabel("This MUC is temporary, it will be deleted when the last user leaves"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_public":
|
case "muc_public":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_public", loadedLocale["muc_public_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_public"]))
|
|
||||||
box.Append(gtk.NewLabel("This MUC can be found in directories and search engines"))
|
|
||||||
warning_box.Append(box)
|
|
||||||
case "muc_hidden":
|
case "muc_hidden":
|
||||||
box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
addFeature("muc_hidden", loadedLocale["muc_hidden_description"])
|
||||||
box.Append(gtk.NewImageFromPaintable(clientAssets["muc_hidden"]))
|
case "urn:xmpp:mam:0":
|
||||||
box.Append(gtk.NewLabel("This MUC is hidden and cannot be found in directories or search engines"))
|
addFeature("ok", loadedLocale["urn:xmpp:mam_description"])
|
||||||
warning_box.Append(box)
|
case "urn:xmpp:message-moderate:0":
|
||||||
|
addFeature("moderate", loadedLocale["urn:xmpp:message-moderate_description"])
|
||||||
|
/*
|
||||||
|
default:
|
||||||
|
addFeature("comment", feature.Var)
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -944,9 +925,9 @@ func activate(app *gtk.Application) {
|
|||||||
} else {
|
} else {
|
||||||
allowed = false
|
allowed = false
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
showErrorDialog(fmt.Errorf("Failed to get disco info: %s - %s", result.Error.Reason, result.Error.Text))
|
showErrorDialog(fmt.Errorf("%s: %s - %s", loadedLocale["discoFail"], result.Error.Reason, result.Error.Text))
|
||||||
} else {
|
} else {
|
||||||
showErrorDialog(fmt.Errorf("Failed to get disco info"))
|
showErrorDialog(fmt.Errorf(loadedLocale["discoFail"]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -995,7 +976,7 @@ func activate(app *gtk.Application) {
|
|||||||
cBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
cBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
connectionIcon = gtk.NewImageFromPaintable((clientAssets["disconnect"]))
|
connectionIcon = gtk.NewImageFromPaintable((clientAssets["disconnect"]))
|
||||||
connectionIcon.AddCSSClass("icon")
|
connectionIcon.AddCSSClass("icon")
|
||||||
connectionStatus = gtk.NewLabel("Disconnected")
|
connectionStatus = gtk.NewLabel(loadedLocale["disconnected"])
|
||||||
|
|
||||||
cBox.Append(connectionIcon)
|
cBox.Append(connectionIcon)
|
||||||
cBox.Append(connectionStatus)
|
cBox.Append(connectionStatus)
|
||||||
@@ -1022,13 +1003,13 @@ func activate(app *gtk.Application) {
|
|||||||
statBar.Append(mBox)
|
statBar.Append(mBox)
|
||||||
|
|
||||||
pBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
pBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
pBox.SetTooltipText("Ping between you and your XMPP server\nRight-click to see graph")
|
pBox.SetTooltipText(loadedLocale["pingBarTooltip"])
|
||||||
gesture := gtk.NewGestureClick()
|
gesture := gtk.NewGestureClick()
|
||||||
gesture.SetButton(3)
|
gesture.SetButton(3)
|
||||||
gesture.Connect("pressed", func() {
|
gesture.Connect("pressed", func() {
|
||||||
opt := charts.NewLineChartOptionWithData(pingTimes)
|
opt := charts.NewLineChartOptionWithData(pingTimes)
|
||||||
opt.Title = charts.TitleOption{
|
opt.Title = charts.TitleOption{
|
||||||
Text: "Server latency",
|
Text: loadedLocale["pingGraphTitle"],
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
opt.XAxis.Labels = []string{
|
opt.XAxis.Labels = []string{
|
||||||
@@ -1037,7 +1018,7 @@ func activate(app *gtk.Application) {
|
|||||||
}*/
|
}*/
|
||||||
opt.Legend = charts.LegendOption{
|
opt.Legend = charts.LegendOption{
|
||||||
SeriesNames: []string{
|
SeriesNames: []string{
|
||||||
"Ping (ms)",
|
loadedLocale["pingGraphYAxis"],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1064,7 +1045,7 @@ func activate(app *gtk.Application) {
|
|||||||
i := gtk.NewPictureForPaintable(gdk.NewTextureForPixbuf(loader.Pixbuf()))
|
i := gtk.NewPictureForPaintable(gdk.NewTextureForPixbuf(loader.Pixbuf()))
|
||||||
win := gtk.NewWindow()
|
win := gtk.NewWindow()
|
||||||
win.SetDefaultSize(600, 400)
|
win.SetDefaultSize(600, 400)
|
||||||
win.SetTitle("Server latency")
|
win.SetTitle(loadedLocale["pingGraphTitle"])
|
||||||
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||||
box.Append(i)
|
box.Append(i)
|
||||||
win.SetChild(box)
|
win.SetChild(box)
|
||||||
@@ -1085,7 +1066,7 @@ func activate(app *gtk.Application) {
|
|||||||
sStatus = gtk.NewLabel("-")
|
sStatus = gtk.NewLabel("-")
|
||||||
sBox.Append(sIcon)
|
sBox.Append(sIcon)
|
||||||
sBox.Append(sStatus)
|
sBox.Append(sStatus)
|
||||||
sStatus.SetTooltipText("Throughput of your XMPP connection in KB/s")
|
sStatus.SetTooltipText(loadedLocale["throughputTooltip"])
|
||||||
statBar.Append(sBox)
|
statBar.Append(sBox)
|
||||||
|
|
||||||
scrollerStatBar := gtk.NewScrolledWindow()
|
scrollerStatBar := gtk.NewScrolledWindow()
|
||||||
@@ -1118,11 +1099,11 @@ func activate(app *gtk.Application) {
|
|||||||
entry_box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
entry_box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
|
|
||||||
oob_en := gtk.NewEntry()
|
oob_en := gtk.NewEntry()
|
||||||
oob_en.SetPlaceholderText("Embed URL")
|
oob_en.SetPlaceholderText("URL")
|
||||||
|
|
||||||
message_en = gtk.NewEntry()
|
message_en = gtk.NewEntry()
|
||||||
message_en.SetPlaceholderText("Say something, what else are you gonna do here?")
|
message_en.SetPlaceholderText(loadedLocale["messageEntryPlaceholder"])
|
||||||
b := gtk.NewButtonWithLabel("Send")
|
b := gtk.NewButtonWithLabel(loadedLocale["send"])
|
||||||
|
|
||||||
sendtxt := func() {
|
sendtxt := func() {
|
||||||
t := message_en.Text()
|
t := message_en.Text()
|
||||||
|
|||||||
Reference in New Issue
Block a user