Update dependencies
This commit is contained in:
parent
706f4c4404
commit
66b17967eb
8
Gopkg.lock
generated
8
Gopkg.lock
generated
@ -10,8 +10,8 @@
|
||||
[[projects]]
|
||||
name = "github.com/disintegration/imaging"
|
||||
packages = ["."]
|
||||
revision = "fd34ef7671b12cdf1b024d98c6b327b2770d32c4"
|
||||
version = "v1.4.1"
|
||||
revision = "bbcee2f5c9d5e94ca42c8b50ec847fec64a6c134"
|
||||
version = "v1.4.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@ -82,7 +82,7 @@
|
||||
"html",
|
||||
"html/atom"
|
||||
]
|
||||
revision = "640f4622ab692b87c2f3a94265e6f579fe38263d"
|
||||
revision = "f73e4c9ed3b7ebdd5f699a16a880c2b1994e50dd"
|
||||
|
||||
[[projects]]
|
||||
name = "golang.org/x/text"
|
||||
@ -118,7 +118,7 @@
|
||||
branch = "master"
|
||||
name = "maunium.net/go/gomatrix"
|
||||
packages = ["."]
|
||||
revision = "618319f327acbd401426c711f54e1a634e2243e4"
|
||||
revision = "4ddf8d780ff6a0434a52c256015f7fcd2ca67dc9"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -148,32 +148,36 @@ func (s *GomuksSyncer) OnFailedSync(res *gomatrix.RespSync, err error) (time.Dur
|
||||
|
||||
// GetFilterJSON returns a filter with a timeline limit of 50.
|
||||
func (s *GomuksSyncer) GetFilterJSON(userID string) json.RawMessage {
|
||||
return json.RawMessage(`{
|
||||
"room": {
|
||||
"include_leave": false,
|
||||
"state": {
|
||||
"types": [
|
||||
filter := &gomatrix.Filter{
|
||||
Room: gomatrix.RoomFilter{
|
||||
IncludeLeave: false,
|
||||
State: gomatrix.FilterPart{
|
||||
Types: []string{
|
||||
"m.room.member",
|
||||
"m.room.name",
|
||||
"m.room.topic",
|
||||
"m.room.canonical_alias",
|
||||
"m.room.aliases"
|
||||
]
|
||||
"m.room.aliases",
|
||||
},
|
||||
},
|
||||
"timeline": {
|
||||
"types": ["m.room.message"],
|
||||
"limit": 50
|
||||
Timeline: gomatrix.FilterPart{
|
||||
Types: []string{"m.room.message"},
|
||||
Limit: 50,
|
||||
},
|
||||
"ephemeral": {
|
||||
"types": ["m.typing"]
|
||||
Ephemeral: gomatrix.FilterPart{
|
||||
Types: []string{"m.typing"},
|
||||
},
|
||||
AccountData: gomatrix.FilterPart{
|
||||
Types: []string{"m.tag"},
|
||||
},
|
||||
"account_data": {
|
||||
"types": ["m.tag"]
|
||||
}
|
||||
},
|
||||
"account_data": {
|
||||
"types": ["m.push_rules"]
|
||||
AccountData: gomatrix.FilterPart{
|
||||
Types: []string{"m.push_rules"},
|
||||
},
|
||||
"presence": {"types": []}
|
||||
}`)
|
||||
Presence: gomatrix.FilterPart{
|
||||
Types: []string{},
|
||||
},
|
||||
}
|
||||
rawFilter, _ := json.Marshal(&filter)
|
||||
return rawFilter
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ func TestGomuksSyncer_ProcessResponse(t *testing.T) {
|
||||
syncer := matrix.NewGomuksSyncer(mss)
|
||||
syncer.OnEventType("m.room.member", ml.receive)
|
||||
syncer.OnEventType("m.room.message", ml.receive)
|
||||
syncer.GetFilterJSON("@tulir:maunium.net")
|
||||
|
||||
joinEvt := &gomatrix.Event{
|
||||
ID: "!join:maunium.net",
|
||||
|
68
vendor/github.com/disintegration/imaging/helpers.go
generated
vendored
68
vendor/github.com/disintegration/imaging/helpers.go
generated
vendored
@ -1,6 +1,7 @@
|
||||
package imaging
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"image"
|
||||
"image/color"
|
||||
@ -46,6 +47,26 @@ func (f Format) String() string {
|
||||
}
|
||||
}
|
||||
|
||||
var formatFromExt = map[string]Format{
|
||||
".jpg": JPEG,
|
||||
".jpeg": JPEG,
|
||||
".png": PNG,
|
||||
".tif": TIFF,
|
||||
".tiff": TIFF,
|
||||
".bmp": BMP,
|
||||
".gif": GIF,
|
||||
}
|
||||
|
||||
// FormatFromFilename parses image format from filename extension:
|
||||
// "jpg" (or "jpeg"), "png", "gif", "tif" (or "tiff") and "bmp" are supported.
|
||||
func FormatFromFilename(filename string) (Format, error) {
|
||||
ext := strings.ToLower(filepath.Ext(filename))
|
||||
if f, ok := formatFromExt[ext]; ok {
|
||||
return f, nil
|
||||
}
|
||||
return -1, ErrUnsupportedFormat
|
||||
}
|
||||
|
||||
var (
|
||||
// ErrUnsupportedFormat means the given image format (or file extension) is unsupported.
|
||||
ErrUnsupportedFormat = errors.New("imaging: unsupported image format")
|
||||
@ -199,22 +220,10 @@ func Encode(w io.Writer, img image.Image, format Format, opts ...EncodeOption) e
|
||||
// err := imaging.Save(img, "out.jpg", imaging.JPEGQuality(80))
|
||||
//
|
||||
func Save(img image.Image, filename string, opts ...EncodeOption) (err error) {
|
||||
formats := map[string]Format{
|
||||
".jpg": JPEG,
|
||||
".jpeg": JPEG,
|
||||
".png": PNG,
|
||||
".tif": TIFF,
|
||||
".tiff": TIFF,
|
||||
".bmp": BMP,
|
||||
".gif": GIF,
|
||||
f, err := FormatFromFilename(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ext := strings.ToLower(filepath.Ext(filename))
|
||||
f, ok := formats[ext]
|
||||
if !ok {
|
||||
return ErrUnsupportedFormat
|
||||
}
|
||||
|
||||
file, err := fs.Create(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -236,33 +245,16 @@ func New(width, height int, fillColor color.Color) *image.NRGBA {
|
||||
return &image.NRGBA{}
|
||||
}
|
||||
|
||||
dst := image.NewNRGBA(image.Rect(0, 0, width, height))
|
||||
c := color.NRGBAModel.Convert(fillColor).(color.NRGBA)
|
||||
|
||||
if c.R == 0 && c.G == 0 && c.B == 0 && c.A == 0 {
|
||||
return dst
|
||||
if (c == color.NRGBA{0, 0, 0, 0}) {
|
||||
return image.NewNRGBA(image.Rect(0, 0, width, height))
|
||||
}
|
||||
|
||||
// Fill the first row.
|
||||
i := 0
|
||||
for x := 0; x < width; x++ {
|
||||
dst.Pix[i+0] = c.R
|
||||
dst.Pix[i+1] = c.G
|
||||
dst.Pix[i+2] = c.B
|
||||
dst.Pix[i+3] = c.A
|
||||
i += 4
|
||||
return &image.NRGBA{
|
||||
Pix: bytes.Repeat([]byte{c.R, c.G, c.B, c.A}, width*height),
|
||||
Stride: 4 * width,
|
||||
Rect: image.Rect(0, 0, width, height),
|
||||
}
|
||||
|
||||
// Copy the first row to other rows.
|
||||
size := width * 4
|
||||
parallel(1, height, func(ys <-chan int) {
|
||||
for y := range ys {
|
||||
i = y * dst.Stride
|
||||
copy(dst.Pix[i:i+size], dst.Pix[0:size])
|
||||
}
|
||||
})
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
// Clone returns a copy of the given image.
|
||||
|
4154
vendor/golang.org/x/net/html/entity.go
generated
vendored
4154
vendor/golang.org/x/net/html/entity.go
generated
vendored
File diff suppressed because it is too large
Load Diff
2
vendor/maunium.net/go/gomatrix/client.go
generated
vendored
2
vendor/maunium.net/go/gomatrix/client.go
generated
vendored
@ -529,7 +529,7 @@ func (cli *Client) ForgetRoom(roomID string) (resp *RespForgetRoom, err error) {
|
||||
// InviteUser invites a user to a room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite
|
||||
func (cli *Client) InviteUser(roomID string, req *ReqInviteUser) (resp *RespInviteUser, err error) {
|
||||
u := cli.BuildURL("rooms", roomID, "invite")
|
||||
_, err = cli.MakeRequest("POST", u, struct{}{}, &resp)
|
||||
_, err = cli.MakeRequest("POST", u, req, &resp)
|
||||
return
|
||||
}
|
||||
|
||||
|
81
vendor/maunium.net/go/gomatrix/filter.go
generated
vendored
81
vendor/maunium.net/go/gomatrix/filter.go
generated
vendored
@ -14,6 +14,8 @@
|
||||
|
||||
package gomatrix
|
||||
|
||||
import "errors"
|
||||
|
||||
//Filter is used by clients to specify how the server should filter responses to e.g. sync requests
|
||||
//Specified by: https://matrix.org/docs/spec/client_server/r0.2.0.html#filtering
|
||||
type Filter struct {
|
||||
@ -21,23 +23,68 @@ type Filter struct {
|
||||
EventFields []string `json:"event_fields,omitempty"`
|
||||
EventFormat string `json:"event_format,omitempty"`
|
||||
Presence FilterPart `json:"presence,omitempty"`
|
||||
Room struct {
|
||||
AccountData FilterPart `json:"account_data,omitempty"`
|
||||
Ephemeral FilterPart `json:"ephemeral,omitempty"`
|
||||
IncludeLeave bool `json:"include_leave,omitempty"`
|
||||
NotRooms []string `json:"not_rooms,omitempty"`
|
||||
Rooms []string `json:"rooms,omitempty"`
|
||||
State FilterPart `json:"state,omitempty"`
|
||||
Timeline FilterPart `json:"timeline,omitempty"`
|
||||
} `json:"room,omitempty"`
|
||||
Room RoomFilter `json:"room,omitempty"`
|
||||
}
|
||||
|
||||
type FilterPart struct {
|
||||
NotRooms []string `json:"not_rooms,omitempty"`
|
||||
Rooms []string `json:"rooms,omitempty"`
|
||||
Limit *int `json:"limit,omitempty"`
|
||||
NotSenders []string `json:"not_senders,omitempty"`
|
||||
NotTypes []string `json:"not_types,omitempty"`
|
||||
Senders []string `json:"senders,omitempty"`
|
||||
Types []string `json:"types,omitempty"`
|
||||
// RoomFilter is used to define filtering rules for room events
|
||||
type RoomFilter struct {
|
||||
AccountData FilterPart `json:"account_data,omitempty"`
|
||||
Ephemeral FilterPart `json:"ephemeral,omitempty"`
|
||||
IncludeLeave bool `json:"include_leave,omitempty"`
|
||||
NotRooms []string `json:"not_rooms,omitempty"`
|
||||
Rooms []string `json:"rooms,omitempty"`
|
||||
State FilterPart `json:"state,omitempty"`
|
||||
Timeline FilterPart `json:"timeline,omitempty"`
|
||||
}
|
||||
|
||||
// FilterPart is used to define filtering rules for specific categories of events
|
||||
type FilterPart struct {
|
||||
NotRooms []string `json:"not_rooms,omitempty"`
|
||||
Rooms []string `json:"rooms,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
NotSenders []string `json:"not_senders,omitempty"`
|
||||
NotTypes []string `json:"not_types,omitempty"`
|
||||
Senders []string `json:"senders,omitempty"`
|
||||
Types []string `json:"types,omitempty"`
|
||||
ContainsURL *bool `json:"contains_url,omitempty"`
|
||||
}
|
||||
|
||||
// Validate checks if the filter contains valid property values
|
||||
func (filter *Filter) Validate() error {
|
||||
if filter.EventFormat != "client" && filter.EventFormat != "federation" {
|
||||
return errors.New("Bad event_format value. Must be one of [\"client\", \"federation\"]")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DefaultFilter returns the default filter used by the Matrix server if no filter is provided in the request
|
||||
func DefaultFilter() Filter {
|
||||
return Filter{
|
||||
AccountData: DefaultFilterPart(),
|
||||
EventFields: nil,
|
||||
EventFormat: "client",
|
||||
Presence: DefaultFilterPart(),
|
||||
Room: RoomFilter{
|
||||
AccountData: DefaultFilterPart(),
|
||||
Ephemeral: DefaultFilterPart(),
|
||||
IncludeLeave: false,
|
||||
NotRooms: nil,
|
||||
Rooms: nil,
|
||||
State: DefaultFilterPart(),
|
||||
Timeline: DefaultFilterPart(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultFilterPart returns the default filter part used by the Matrix server if no filter is provided in the request
|
||||
func DefaultFilterPart() FilterPart {
|
||||
return FilterPart{
|
||||
NotRooms: nil,
|
||||
Rooms: nil,
|
||||
Limit: 20,
|
||||
NotSenders: nil,
|
||||
NotTypes: nil,
|
||||
Senders: nil,
|
||||
Types: nil,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user