@@ -25,7 +25,7 @@ const (
25
25
26
26
// Send sends room topic wrapped inside an XMPP message stanza body.
27
27
func (c * Client ) SendTopic (chat Chat ) (n int , err error ) {
28
- return fmt .Fprintf (c .stanzaWriter , "<message to='%s' type='%s' xml:lang='en'>" + "<subject>%s</subject></message>" ,
28
+ return fmt .Fprintf (c .stanzaWriter , "<message to='%s' type='%s' xml:lang='en'>" + "<subject>%s</subject></message>\n " ,
29
29
xmlEscape (chat .Remote ), xmlEscape (chat .Type ), xmlEscape (chat .Text ))
30
30
}
31
31
@@ -47,34 +47,34 @@ func (c *Client) JoinMUC(jid, nick string, history_type, history int, history_da
47
47
}
48
48
switch history_type {
49
49
case NoHistory :
50
- return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>\n " +
51
- "<x xmlns='%s' />\n " +
52
- "</presence>" ,
50
+ return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>" +
51
+ "<x xmlns='%s' />" +
52
+ "</presence>\n " ,
53
53
xmlEscape (jid ), xmlEscape (nick ), nsMUC )
54
54
case CharHistory :
55
- return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>\n " +
55
+ return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>" +
56
56
"<x xmlns='%s'>\n " +
57
- "<history maxchars='%d'/></x>\n " +
58
- "</presence>" ,
57
+ "<history maxchars='%d'/></x>" +
58
+ "</presence>\n " ,
59
59
xmlEscape (jid ), xmlEscape (nick ), nsMUC , history )
60
60
case StanzaHistory :
61
- return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>\n " +
62
- "<x xmlns='%s'>\n " +
63
- "<history maxstanzas='%d'/></x>\n " +
64
- "</presence>" ,
61
+ return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>" +
62
+ "<x xmlns='%s'>" +
63
+ "<history maxstanzas='%d'/></x>" +
64
+ "</presence>\n " ,
65
65
xmlEscape (jid ), xmlEscape (nick ), nsMUC , history )
66
66
case SecondsHistory :
67
- return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>\n " +
68
- "<x xmlns='%s'>\n " +
69
- "<history seconds='%d'/></x>\n " +
70
- "</presence>" ,
67
+ return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>" +
68
+ "<x xmlns='%s'>" +
69
+ "<history seconds='%d'/></x>" +
70
+ "</presence>\n " ,
71
71
xmlEscape (jid ), xmlEscape (nick ), nsMUC , history )
72
72
case SinceHistory :
73
73
if history_date != nil {
74
- return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>\n " +
75
- "<x xmlns='%s'>\n " +
76
- "<history since='%s'/></x>\n " +
77
- "</presence>" ,
74
+ return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>" +
75
+ "<x xmlns='%s'>" +
76
+ "<history since='%s'/></x>" +
77
+ "</presence>\n " ,
78
78
xmlEscape (jid ), xmlEscape (nick ), nsMUC , history_date .Format (time .RFC3339 ))
79
79
}
80
80
}
@@ -88,40 +88,40 @@ func (c *Client) JoinProtectedMUC(jid, nick string, password string, history_typ
88
88
}
89
89
switch history_type {
90
90
case NoHistory :
91
- return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>\n " +
92
- "<x xmlns='%s'>\n " +
91
+ return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>" +
92
+ "<x xmlns='%s'>" +
93
93
"<password>%s</password>" +
94
- "</x>\n " +
95
- "</presence>" ,
94
+ "</x>" +
95
+ "</presence>\n " ,
96
96
xmlEscape (jid ), xmlEscape (nick ), nsMUC , xmlEscape (password ))
97
97
case CharHistory :
98
- return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>\n " +
99
- "<x xmlns='%s'>\n " +
100
- "<password>%s</password>\n " +
101
- "<history maxchars='%d'/></x>\n " +
102
- "</presence>" ,
98
+ return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>" +
99
+ "<x xmlns='%s'>" +
100
+ "<password>%s</password>" +
101
+ "<history maxchars='%d'/></x>" +
102
+ "</presence>\n " ,
103
103
xmlEscape (jid ), xmlEscape (nick ), nsMUC , xmlEscape (password ), history )
104
104
case StanzaHistory :
105
- return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>\n " +
106
- "<x xmlns='%s'>\n " +
107
- "<password>%s</password>\n " +
108
- "<history maxstanzas='%d'/></x>\n " +
109
- "</presence>" ,
105
+ return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>" +
106
+ "<x xmlns='%s'>" +
107
+ "<password>%s</password>" +
108
+ "<history maxstanzas='%d'/></x>" +
109
+ "</presence>\n " ,
110
110
xmlEscape (jid ), xmlEscape (nick ), nsMUC , xmlEscape (password ), history )
111
111
case SecondsHistory :
112
- return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>\n " +
113
- "<x xmlns='%s'>\n " +
114
- "<password>%s</password>\n " +
115
- "<history seconds='%d'/></x>\n " +
116
- "</presence>" ,
112
+ return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>" +
113
+ "<x xmlns='%s'>" +
114
+ "<password>%s</password>" +
115
+ "<history seconds='%d'/></x>" +
116
+ "</presence>\n " ,
117
117
xmlEscape (jid ), xmlEscape (nick ), nsMUC , xmlEscape (password ), history )
118
118
case SinceHistory :
119
119
if history_date != nil {
120
- return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>\n " +
121
- "<x xmlns='%s'>\n " +
122
- "<password>%s</password>\n " +
123
- "<history since='%s'/></x>\n " +
124
- "</presence>" ,
120
+ return fmt .Fprintf (c .stanzaWriter , "<presence to='%s/%s'>" +
121
+ "<x xmlns='%s'>" +
122
+ "<password>%s</password>" +
123
+ "<history since='%s'/></x>" +
124
+ "</presence>\n " ,
125
125
xmlEscape (jid ), xmlEscape (nick ), nsMUC , xmlEscape (password ), history_date .Format (time .RFC3339 ))
126
126
}
127
127
}
@@ -130,6 +130,6 @@ func (c *Client) JoinProtectedMUC(jid, nick string, password string, history_typ
130
130
131
131
// xep-0045 7.14
132
132
func (c * Client ) LeaveMUC (jid string ) (n int , err error ) {
133
- return fmt .Fprintf (c .stanzaWriter , "<presence from='%s' to='%s' type='unavailable' />" ,
133
+ return fmt .Fprintf (c .stanzaWriter , "<presence from='%s' to='%s' type='unavailable' />\n " ,
134
134
c .jid , xmlEscape (jid ))
135
135
}
0 commit comments