71 _sx_debug(
ZONE,
"processing packets sent before stream, naughty them");
78 int tflag = 0, fflag = 0, vflag = 0, len, i, r;
88 if(strlen(name) < i || strncmp(name,
uri_STREAMS "|stream", i) != 0 || (name[i] !=
'\0' && name[i] !=
'|')) {
99 while(attr[0] != NULL) {
100 if(!tflag && strcmp(attr[0],
"to") == 0) {
102 s->
req_to = strdup(attr[1]);
106 if(!fflag && strcmp(attr[0],
"from") == 0) {
111 if(!vflag && strcmp(attr[0],
"version") == 0) {
144 for(i = 0; i < 40; i++) {
145 r = (int) (36.0 * rand() / RAND_MAX);
146 id[i] = (r >= 0 && r <= 9) ? (r + 48) : (r + 87);
157 if(s->
ns != NULL) len += 9 + strlen(s->
ns);
165 strcpy(c,
"<?xml version='1.0'?><stream:stream xmlns:stream='" uri_STREAMS "'");
167 if(s->
ns != NULL) { c = strchr(c,
'\0'); sprintf(c,
" xmlns='%s'", s->
ns); }
168 if(s->
res_to != NULL) { c = strchr(c,
'\0'); sprintf(c,
" to='%s'", s->
res_to); }
169 if(s->
res_from != NULL) { c = strchr(c,
'\0'); sprintf(c,
" from='%s'", s->
res_from); }
172 c = strchr(c,
'\0'); sprintf(c,
" id='%s'>",
id);
173 assert(buf->
len == strlen(buf->
data) + 1);
225 XML_SetStartNamespaceDeclHandler(s->
expat, NULL);
231 assert((
int) (s != NULL));