This commit is contained in:
Tulir Asokan 2018-05-22 17:24:47 +03:00
parent cce79ab7d8
commit cc28c7b65f
13 changed files with 63 additions and 64 deletions

View File

@ -21,13 +21,13 @@ import (
"os"
"path/filepath"
"gopkg.in/yaml.v2"
"maunium.net/go/gomuks/debug"
"maunium.net/go/gomuks/matrix/rooms"
"maunium.net/go/gomuks/matrix/pushrules"
"encoding/json"
"strings"
"gopkg.in/yaml.v2"
"maunium.net/go/gomatrix"
"maunium.net/go/gomuks/debug"
"maunium.net/go/gomuks/matrix/pushrules"
"maunium.net/go/gomuks/matrix/rooms"
"strings"
)
// Config contains the main config of gomuks.

View File

@ -337,7 +337,7 @@ func (c *Container) HandleReadReceipt(source EventSource, evt *gomatrix.Event) {
c.ui.Render()
}
func (c *Container) parseDirectChatInfo(evt *gomatrix.Event) (map[*rooms.Room]bool){
func (c *Container) parseDirectChatInfo(evt *gomatrix.Event) map[*rooms.Room]bool {
directChats := make(map[*rooms.Room]bool)
for _, rawRoomIDList := range evt.Content {
roomIDList, ok := rawRoomIDList.([]interface{})

View File

@ -17,16 +17,16 @@
package matrix
import (
"testing"
"maunium.net/go/gomuks/config"
"github.com/stretchr/testify/assert"
"net/http"
"maunium.net/go/gomatrix"
"strings"
"fmt"
"io/ioutil"
"encoding/json"
"fmt"
"github.com/stretchr/testify/assert"
"io/ioutil"
"maunium.net/go/gomatrix"
"maunium.net/go/gomuks/config"
"net/http"
"os"
"strings"
"testing"
)
func TestContainer_InitClient_Empty(t *testing.T) {

View File

@ -21,8 +21,8 @@ import (
"strconv"
"strings"
"maunium.net/go/gomuks/lib/glob"
"maunium.net/go/gomatrix"
"maunium.net/go/gomuks/lib/glob"
"maunium.net/go/gomuks/matrix/rooms"
)

View File

@ -17,9 +17,9 @@
package pushrules
import (
"maunium.net/go/gomuks/lib/glob"
"maunium.net/go/gomatrix"
"encoding/gob"
"maunium.net/go/gomatrix"
"maunium.net/go/gomuks/lib/glob"
)
func init() {

View File

@ -17,9 +17,9 @@
package pushrules_test
import (
"testing"
"maunium.net/go/gomuks/matrix/pushrules"
"github.com/stretchr/testify/assert"
"maunium.net/go/gomuks/matrix/pushrules"
"testing"
)
func TestPushRuleArray_GetActions_FirstMatchReturns(t *testing.T) {

View File

@ -17,9 +17,9 @@
package pushrules_test
import (
"testing"
"github.com/stretchr/testify/assert"
"maunium.net/go/gomuks/matrix/pushrules"
"testing"
)
func TestPushRule_Match_Conditions(t *testing.T) {
@ -148,7 +148,6 @@ func TestPushRule_Match_Room_Fail(t *testing.T) {
assert.False(t, rule.Match(blankTestRoom, event))
}
func TestPushRule_Match_Sender(t *testing.T) {
rule := &pushrules.PushRule{
Type: pushrules.SenderRule,

View File

@ -22,10 +22,10 @@ import (
"sync"
"time"
"encoding/gob"
"maunium.net/go/gomatrix"
"maunium.net/go/gomuks/debug"
"os"
"encoding/gob"
)
func init() {

View File

@ -72,10 +72,10 @@ func (s *GomuksSyncer) ProcessResponse(res *gomatrix.RespSync, since string) (er
for roomID, roomData := range res.Rooms.Join {
room := s.Session.GetRoom(roomID)
s.processSyncEvents(room, roomData.State.Events, EventSourceJoin | EventSourceState, false)
s.processSyncEvents(room, roomData.Timeline.Events, EventSourceJoin | EventSourceTimeline, false)
s.processSyncEvents(room, roomData.Ephemeral.Events, EventSourceJoin | EventSourceEphemeral, false)
s.processSyncEvents(room, roomData.AccountData.Events, EventSourceJoin | EventSourceAccountData, false)
s.processSyncEvents(room, roomData.State.Events, EventSourceJoin|EventSourceState, false)
s.processSyncEvents(room, roomData.Timeline.Events, EventSourceJoin|EventSourceTimeline, false)
s.processSyncEvents(room, roomData.Ephemeral.Events, EventSourceJoin|EventSourceEphemeral, false)
s.processSyncEvents(room, roomData.AccountData.Events, EventSourceJoin|EventSourceAccountData, false)
if len(room.PrevBatch) == 0 {
room.PrevBatch = roomData.Timeline.PrevBatch
@ -84,14 +84,14 @@ func (s *GomuksSyncer) ProcessResponse(res *gomatrix.RespSync, since string) (er
for roomID, roomData := range res.Rooms.Invite {
room := s.Session.GetRoom(roomID)
s.processSyncEvents(room, roomData.State.Events, EventSourceInvite | EventSourceState, false)
s.processSyncEvents(room, roomData.State.Events, EventSourceInvite|EventSourceState, false)
}
for roomID, roomData := range res.Rooms.Leave {
room := s.Session.GetRoom(roomID)
room.HasLeft = true
s.processSyncEvents(room, roomData.State.Events, EventSourceLeave | EventSourceState, true)
s.processSyncEvents(room, roomData.Timeline.Events, EventSourceLeave | EventSourceTimeline, false)
s.processSyncEvents(room, roomData.State.Events, EventSourceLeave|EventSourceState, true)
s.processSyncEvents(room, roomData.Timeline.Events, EventSourceLeave|EventSourceTimeline, false)
if len(room.PrevBatch) == 0 {
room.PrevBatch = roomData.Timeline.PrevBatch

View File

@ -22,11 +22,11 @@ import (
"strconv"
"github.com/evidlo/fuzzysearch/fuzzy"
"maunium.net/go/gomuks/debug"
"maunium.net/go/gomuks/matrix/rooms"
"maunium.net/go/gomuks/ui/widget"
"maunium.net/go/tview"
"maunium.net/go/tcell"
"maunium.net/go/gomuks/debug"
"maunium.net/go/tview"
)
type FuzzySearchModal struct {

View File

@ -22,12 +22,12 @@ import (
"strconv"
"strings"
"math"
"maunium.net/go/gomuks/debug"
"maunium.net/go/gomuks/matrix/rooms"
"maunium.net/go/gomuks/ui/widget"
"maunium.net/go/tcell"
"maunium.net/go/tview"
"math"
)
type orderedRoom struct {
@ -446,7 +446,7 @@ func (list *RoomList) Previous() (string, *rooms.Room) {
indexInvisible := tagRoomList.Index(list.selected)
if index == -1 && indexInvisible >= 0 {
num := tagRoomList.TotalLength() - indexInvisible
tagRoomList.maxShown = int(math.Ceil(float64(num) / 10.0) * 10.0)
tagRoomList.maxShown = int(math.Ceil(float64(num)/10.0) * 10.0)
index = tagRoomList.IndexVisible(list.selected)
}
@ -479,7 +479,7 @@ func (list *RoomList) Next() (string, *rooms.Room) {
indexInvisible := tagRoomList.Index(list.selected)
if index == -1 && indexInvisible >= 0 {
num := tagRoomList.TotalLength() - indexInvisible + 1
tagRoomList.maxShown = int(math.Ceil(float64(num) / 10.0) * 10.0)
tagRoomList.maxShown = int(math.Ceil(float64(num)/10.0) * 10.0)
index = tagRoomList.IndexVisible(list.selected)
}

View File

@ -17,8 +17,8 @@
package widget
import (
"maunium.net/go/tview"
"maunium.net/go/tcell"
"maunium.net/go/tview"
)
// Center wraps the given tview primitive into a Flex element in order to

View File

@ -17,10 +17,10 @@
package widget
import (
"fmt"
"github.com/mattn/go-runewidth"
"maunium.net/go/tcell"
"maunium.net/go/tview"
"fmt"
"strconv"
)