74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
[of_stdout writeNBytes: len
fromBuffer: buf];
[parser parseBuffer: buf
withSize: len];
}
}
- (void)parser: (OFXMLParser*)p
didStartElement: (OFString*)name
withPrefix: (OFString*)prefix
namespace: (OFString*)ns
attributes: (OFArray*)attrs
{
|
>
>
>
>
>
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
[of_stdout writeNBytes: len
fromBuffer: buf];
[parser parseBuffer: buf
withSize: len];
}
}
- (void)sendStanza: (OFXMLElement*)elem
{
[sock writeString: [elem stringValue]];
}
- (void)parser: (OFXMLParser*)p
didStartElement: (OFString*)name
withPrefix: (OFString*)prefix
namespace: (OFString*)ns
attributes: (OFArray*)attrs
{
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
authTag = [OFXMLElement elementWithName: @"auth"
namespace: NS_SASL];
[authTag addAttributeWithName: @"mechanism"
stringValue: @"PLAIN"];
[authTag addChild: [OFXMLElement elementWithCharacters:
[message stringByBase64Encoding]]];
[sock writeString: [authTag stringValue]];
}
- (void)_sendResourceBind
{
XMPPIQ *iq = [XMPPIQ IQWithType: @"set" ID: @"bind0"];
[iq addChild: [OFXMLElement elementWithName: @"bind"
namespace: NS_BIND]];
[sock writeString: [iq stringValue]];
}
- (void)_handleFeatures: (OFXMLElement*)elem
{
for (OFXMLElement *child in elem.children) {
if ([[child name] isEqual: @"mechanisms"] &&
[[child namespace] isEqual: NS_SASL])
|
|
|
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
authTag = [OFXMLElement elementWithName: @"auth"
namespace: NS_SASL];
[authTag addAttributeWithName: @"mechanism"
stringValue: @"PLAIN"];
[authTag addChild: [OFXMLElement elementWithCharacters:
[message stringByBase64Encoding]]];
[self sendStanza: authTag];
}
- (void)_sendResourceBind
{
XMPPIQ *iq = [XMPPIQ IQWithType: @"set" ID: @"bind0"];
[iq addChild: [OFXMLElement elementWithName: @"bind"
namespace: NS_BIND]];
[self sendStanza: iq];
}
- (void)_handleFeatures: (OFXMLElement*)elem
{
for (OFXMLElement *child in elem.children) {
if ([[child name] isEqual: @"mechanisms"] &&
[[child namespace] isEqual: NS_SASL])
|