diff options
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go | 1 | ||||
-rw-r--r-- | vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go | 68 | ||||
-rw-r--r-- | vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go | 87 | ||||
-rw-r--r-- | vendor/github.com/lrstanley/girc/README.md | 2 | ||||
-rw-r--r-- | vendor/github.com/lrstanley/girc/builtin.go | 48 | ||||
-rw-r--r-- | vendor/github.com/lrstanley/girc/cap_tags.go | 2 | ||||
-rw-r--r-- | vendor/github.com/lrstanley/girc/client.go | 45 | ||||
-rw-r--r-- | vendor/github.com/lrstanley/girc/commands.go | 6 | ||||
-rw-r--r-- | vendor/github.com/lrstanley/girc/conn.go | 11 | ||||
-rw-r--r-- | vendor/github.com/lrstanley/girc/constants.go | 31 | ||||
-rw-r--r-- | vendor/github.com/lrstanley/girc/ctcp.go | 18 | ||||
-rw-r--r-- | vendor/github.com/lrstanley/girc/event.go | 11 | ||||
-rw-r--r-- | vendor/github.com/lrstanley/girc/state.go | 10 | ||||
-rw-r--r-- | vendor/github.com/matterbridge/gomatrix/client.go | 14 | ||||
-rw-r--r-- | vendor/github.com/matterbridge/gomatrix/events.go | 6 | ||||
-rw-r--r-- | vendor/modules.txt | 6 |
16 files changed, 300 insertions, 66 deletions
diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go index d56aaf82..85e16c19 100644 --- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go +++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go @@ -526,6 +526,7 @@ func (bot *BotAPI) ListenForWebhook(pattern string) UpdatesChannel { http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) { bytes, _ := ioutil.ReadAll(r.Body) + r.Body.Close() var update Update json.Unmarshal(bytes, &update) diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go index f49cbbab..3dabe11e 100644 --- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go +++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go @@ -459,6 +459,15 @@ func NewInlineQueryResultGIF(id, url string) InlineQueryResultGIF { } } +// NewInlineQueryResultCachedGIF create a new inline query with cached photo. +func NewInlineQueryResultCachedGIF(id, gifID string) InlineQueryResultCachedGIF { + return InlineQueryResultCachedGIF{ + Type: "gif", + ID: id, + GifID: gifID, + } +} + // NewInlineQueryResultMPEG4GIF creates a new inline query MPEG4 GIF. func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF { return InlineQueryResultMPEG4GIF{ @@ -468,6 +477,15 @@ func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF { } } +// NewInlineQueryResultCachedPhoto create a new inline query with cached photo. +func NewInlineQueryResultCachedMPEG4GIF(id, MPEG4GifID string) InlineQueryResultCachedMpeg4Gif { + return InlineQueryResultCachedMpeg4Gif{ + Type: "mpeg4_gif", + ID: id, + MGifID: MPEG4GifID, + } +} + // NewInlineQueryResultPhoto creates a new inline query photo. func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto { return InlineQueryResultPhoto{ @@ -487,6 +505,15 @@ func NewInlineQueryResultPhotoWithThumb(id, url, thumb string) InlineQueryResult } } +// NewInlineQueryResultCachedPhoto create a new inline query with cached photo. +func NewInlineQueryResultCachedPhoto(id, photoID string) InlineQueryResultCachedPhoto { + return InlineQueryResultCachedPhoto{ + Type: "photo", + ID: id, + PhotoID: photoID, + } +} + // NewInlineQueryResultVideo creates a new inline query video. func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo { return InlineQueryResultVideo{ @@ -496,6 +523,16 @@ func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo { } } +// NewInlineQueryResultCachedVideo create a new inline query with cached video. +func NewInlineQueryResultCachedVideo(id, videoID, title string) InlineQueryResultCachedVideo { + return InlineQueryResultCachedVideo{ + Type: "video", + ID: id, + VideoID: videoID, + Title: title, + } +} + // NewInlineQueryResultAudio creates a new inline query audio. func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio { return InlineQueryResultAudio{ @@ -506,6 +543,15 @@ func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio { } } +// NewInlineQueryResultCachedAudio create a new inline query with cached photo. +func NewInlineQueryResultCachedAudio(id, audioID string) InlineQueryResultCachedAudio { + return InlineQueryResultCachedAudio{ + Type: "audio", + ID: id, + AudioID: audioID, + } +} + // NewInlineQueryResultVoice creates a new inline query voice. func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice { return InlineQueryResultVoice{ @@ -516,6 +562,16 @@ func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice { } } +// NewInlineQueryResultCachedVoice create a new inline query with cached photo. +func NewInlineQueryResultCachedVoice(id, voiceID, title string) InlineQueryResultCachedVoice { + return InlineQueryResultCachedVoice{ + Type: "voice", + ID: id, + VoiceID: voiceID, + Title: title, + } +} + // NewInlineQueryResultDocument creates a new inline query document. func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument { return InlineQueryResultDocument{ @@ -527,6 +583,16 @@ func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryRe } } +// NewInlineQueryResultCachedDocument create a new inline query with cached photo. +func NewInlineQueryResultCachedDocument(id, documentID, title string) InlineQueryResultCachedDocument { + return InlineQueryResultCachedDocument{ + Type: "document", + ID: id, + DocumentID: documentID, + Title: title, + } +} + // NewInlineQueryResultLocation creates a new inline query location. func NewInlineQueryResultLocation(id, title string, latitude, longitude float64) InlineQueryResultLocation { return InlineQueryResultLocation{ @@ -556,7 +622,7 @@ func NewEditMessageCaption(chatID int64, messageID int, caption string) EditMess ChatID: chatID, MessageID: messageID, }, - Caption: caption, + Caption: caption, } } diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go index d3c433fb..c6cd642f 100644 --- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go +++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go @@ -586,6 +586,19 @@ type InlineQueryResultPhoto struct { InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedPhoto is an inline query response with cached photo. +type InlineQueryResultCachedPhoto struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + PhotoID string `json:"photo_file_id"` // required + Title string `json:"title"` + Description string `json:"description"` + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultGIF is an inline query response GIF. type InlineQueryResultGIF struct { Type string `json:"type"` // required @@ -601,6 +614,18 @@ type InlineQueryResultGIF struct { InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedGIF is an inline query response with cached gif. +type InlineQueryResultCachedGIF struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + GifID string `json:"gif_file_id"` // required + Title string `json:"title"` + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF. type InlineQueryResultMPEG4GIF struct { Type string `json:"type"` // required @@ -616,6 +641,19 @@ type InlineQueryResultMPEG4GIF struct { InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedMpeg4Gif is an inline query response with cached +// H.264/MPEG-4 AVC video without sound gif. +type InlineQueryResultCachedMpeg4Gif struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + MGifID string `json:"mpeg4_file_id"` // required + Title string `json:"title"` + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultVideo is an inline query response video. type InlineQueryResultVideo struct { Type string `json:"type"` // required @@ -633,6 +671,19 @@ type InlineQueryResultVideo struct { InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedVideo is an inline query response with cached video. +type InlineQueryResultCachedVideo struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + VideoID string `json:"video_file_id"` // required + Title string `json:"title"` // required + Description string `json:"description"` + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultAudio is an inline query response audio. type InlineQueryResultAudio struct { Type string `json:"type"` // required @@ -646,6 +697,17 @@ type InlineQueryResultAudio struct { InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedAudio is an inline query response with cached audio. +type InlineQueryResultCachedAudio struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + AudioID string `json:"audio_file_id"` // required + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultVoice is an inline query response voice. type InlineQueryResultVoice struct { Type string `json:"type"` // required @@ -658,6 +720,18 @@ type InlineQueryResultVoice struct { InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedVoice is an inline query response with cached voice. +type InlineQueryResultCachedVoice struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + VoiceID string `json:"voice_file_id"` // required + Title string `json:"title"` // required + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultDocument is an inline query response document. type InlineQueryResultDocument struct { Type string `json:"type"` // required @@ -674,6 +748,19 @@ type InlineQueryResultDocument struct { ThumbHeight int `json:"thumb_height"` } +// InlineQueryResultCachedDocument is an inline query response with cached document. +type InlineQueryResultCachedDocument struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + DocumentID string `json:"document_file_id"` // required + Title string `json:"title"` // required + Caption string `json:"caption"` + Description string `json:"description"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultLocation is an inline query response location. type InlineQueryResultLocation struct { Type string `json:"type"` // required diff --git a/vendor/github.com/lrstanley/girc/README.md b/vendor/github.com/lrstanley/girc/README.md index ddc1193c..35f3d818 100644 --- a/vendor/github.com/lrstanley/girc/README.md +++ b/vendor/github.com/lrstanley/girc/README.md @@ -88,6 +88,8 @@ girc artwork licensed under [CC 3.0](http://creativecommons.org/licenses/by/3.0/ * [IRCv3: Specification Docs](http://ircv3.net/irc/) * [IRCv3: Specification Repo](https://github.com/ircv3/ircv3-specifications) * [IRCv3 Capability Registry](http://ircv3.net/registry.html) + * [IRCv3: WEBIRC](https://ircv3.net/specs/extensions/webirc.html) + * [KiwiIRC: WEBIRC](https://kiwiirc.com/docs/webirc) * [ISUPPORT Specification Docs](http://www.irc.org/tech_docs/005.html) ([alternative 1](http://defs.ircdocs.horse/defs/isupport.html), [alternative 2](https://github.com/grawity/irc-docs/blob/master/client/RPL_ISUPPORT/draft-hardy-irc-isupport-00.txt), [relevant draft](http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt)) * [IRC Numerics List](http://defs.ircdocs.horse/defs/numerics.html) * [Extended WHO (also known as WHOX)](https://github.com/quakenet/snircd/blob/master/doc/readme.who) diff --git a/vendor/github.com/lrstanley/girc/builtin.go b/vendor/github.com/lrstanley/girc/builtin.go index 12257ca3..9dd02804 100644 --- a/vendor/github.com/lrstanley/girc/builtin.go +++ b/vendor/github.com/lrstanley/girc/builtin.go @@ -145,7 +145,7 @@ func handleJOIN(c *Client, e Event) { user := c.state.lookupUser(e.Source.Name) if user == nil { - if ok := c.state.createUser(e.Source.Name); !ok { + if ok := c.state.createUser(e.Source); !ok { c.state.Unlock() return } @@ -169,7 +169,7 @@ func handleJOIN(c *Client, e Event) { } c.state.Unlock() - if e.Source.Name == c.GetNick() { + if e.Source.ID() == c.GetID() { // If it's us, don't just add our user to the list. Run a WHO which // will tell us who exactly is in the entire channel. c.Send(&Event{Command: WHO, Params: []string{channelName, "%tacuhnr,1"}}) @@ -209,7 +209,7 @@ func handlePART(c *Client, e Event) { defer c.state.notify(c, UPDATE_STATE) - if e.Source.Name == c.GetNick() { + if e.Source.ID() == c.GetID() { c.state.Lock() c.state.deleteChannel(channel) c.state.Unlock() @@ -217,7 +217,7 @@ func handlePART(c *Client, e Event) { } c.state.Lock() - c.state.deleteUser(channel, e.Source.Name) + c.state.deleteUser(channel, e.Source.ID()) c.state.Unlock() } @@ -327,9 +327,9 @@ func handleNICK(c *Client, e Event) { c.state.Lock() // renameUser updates the LastActive time automatically. if len(e.Params) == 1 { - c.state.renameUser(e.Source.Name, e.Params[0]) + c.state.renameUser(e.Source.ID(), e.Params[0]) } else if len(e.Trailing) > 0 { - c.state.renameUser(e.Source.Name, e.Trailing) + c.state.renameUser(e.Source.ID(), e.Trailing) } c.state.Unlock() c.state.notify(c, UPDATE_STATE) @@ -341,12 +341,12 @@ func handleQUIT(c *Client, e Event) { return } - if e.Source.Name == c.GetNick() { + if e.Source.ID() == c.GetID() { return } c.state.Lock() - c.state.deleteUser("", e.Source.Name) + c.state.deleteUser("", e.Source.ID()) c.state.Unlock() c.state.notify(c, UPDATE_STATE) } @@ -443,8 +443,9 @@ func handleNAMES(c *Client, e Event) { parts := strings.Split(e.Trailing, " ") - var host, ident, modes, nick string + var modes, nick string var ok bool + s := &Source{} c.state.Lock() for i := 0; i < len(parts); i++ { @@ -455,36 +456,29 @@ func handleNAMES(c *Client, e Event) { // If userhost-in-names. if strings.Contains(nick, "@") { - s := ParseSource(nick) + s = ParseSource(nick) if s == nil { continue } - host = s.Host - nick = s.Name - ident = s.Ident - } + } else { + s = &Source{ + Name: nick, + } - if !IsValidNick(nick) { - continue + if !IsValidNick(s.Name) { + continue + } } - c.state.createUser(nick) - user := c.state.lookupUser(nick) + c.state.createUser(s) + user := c.state.lookupUser(s.Name) if user == nil { continue } user.addChannel(channel.Name) - channel.addUser(nick) - - // Add necessary userhost-in-names data into the user. - if host != "" { - user.Host = host - } - if ident != "" { - user.Ident = ident - } + channel.addUser(s.ID()) // Don't append modes, overwrite them. perms, _ := user.Perms.Lookup(channel.Name) diff --git a/vendor/github.com/lrstanley/girc/cap_tags.go b/vendor/github.com/lrstanley/girc/cap_tags.go index a4026a01..aff10f69 100644 --- a/vendor/github.com/lrstanley/girc/cap_tags.go +++ b/vendor/github.com/lrstanley/girc/cap_tags.go @@ -25,7 +25,7 @@ func handleTags(c *Client, e Event) { } c.state.Lock() - user := c.state.lookupUser(e.Source.Name) + user := c.state.lookupUser(e.Source.ID()) if user != nil { user.Extras.Account = account } diff --git a/vendor/github.com/lrstanley/girc/client.go b/vendor/github.com/lrstanley/girc/client.go index 63f47eaa..b8abb642 100644 --- a/vendor/github.com/lrstanley/girc/client.go +++ b/vendor/github.com/lrstanley/girc/client.go @@ -81,6 +81,10 @@ type Config struct { // supported. Capability tracking must be enabled for this to work, as // this requires IRCv3 CAP handling. SASL SASLMech + // WebIRC allows forwarding source user hostname/ip information to the server + // (if supported by the server) to ensure the source machine doesn't show as + // the source. See the WebIRC type for more information. + WebIRC WebIRC // Bind is used to bind to a specific host or ip during the dial process // when connecting to the server. This can be a hostname, however it must // resolve to an IPv4/IPv6 address bindable on your system. Otherwise, @@ -154,6 +158,39 @@ type Config struct { HandleNickCollide func(oldNick string) (newNick string) } +// WebIRC is useful when a user connects through an indirect method, such web +// clients, the indirect client sends its own IP address instead of sending the +// user's IP address unless WebIRC is implemented by both the client and the +// server. +// +// Client expectations: +// - Perform any proxy resolution. +// - Check the reverse DNS and forward DNS match. +// - Check the IP against suitable access controls (ipaccess, dnsbl, etc). +// +// More information: +// - https://ircv3.net/specs/extensions/webirc.html +// - https://kiwiirc.com/docs/webirc +type WebIRC struct { + // Password that authenticates the WEBIRC command from this client. + Password string + // Gateway or client type requesting spoof (cgiirc defaults to cgiirc, as an + // example). + Gateway string + // Hostname of user. + Hostname string + // Address either in IPv4 dotted quad notation (e.g. 192.0.0.2) or IPv6 + // notation (e.g. 1234:5678:9abc::def). IPv4-in-IPv6 addresses + // (e.g. ::ffff:192.0.0.2) should not be sent. + Address string +} + +// Params returns the arguments for the WEBIRC command that can be passed to the +// server. +func (w WebIRC) Params() []string { + return []string{w.Password, w.Gateway, w.Hostname, w.Address} +} + // ErrInvalidConfig is returned when the configuration passed to the client // is invalid. type ErrInvalidConfig struct { @@ -273,7 +310,7 @@ func (c *Client) TLSConnectionState() (*tls.ConnectionState, error) { // the connection to the server wasn't made with TLS. var ErrConnNotTLS = errors.New("underlying connection is not tls") -// Close closes the network connection to the server, and sends a STOPPED +// Close closes the network connection to the server, and sends a CLOSED // event. This should cause Connect() to return with nil. This should be // safe to call multiple times. See Connect()'s documentation on how // handlers and goroutines are handled when disconnected from the server. @@ -436,6 +473,12 @@ func (c *Client) GetNick() string { return c.state.nick } +// GetID returns an RFC1459 compliant version of the current nickname. Panics +// if tracking is disabled. +func (c *Client) GetID() string { + return ToRFC1459(c.GetNick()) +} + // GetIdent returns the current ident of the active connection. Panics if // tracking is disabled. May be empty, as this is obtained from when we join // a channel, as there is no other more efficient method to return this info. diff --git a/vendor/github.com/lrstanley/girc/commands.go b/vendor/github.com/lrstanley/girc/commands.go index 300db9ed..79287d52 100644 --- a/vendor/github.com/lrstanley/girc/commands.go +++ b/vendor/github.com/lrstanley/girc/commands.go @@ -359,3 +359,9 @@ func (cmd *Commands) List(channels ...string) { func (cmd *Commands) Whowas(user string, amount int) { cmd.c.Send(&Event{Command: WHOWAS, Params: []string{user, string(amount)}}) } + +// Monitor sends a MONITOR query to the server. The results of the query +// depends on the given modifier, see https://ircv3.net/specs/core/monitor-3.2.html +func (cmd *Commands) Monitor(modifier rune, args ...string) { + cmd.c.Send(&Event{Command: MONITOR, Params: append([]string{string(modifier)}, args...)}) +} diff --git a/vendor/github.com/lrstanley/girc/conn.go b/vendor/github.com/lrstanley/girc/conn.go index 77d87988..d0579815 100644 --- a/vendor/github.com/lrstanley/girc/conn.go +++ b/vendor/github.com/lrstanley/girc/conn.go @@ -284,6 +284,11 @@ func (c *Client) internalConnect(mock net.Conn, dialer Dialer) error { go c.pingLoop(ctx, errs, &wg) // Passwords first. + + if c.Config.WebIRC.Password != "" { + c.write(&Event{Command: WEBIRC, Params: c.Config.WebIRC.Params(), Sensitive: true}) + } + if c.Config.ServerPass != "" { c.write(&Event{Command: PASS, Params: []string{c.Config.ServerPass}, Sensitive: true}) } @@ -314,7 +319,7 @@ func (c *Client) internalConnect(mock net.Conn, dialer Dialer) error { select { case <-ctx.Done(): c.debug.Print("received request to close, beginning clean up") - c.RunHandlers(&Event{Command: STOPPED, Trailing: c.Server()}) + c.RunHandlers(&Event{Command: CLOSED, Trailing: c.Server()}) case err := <-errs: c.debug.Print("received error, beginning clean up") result = err @@ -331,6 +336,8 @@ func (c *Client) internalConnect(mock net.Conn, dialer Dialer) error { c.conn.mu.Unlock() c.mu.RUnlock() + c.RunHandlers(&Event{Command: DISCONNECTED, Trailing: c.Server()}) + // Once we have our error/result, let all other functions know we're done. c.debug.Print("waiting for all routines to finish") @@ -374,7 +381,7 @@ func (c *Client) readLoop(ctx context.Context, errs chan error, wg *sync.WaitGro // Check if it's an echo-message. if !c.Config.disableTracking { event.Echo = (event.Command == PRIVMSG || event.Command == NOTICE) && - event.Source != nil && event.Source.Name == c.GetNick() + event.Source != nil && event.Source.ID() == c.GetID() } c.rx <- event diff --git a/vendor/github.com/lrstanley/girc/constants.go b/vendor/github.com/lrstanley/girc/constants.go index 76ba482d..ddea7d0d 100644 --- a/vendor/github.com/lrstanley/girc/constants.go +++ b/vendor/github.com/lrstanley/girc/constants.go @@ -27,7 +27,7 @@ const ( CONNECTED = "CLIENT_CONNECTED" // when it's safe to send arbitrary commands (joins, list, who, etc), trailing is host:port INITIALIZED = "CLIENT_INIT" // verifies successful socket connection, trailing is host:port DISCONNECTED = "CLIENT_DISCONNECTED" // occurs when we're disconnected from the server (user-requested or not) - STOPPED = "CLIENT_STOPPED" // occurs when Client.Stop() has been called + CLOSED = "CLIENT_CLOSED" // occurs when Client.Close() has been called ) // User/channel prefixes :: RFC1459. @@ -118,6 +118,7 @@ const ( USERS = "USERS" VERSION = "VERSION" WALLOPS = "WALLOPS" + WEBIRC = "WEBIRC" WHO = "WHO" WHOIS = "WHOIS" WHOWAS = "WHOWAS" @@ -268,6 +269,7 @@ const ( // IRCv3 commands and extensions :: http://ircv3.net/irc/. const ( AUTHENTICATE = "AUTHENTICATE" + MONITOR = "MONITOR" STARTTLS = "STARTTLS" CAP = "CAP" @@ -288,17 +290,22 @@ const ( // Numeric IRC reply mapping for ircv3 :: http://ircv3.net/irc/. const ( - RPL_LOGGEDIN = "900" - RPL_LOGGEDOUT = "901" - RPL_NICKLOCKED = "902" - RPL_SASLSUCCESS = "903" - ERR_SASLFAIL = "904" - ERR_SASLTOOLONG = "905" - ERR_SASLABORTED = "906" - ERR_SASLALREADY = "907" - RPL_SASLMECHS = "908" - RPL_STARTTLS = "670" - ERR_STARTTLS = "691" + RPL_LOGGEDIN = "900" + RPL_LOGGEDOUT = "901" + RPL_NICKLOCKED = "902" + RPL_SASLSUCCESS = "903" + ERR_SASLFAIL = "904" + ERR_SASLTOOLONG = "905" + ERR_SASLABORTED = "906" + ERR_SASLALREADY = "907" + RPL_SASLMECHS = "908" + RPL_STARTTLS = "670" + ERR_STARTTLS = "691" + RPL_MONONLINE = "730" + RPL_MONOFFLINE = "731" + RPL_MONLIST = "732" + RPL_ENDOFMONLIST = "733" + ERR_MONLISTFULL = "734" ) // Numeric IRC event mapping :: RFC2812; section 5.3. diff --git a/vendor/github.com/lrstanley/girc/ctcp.go b/vendor/github.com/lrstanley/girc/ctcp.go index 45fc6be5..56f4c85c 100644 --- a/vendor/github.com/lrstanley/girc/ctcp.go +++ b/vendor/github.com/lrstanley/girc/ctcp.go @@ -155,8 +155,8 @@ func (c *CTCP) call(client *Client, event *CTCPEvent) { } // Send a ERRMSG reply, if we know who sent it. - if event.Source != nil && IsValidNick(event.Source.Name) { - client.Cmd.SendCTCPReply(event.Source.Name, CTCP_ERRMSG, "that is an unknown CTCP query") + if event.Source != nil && IsValidNick(event.Source.ID()) { + client.Cmd.SendCTCPReply(event.Source.ID(), CTCP_ERRMSG, "that is an unknown CTCP query") } return } @@ -248,7 +248,7 @@ func handleCTCPPing(client *Client, ctcp CTCPEvent) { if ctcp.Reply { return } - client.Cmd.SendCTCPReply(ctcp.Source.Name, CTCP_PING, ctcp.Text) + client.Cmd.SendCTCPReply(ctcp.Source.ID(), CTCP_PING, ctcp.Text) } // handleCTCPPong replies with a pong. @@ -256,7 +256,7 @@ func handleCTCPPong(client *Client, ctcp CTCPEvent) { if ctcp.Reply { return } - client.Cmd.SendCTCPReply(ctcp.Source.Name, CTCP_PONG, "") + client.Cmd.SendCTCPReply(ctcp.Source.ID(), CTCP_PONG, "") } // handleCTCPVersion replies with the name of the client, Go version, as well @@ -264,12 +264,12 @@ func handleCTCPPong(client *Client, ctcp CTCPEvent) { // arm, etc). func handleCTCPVersion(client *Client, ctcp CTCPEvent) { if client.Config.Version != "" { - client.Cmd.SendCTCPReply(ctcp.Source.Name, CTCP_VERSION, client.Config.Version) + client.Cmd.SendCTCPReply(ctcp.Source.ID(), CTCP_VERSION, client.Config.Version) return } client.Cmd.SendCTCPReplyf( - ctcp.Source.Name, CTCP_VERSION, + ctcp.Source.ID(), CTCP_VERSION, "girc (github.com/lrstanley/girc) using %s (%s, %s)", runtime.Version(), runtime.GOOS, runtime.GOARCH, ) @@ -277,13 +277,13 @@ func handleCTCPVersion(client *Client, ctcp CTCPEvent) { // handleCTCPSource replies with the public git location of this library. func handleCTCPSource(client *Client, ctcp CTCPEvent) { - client.Cmd.SendCTCPReply(ctcp.Source.Name, CTCP_SOURCE, "https://github.com/lrstanley/girc") + client.Cmd.SendCTCPReply(ctcp.Source.ID(), CTCP_SOURCE, "https://github.com/lrstanley/girc") } // handleCTCPTime replies with a RFC 1123 (Z) formatted version of Go's // local time. func handleCTCPTime(client *Client, ctcp CTCPEvent) { - client.Cmd.SendCTCPReply(ctcp.Source.Name, CTCP_TIME, ":"+time.Now().Format(time.RFC1123Z)) + client.Cmd.SendCTCPReply(ctcp.Source.ID(), CTCP_TIME, ":"+time.Now().Format(time.RFC1123Z)) } // handleCTCPFinger replies with the realname and idle time of the user. This @@ -293,5 +293,5 @@ func handleCTCPFinger(client *Client, ctcp CTCPEvent) { active := client.conn.lastActive client.conn.mu.RUnlock() - client.Cmd.SendCTCPReply(ctcp.Source.Name, CTCP_FINGER, fmt.Sprintf("%s -- idle %s", client.Config.Name, time.Since(active))) + client.Cmd.SendCTCPReply(ctcp.Source.ID(), CTCP_FINGER, fmt.Sprintf("%s -- idle %s", client.Config.Name, time.Since(active))) } diff --git a/vendor/github.com/lrstanley/girc/event.go b/vendor/github.com/lrstanley/girc/event.go index 0b40b40b..69f82148 100644 --- a/vendor/github.com/lrstanley/girc/event.go +++ b/vendor/github.com/lrstanley/girc/event.go @@ -516,7 +516,8 @@ const ( // Source represents the sender of an IRC event, see RFC1459 section 2.3.1. // <servername> | <nick> [ '!' <user> ] [ '@' <host> ] type Source struct { - // Name is the nickname, server name, or service name. + // Name is the nickname, server name, or service name, in its original + // non-rfc1459 form. Name string `json:"name"` // Ident is commonly known as the "user". Ident string `json:"ident"` @@ -525,6 +526,12 @@ type Source struct { Host string `json:"host"` } +// ID is the nickname, server name, or service name, in it's converted +// and comparable) form. +func (s *Source) ID() string { + return ToRFC1459(s.Name) +} + // Equals compares two Sources for equality. func (s *Source) Equals(ss *Source) bool { if s == nil && ss == nil { @@ -533,7 +540,7 @@ func (s *Source) Equals(ss *Source) bool { if s != nil && ss == nil || s == nil && ss != nil { return false } - if s.Name != ss.Name || s.Ident != ss.Ident || s.Host != ss.Host { + if s.ID() != ss.ID() || s.Ident != ss.Ident || s.Host != ss.Host { return false } return true diff --git a/vendor/github.com/lrstanley/girc/state.go b/vendor/github.com/lrstanley/girc/state.go index 36dcc82b..0660a686 100644 --- a/vendor/github.com/lrstanley/girc/state.go +++ b/vendor/github.com/lrstanley/girc/state.go @@ -419,14 +419,16 @@ func (s *state) lookupUser(name string) *User { } // createUser creates the user in state, if not already done. -func (s *state) createUser(nick string) (ok bool) { - if _, ok := s.users[ToRFC1459(nick)]; ok { +func (s *state) createUser(src *Source) (ok bool) { + if _, ok := s.users[src.ID()]; ok { // User already exists. return false } - s.users[ToRFC1459(nick)] = &User{ - Nick: nick, + s.users[src.ID()] = &User{ + Nick: src.Name, + Host: src.Host, + Ident: src.Ident, FirstSeen: time.Now(), LastActive: time.Now(), Perms: &UserPerms{channels: make(map[string]Perms)}, diff --git a/vendor/github.com/matterbridge/gomatrix/client.go b/vendor/github.com/matterbridge/gomatrix/client.go index 90a07c68..acc92258 100644 --- a/vendor/github.com/matterbridge/gomatrix/client.go +++ b/vendor/github.com/matterbridge/gomatrix/client.go @@ -461,7 +461,12 @@ func (cli *Client) SendStateEvent(roomID, eventType, stateKey string, contentJSO // See http://matrix.org/docs/spec/client_server/r0.2.0.html#m-text func (cli *Client) SendText(roomID, text string) (*RespSendEvent, error) { return cli.SendMessageEvent(roomID, "m.room.message", - TextMessage{"m.text", text}) + TextMessage{"m.text", text, "", ""}) +} + +func (cli *Client) SendHTML(roomID, textclear, text string) (*RespSendEvent, error) { + return cli.SendMessageEvent(roomID, "m.room.message", + TextMessage{"m.text", textclear, "org.matrix.custom.html", text}) } // SendImage sends an m.room.message event into the given room with a msgtype of m.image @@ -490,7 +495,12 @@ func (cli *Client) SendVideo(roomID, body, url string) (*RespSendEvent, error) { // See http://matrix.org/docs/spec/client_server/r0.2.0.html#m-notice func (cli *Client) SendNotice(roomID, text string) (*RespSendEvent, error) { return cli.SendMessageEvent(roomID, "m.room.message", - TextMessage{"m.notice", text}) + TextMessage{"m.notice", text, "", ""}) +} + +func (cli *Client) SendNoticeHTML(roomID, textclear, text string) (*RespSendEvent, error) { + return cli.SendMessageEvent(roomID, "m.room.message", + TextMessage{"m.notice", textclear, "org.matrix.custom.html", text}) } // RedactEvent redacts the given event. See http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid diff --git a/vendor/github.com/matterbridge/gomatrix/events.go b/vendor/github.com/matterbridge/gomatrix/events.go index 61f75372..d065cd72 100644 --- a/vendor/github.com/matterbridge/gomatrix/events.go +++ b/vendor/github.com/matterbridge/gomatrix/events.go @@ -41,8 +41,10 @@ func (event *Event) MessageType() (msgtype string, ok bool) { // TextMessage is the contents of a Matrix formated message event. type TextMessage struct { - MsgType string `json:"msgtype"` - Body string `json:"body"` + MsgType string `json:"msgtype"` + Body string `json:"body"` + Format string `json:"format,omitempty"` + FormattedBody string `json:"formatted_body,omitempty"` } // ImageInfo contains info about an image - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-image diff --git a/vendor/modules.txt b/vendor/modules.txt index a665570f..ccd9061b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -21,7 +21,7 @@ github.com/dfordsoft/golib/ic github.com/dgrijalva/jwt-go # github.com/fsnotify/fsnotify v1.4.7 github.com/fsnotify/fsnotify -# github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible +# github.com/go-telegram-bot-api/telegram-bot-api v4.6.5-0.20181225215658-ec221ba9ea45+incompatible github.com/go-telegram-bot-api/telegram-bot-api # github.com/golang/protobuf v0.0.0-20170613224224-e325f446bebc github.com/golang/protobuf/proto @@ -62,13 +62,13 @@ github.com/labstack/gommon/color github.com/labstack/gommon/log github.com/labstack/gommon/bytes github.com/labstack/gommon/random -# github.com/lrstanley/girc v0.0.0-20181114171214-3aee8c249519 +# github.com/lrstanley/girc v0.0.0-20190102153329-c1e59a02f488 github.com/lrstanley/girc # github.com/magiconair/properties v1.8.0 github.com/magiconair/properties # github.com/matterbridge/go-xmpp v0.0.0-20180529212104-cd19799fba91 github.com/matterbridge/go-xmpp -# github.com/matterbridge/gomatrix v0.0.0-20171224233421-78ac6a1a0f5f +# github.com/matterbridge/gomatrix v0.0.0-20190102230110-6f9631ca6dea github.com/matterbridge/gomatrix # github.com/matterbridge/gozulipbot v0.0.0-20180507190239-b6bb12d33544 github.com/matterbridge/gozulipbot |