2015-05-01 20:59:46 +00:00
|
|
|
package server
|
2015-01-17 01:37:21 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2015-05-10 23:09:59 +00:00
|
|
|
|
2015-12-11 03:35:48 +00:00
|
|
|
"github.com/khlieng/dispatch/storage"
|
2015-01-17 01:37:21 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type WSRequest struct {
|
2015-06-16 22:46:58 +00:00
|
|
|
Type string `json:"type"`
|
|
|
|
Data json.RawMessage `json:"data"`
|
2015-01-17 01:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type WSResponse struct {
|
2015-06-16 22:46:58 +00:00
|
|
|
Type string `json:"type"`
|
|
|
|
Data interface{} `json:"data"`
|
2015-01-17 01:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Connect struct {
|
2015-02-07 02:10:58 +00:00
|
|
|
Name string `json:"name"`
|
2015-01-17 01:37:21 +00:00
|
|
|
Server string `json:"server"`
|
2015-01-29 23:38:51 +00:00
|
|
|
TLS bool `json:"tls"`
|
2015-02-07 02:10:58 +00:00
|
|
|
Password string `json:"password"`
|
2015-01-17 01:37:21 +00:00
|
|
|
Nick string `json:"nick"`
|
|
|
|
Username string `json:"username"`
|
2015-02-07 02:10:58 +00:00
|
|
|
Realname string `json:"realname"`
|
2015-01-17 01:37:21 +00:00
|
|
|
}
|
|
|
|
|
2015-01-31 22:35:38 +00:00
|
|
|
type Nick struct {
|
2017-04-11 01:49:52 +00:00
|
|
|
Server string `json:"server"`
|
|
|
|
Old string `json:"old"`
|
|
|
|
New string `json:"new"`
|
2015-01-31 22:35:38 +00:00
|
|
|
}
|
|
|
|
|
2015-01-17 01:37:21 +00:00
|
|
|
type Join struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
User string `json:"user"`
|
|
|
|
Channels []string `json:"channels"`
|
|
|
|
}
|
|
|
|
|
2015-02-01 00:56:56 +00:00
|
|
|
type Part struct {
|
2017-04-04 20:57:01 +00:00
|
|
|
Server string `json:"server"`
|
|
|
|
User string `json:"user"`
|
|
|
|
Channel string `json:"channel,omitempty"`
|
|
|
|
Channels []string `json:"channels,omitempty"`
|
|
|
|
Reason string `json:"reason,omitempty"`
|
2015-02-01 00:56:56 +00:00
|
|
|
}
|
|
|
|
|
2015-01-25 01:35:46 +00:00
|
|
|
type Mode struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
Channel string `json:"channel"`
|
|
|
|
User string `json:"user"`
|
|
|
|
Add string `json:"add"`
|
|
|
|
Remove string `json:"remove"`
|
|
|
|
}
|
|
|
|
|
2015-01-21 02:06:34 +00:00
|
|
|
type Quit struct {
|
2017-04-11 01:49:52 +00:00
|
|
|
Server string `json:"server"`
|
|
|
|
User string `json:"user"`
|
|
|
|
Reason string `json:"reason,omitempty"`
|
2015-01-21 02:06:34 +00:00
|
|
|
}
|
|
|
|
|
2017-04-17 20:36:37 +00:00
|
|
|
type Message struct {
|
2015-01-17 01:37:21 +00:00
|
|
|
Server string `json:"server"`
|
2017-04-06 21:26:58 +00:00
|
|
|
From string `json:"from,omitempty"`
|
2015-02-02 23:25:52 +00:00
|
|
|
To string `json:"to,omitempty"`
|
2017-04-17 20:36:37 +00:00
|
|
|
Content string `json:"content"`
|
2015-01-17 01:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Topic struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
Channel string `json:"channel"`
|
|
|
|
Topic string `json:"topic"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Userlist struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
Channel string `json:"channel"`
|
|
|
|
Users []string `json:"users"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type MOTD struct {
|
2015-02-01 01:08:38 +00:00
|
|
|
Server string `json:"server"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Content []string `json:"content"`
|
2015-01-17 01:37:21 +00:00
|
|
|
}
|
2015-01-29 23:38:51 +00:00
|
|
|
|
2015-02-10 01:25:28 +00:00
|
|
|
type Invite struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
Channel string `json:"channel"`
|
|
|
|
User string `json:"user"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Kick struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
Channel string `json:"channel"`
|
|
|
|
User string `json:"user"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Whois struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
User string `json:"user"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type WhoisReply struct {
|
|
|
|
Nick string `json:"nick"`
|
|
|
|
Username string `json:"username"`
|
|
|
|
Host string `json:"host"`
|
|
|
|
Realname string `json:"realname"`
|
|
|
|
Server string `json:"server"`
|
|
|
|
Channels []string `json:"channels"`
|
|
|
|
}
|
|
|
|
|
2015-02-21 12:06:05 +00:00
|
|
|
type Away struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
Message string `json:"message"`
|
|
|
|
}
|
|
|
|
|
2016-01-27 19:48:47 +00:00
|
|
|
type Raw struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
Message string `json:"message"`
|
|
|
|
}
|
|
|
|
|
2015-05-10 23:09:59 +00:00
|
|
|
type SearchRequest struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
Channel string `json:"channel"`
|
|
|
|
Phrase string `json:"phrase"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type SearchResult struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
Channel string `json:"channel"`
|
|
|
|
Results []storage.Message `json:"results"`
|
|
|
|
}
|
|
|
|
|
2016-01-11 20:04:57 +00:00
|
|
|
type ClientCert struct {
|
|
|
|
Cert []byte `json:"cert"`
|
|
|
|
Key []byte `json:"key"`
|
|
|
|
}
|
|
|
|
|
2015-01-29 23:38:51 +00:00
|
|
|
type Error struct {
|
|
|
|
Server string `json:"server"`
|
|
|
|
Message string `json:"message"`
|
|
|
|
}
|