refactor
This commit is contained in:
25
main.go
25
main.go
@@ -86,6 +86,10 @@ func isUTF8Locale() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isWindows() bool {
|
||||||
|
return os.PathSeparator == '\\' && os.PathListSeparator == ';'
|
||||||
|
}
|
||||||
|
|
||||||
func NewCustomMultiLineEntry() *CustomMultiLineEntry {
|
func NewCustomMultiLineEntry() *CustomMultiLineEntry {
|
||||||
entry := &CustomMultiLineEntry{}
|
entry := &CustomMultiLineEntry{}
|
||||||
entry.ExtendBaseWidget(entry)
|
entry.ExtendBaseWidget(entry)
|
||||||
@@ -200,7 +204,7 @@ func CreateUITab(chatJidStr string) ChatTabUI {
|
|||||||
content := vbox.Objects[2].(*widget.Label)
|
content := vbox.Objects[2].(*widget.Label)
|
||||||
btn := vbox.Objects[3].(*widget.Button)
|
btn := vbox.Objects[3].(*widget.Button)
|
||||||
if chatTabs[chatJidStr].Messages[i].Important {
|
if chatTabs[chatJidStr].Messages[i].Important {
|
||||||
//content.Importance = widget.DangerImportance TODO: Fix highlighting messages with mentions, it's currently broken
|
content.Importance = widget.DangerImportance
|
||||||
}
|
}
|
||||||
btn.Hidden = true // Hide by default
|
btn.Hidden = true // Hide by default
|
||||||
msgContent := chatTabs[chatJidStr].Messages[i].Content
|
msgContent := chatTabs[chatJidStr].Messages[i].Content
|
||||||
@@ -537,7 +541,7 @@ func main() {
|
|||||||
chatTabs[mucJidStr].Muc = muc
|
chatTabs[mucJidStr].Muc = muc
|
||||||
str := *msg.CleanedBody
|
str := *msg.CleanedBody
|
||||||
if strings.Contains(str, login.DisplayName) {
|
if strings.Contains(str, login.DisplayName) {
|
||||||
fmt.Println(str)
|
fmt.Println(str, login.DisplayName)
|
||||||
important = true
|
important = true
|
||||||
}
|
}
|
||||||
if !donotnotify && !ignore && notifications {
|
if !donotnotify && !ignore && notifications {
|
||||||
@@ -560,9 +564,7 @@ func main() {
|
|||||||
lines[i] = strings.Join(s, " ")
|
lines[i] = strings.Join(s, " ")
|
||||||
}
|
}
|
||||||
str = strings.Join(lines, " ")
|
str = strings.Join(lines, " ")
|
||||||
fmt.Println(str)
|
|
||||||
}
|
}
|
||||||
fmt.Println(msg.ID)
|
|
||||||
var replyID string
|
var replyID string
|
||||||
if msg.Reply == nil {
|
if msg.Reply == nil {
|
||||||
replyID = "PICLIENT:UNAVAILABLE"
|
replyID = "PICLIENT:UNAVAILABLE"
|
||||||
@@ -637,7 +639,6 @@ func main() {
|
|||||||
func(_ *oasisSdk.XmppClient, from jid.JID, id string) {
|
func(_ *oasisSdk.XmppClient, from jid.JID, id string) {
|
||||||
for _, tab := range chatTabs {
|
for _, tab := range chatTabs {
|
||||||
for i := len(tab.Messages) - 1; i >= 0; i-- {
|
for i := len(tab.Messages) - 1; i >= 0; i-- {
|
||||||
fmt.Println(tab.Messages[i])
|
|
||||||
if tab.Messages[i].Raw.StanzaID == nil {
|
if tab.Messages[i].Raw.StanzaID == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -647,7 +648,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Printf("%s has seen %s\n", from.String(), id)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -709,7 +709,6 @@ func main() {
|
|||||||
go func() {
|
go func() {
|
||||||
if replying {
|
if replying {
|
||||||
m := chatTabs[activeMucJid].Messages[selectedId].Raw
|
m := chatTabs[activeMucJid].Messages[selectedId].Raw
|
||||||
fmt.Println(selectedId)
|
|
||||||
err = client.ReplyToEvent(&m, text)
|
err = client.ReplyToEvent(&m, text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dialog.ShowError(err, w)
|
dialog.ShowError(err, w)
|
||||||
@@ -808,14 +807,6 @@ func main() {
|
|||||||
}, w)
|
}, w)
|
||||||
})
|
})
|
||||||
|
|
||||||
mis := fyne.NewMenuItem("clear chat window", func() {
|
|
||||||
dialog.ShowConfirm("clear chat window", "are you sure you want to clear the chat window?", func(b bool) {
|
|
||||||
if b {
|
|
||||||
fmt.Println("clearing chat")
|
|
||||||
}
|
|
||||||
}, w)
|
|
||||||
})
|
|
||||||
|
|
||||||
jtb := fyne.NewMenuItem("jump to bottom", func() {
|
jtb := fyne.NewMenuItem("jump to bottom", func() {
|
||||||
selectedScroller, ok := AppTabs.Selected().Content.(*widget.List)
|
selectedScroller, ok := AppTabs.Selected().Content.(*widget.List)
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -1107,7 +1098,7 @@ func main() {
|
|||||||
menu_help := fyne.NewMenu("π", mit, reconnect, licensesbtn, savedata)
|
menu_help := fyne.NewMenu("π", mit, reconnect, licensesbtn, savedata)
|
||||||
|
|
||||||
menu_changeroom := fyne.NewMenu("Α", mic, beginADM, joinARoom, leaveRoom, jbookmarks)
|
menu_changeroom := fyne.NewMenu("Α", mic, beginADM, joinARoom, leaveRoom, jbookmarks)
|
||||||
menu_configureview := fyne.NewMenu("Β", mia, mis, jtt, jtb)
|
menu_configureview := fyne.NewMenu("Β", mia, jtt, jtb)
|
||||||
hafjag := fyne.NewMenuItem("Hafjag", func() {
|
hafjag := fyne.NewMenuItem("Hafjag", func() {
|
||||||
entry.Text = "Hafjag"
|
entry.Text = "Hafjag"
|
||||||
SendCallback()
|
SendCallback()
|
||||||
@@ -1146,7 +1137,7 @@ func main() {
|
|||||||
|
|
||||||
mycurrentplayingsong := fyne.NewMenuItem("Get currently playing song", func() {
|
mycurrentplayingsong := fyne.NewMenuItem("Get currently playing song", func() {
|
||||||
// BEGIN PLATFORM SPECIFIC CODE
|
// BEGIN PLATFORM SPECIFIC CODE
|
||||||
if os.PathSeparator == '\\' && os.PathListSeparator == ';' { // Windows
|
if isWindows() {
|
||||||
dialog.ShowError(errors.New("This feature is not supported on your operating system"), w)
|
dialog.ShowError(errors.New("This feature is not supported on your operating system"), w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user