some bug fixes
This commit is contained in:
		
							parent
							
								
									bbb13ea537
								
							
						
					
					
						commit
						4d4a201b1a
					
				|  | @ -28,7 +28,7 @@ func (t *Tester) StartBot(status *Status) { | ||||||
| 		errMSG := &messages.StreamError{} | 		errMSG := &messages.StreamError{} | ||||||
| 		err = status.client.Decode(errMSG, element) | 		err = status.client.Decode(errMSG, element) | ||||||
| 		if err == nil { | 		if err == nil { | ||||||
| 			status.Disconnect(fmt.Sprintf("recv stream error: %s: %s", errMSG.Text, messages.XMLChildrenString(errMSG.Any))) | 			status.Disconnect(fmt.Sprintf("recv stream error: %s: %s -> %s", errMSG.Text, messages.XMLChildrenString(errMSG.StreamErrorGroup), messages.XMLChildrenString(errMSG.Other))) | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -37,6 +37,7 @@ func NewStatus(backupClient *client.Client, acc *Account) *Status { | ||||||
| func (s *Status) Disconnect(reason string) { | func (s *Status) Disconnect(reason string) { | ||||||
| 	if s.Login { | 	if s.Login { | ||||||
| 		msg := &messages.MessageClient{ | 		msg := &messages.MessageClient{ | ||||||
|  | 			Type: messages.MessageTypeChat, | ||||||
| 			Body: fmt.Sprintf("you recieve a notify that '%s' disconnect: %s", s.JID.Full(), reason), | 			Body: fmt.Sprintf("you recieve a notify that '%s' disconnect: %s", s.JID.Full(), reason), | ||||||
| 		} | 		} | ||||||
| 		for jid, _ := range s.account.Admins { | 		for jid, _ := range s.account.Admins { | ||||||
|  |  | ||||||
|  | @ -2,11 +2,39 @@ package messages | ||||||
| 
 | 
 | ||||||
| import "encoding/xml" | import "encoding/xml" | ||||||
| 
 | 
 | ||||||
| type StreamError struct { | type StreamErrorGroup struct { | ||||||
| 	XMLName xml.Name `xml:"http://etherx.jabber.org/streams error"` | 	BadFormat              *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams bad-format"` | ||||||
| 	Text    string   `xml:"urn:ietf:params:xml:ns:xmpp-streams text"` | 	BadNamespacePrefix     *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams bad-namespace-prefix"` | ||||||
|  | 	Conflict               *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams conflict"` | ||||||
|  | 	ConnectionTimeout      *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams connection-timeout"` | ||||||
|  | 	HostGone               *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams host-gone"` | ||||||
|  | 	HostUnknown            *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams host-unknown"` | ||||||
|  | 	ImproperAddressing     *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams improper-addressing"` | ||||||
|  | 	InternalServerError    *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams internal-server-error"` | ||||||
|  | 	InvalidFrom            *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams invalid-from"` | ||||||
|  | 	InvalidID              *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams invalid-id"` | ||||||
|  | 	InvalidNamespace       *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams invalid-namespace"` | ||||||
|  | 	InvalidXML             *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams invalid-xml"` | ||||||
|  | 	NotAuthorized          *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams not-authorized"` | ||||||
|  | 	NotWellFormed          *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams not-well-formed"` | ||||||
|  | 	PolicyViolation        *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams policy-violation"` | ||||||
|  | 	RemoteConnectionFailed *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams remote-connection-failed"` | ||||||
|  | 	Reset                  *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams reset"` | ||||||
|  | 	ResourceConstraint     *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams resource-constraint"` | ||||||
|  | 	RestrictedXML          *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams restricted-xml"` | ||||||
|  | 	SeeOtherHost           string    `xml:"urn:ietf:params:xml:ns:xmpp-streams see-other-host"` | ||||||
|  | 	SystemShutdown         *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams system-shutdown"` | ||||||
|  | 	UndefinedCondition     *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams undefined-condition"` | ||||||
|  | 	UnsupportedEncoding    *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams unsupported-encoding"` | ||||||
|  | 	UnsupportedStanzaType  *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams unsupported-stanza-type"` | ||||||
|  | 	UnsupportedVersion     *xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams unsupported-version"` | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| 	Any xml.Name `xml:",any"` | type StreamError struct { | ||||||
|  | 	XMLName xml.Name     `xml:"http://etherx.jabber.org/streams error"` | ||||||
|  | 	Text    string       `xml:"urn:ietf:params:xml:ns:xmpp-streams text"` | ||||||
|  | 	Other   []XMLElement `xml:",any"` | ||||||
|  | 	StreamErrorGroup | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type ErrorClientType string | type ErrorClientType string | ||||||
|  |  | ||||||
		Reference in New Issue