forked from sunglocto/pi-im
Compare commits
4 Commits
nyx-patch-
...
master
Author | SHA1 | Date | |
---|---|---|---|
ea47f10b5c | |||
91215094e4 | |||
082d2757f6 | |||
596bd6bdba |
45
main.go
45
main.go
@@ -43,7 +43,8 @@ var version string = "3i"
|
||||
var statBar widget.Label
|
||||
var chatInfo fyne.Container
|
||||
var chatSidebar fyne.Container
|
||||
|
||||
var replyNameIcon string = ">"
|
||||
var replyBodyIcon string = ">"
|
||||
var agreesToSendingHotFuckIntoChannel bool = false
|
||||
|
||||
// by sunglocto
|
||||
@@ -79,6 +80,17 @@ type CustomMultiLineEntry struct {
|
||||
widget.Entry
|
||||
}
|
||||
|
||||
func isUTF8Locale() bool {
|
||||
localeVars := []string{"LC_ALL", "LC_CTYPE", "LANG"}
|
||||
for _, envVar := range localeVars {
|
||||
value := os.Getenv(envVar)
|
||||
if strings.Contains(strings.ToLower(value), "utf-8") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func NewCustomMultiLineEntry() *CustomMultiLineEntry {
|
||||
entry := &CustomMultiLineEntry{}
|
||||
entry.ExtendBaseWidget(entry)
|
||||
@@ -249,13 +261,13 @@ func CreateUITab(chatJidStr string) ChatTabUI {
|
||||
for i := len(chatTabs[chatJidStr].Messages) - 1; i >= 0; i-- {
|
||||
if reply.ID == chatTabs[chatJidStr].Messages[i].Raw.StanzaID.ID {
|
||||
replytext.Show()
|
||||
replytext.SetText(fmt.Sprintf(">%s", chatTabs[chatJidStr].Messages[i].Content))
|
||||
replytext.SetText(fmt.Sprintf("%s %s", replyBodyIcon, chatTabs[chatJidStr].Messages[i].Content))
|
||||
guy = chatTabs[chatJidStr].Messages[i].Author
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
author.SetText(fmt.Sprintf("%s > %s", chatTabs[chatJidStr].Messages[i].Author, guy))
|
||||
author.SetText(fmt.Sprintf("%s %s %s", chatTabs[chatJidStr].Messages[i].Author, replyNameIcon, guy))
|
||||
} else {
|
||||
author.SetText(chatTabs[chatJidStr].Messages[i].Author)
|
||||
replytext.Hide()
|
||||
@@ -422,6 +434,11 @@ func main() {
|
||||
login = config.Login
|
||||
notifications = config.Notifications
|
||||
|
||||
if isUTF8Locale() {
|
||||
replyBodyIcon = "↱"
|
||||
replyNameIcon = "→ "
|
||||
}
|
||||
|
||||
client, err := oasisSdk.CreateClient(
|
||||
&login)
|
||||
|
||||
@@ -714,13 +731,21 @@ func main() {
|
||||
dialog.ShowError(err, w)
|
||||
}
|
||||
return
|
||||
} else {
|
||||
err = client.SendText(jid.MustParse(activeMucJid).Bare(), text)
|
||||
|
||||
if err != nil {
|
||||
dialog.ShowError(err, w)
|
||||
}
|
||||
|
||||
}
|
||||
}, w)
|
||||
}
|
||||
err = client.SendText(jid.MustParse(activeMucJid).Bare(), text)
|
||||
} else {
|
||||
err = client.SendText(jid.MustParse(activeMucJid).Bare(), text)
|
||||
|
||||
if err != nil {
|
||||
dialog.ShowError(err, w)
|
||||
if err != nil {
|
||||
dialog.ShowError(err, w)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -1147,14 +1172,14 @@ func main() {
|
||||
album, al_ok := player.RawMetadata()["xesam:album"]
|
||||
artists := []string{}
|
||||
|
||||
if a_ok{
|
||||
if a_ok {
|
||||
artist.Store(&artists)
|
||||
}
|
||||
|
||||
if t_ok && a_ok && al_ok && album.String() != "\"\""{
|
||||
if t_ok && a_ok && al_ok && album.String() != "\"\"" {
|
||||
newtext = fmt.Sprintf("I'm currently listening to %s by %s, in the %s album", strings.Trim(title.String(), "\""), strings.Join(artists, ","), album)
|
||||
} else if t_ok && a_ok {
|
||||
newtext = fmt.Sprintf("I'm currently listening to %s by %s", strings.Trim(title.String(), "\""), strings.Join(artists, ",") )
|
||||
newtext = fmt.Sprintf("I'm currently listening to %s by %s", strings.Trim(title.String(), "\""), strings.Join(artists, ","))
|
||||
} else if t_ok {
|
||||
newtext = fmt.Sprintf("I'm currently listening to %s", strings.Trim(title.String(), "\""))
|
||||
} else if a_ok {
|
||||
|
Reference in New Issue
Block a user