xmpp/structs.go
changeset 163 3f891f7fe817
parent 158 2d948fcbb5d7
child 171 2f6ae54a2bd1
equal deleted inserted replaced
162:7b5586a5e109 163:3f891f7fe817
     5 import (
     5 import (
     6 	"bytes"
     6 	"bytes"
     7 	"encoding/xml"
     7 	"encoding/xml"
     8 	"flag"
     8 	"flag"
     9 	"fmt"
     9 	"fmt"
    10 	// BUG(cjyar): Doesn't use stringprep. Could try the implementation at
    10 	"log"
    11 	// "code.google.com/p/go-idn/src/stringprep"
       
    12 	"reflect"
    11 	"reflect"
    13 	"regexp"
    12 	"regexp"
    14 	"strings"
    13 	"strings"
    15 )
    14 )
       
    15 
       
    16 // BUG(cjyar): Doesn't use stringprep. Could try the implementation at
       
    17 // "code.google.com/p/go-idn/src/stringprep"
    16 
    18 
    17 // JID represents an entity that can communicate with other
    19 // JID represents an entity that can communicate with other
    18 // entities. It looks like node@domain/resource. Node and resource are
    20 // entities. It looks like node@domain/resource. Node and resource are
    19 // sometimes optional.
    21 // sometimes optional.
    20 type JID struct {
    22 type JID struct {
   258 }
   260 }
   259 
   261 
   260 func (er *Error) Error() string {
   262 func (er *Error) Error() string {
   261 	buf, err := xml.Marshal(er)
   263 	buf, err := xml.Marshal(er)
   262 	if err != nil {
   264 	if err != nil {
   263 		Warn.Log("double bad error: couldn't marshal error")
   265 		log.Println("double bad error: couldn't marshal error")
   264 		return "unreadable error"
   266 		return "unreadable error"
   265 	}
   267 	}
   266 	return string(buf)
   268 	return string(buf)
   267 }
   269 }
   268 
   270