25 int tflag = 0, fflag = 0, vflag = 0, iflag = 0, i;
33 if(strlen(name) < i || strncmp(name,
uri_STREAMS "|stream", i) != 0 || (name[i] !=
'\0' && name[i] !=
'|')) {
44 while(attr[0] != NULL) {
45 if(!tflag && strcmp(attr[0],
"to") == 0) {
46 s->
res_to = strdup(attr[1]);
50 if(!fflag && strcmp(attr[0],
"from") == 0) {
55 if(!vflag && strcmp(attr[0],
"version") == 0) {
60 if(!iflag && strcmp(attr[0],
"id") == 0) {
61 s->
id = strdup(attr[1]);
116 assert((
int) (s != NULL));
127 if(ns != NULL) s->
ns = strdup(ns);
128 if(to != NULL) s->
req_to = strdup(to);
129 if(from != NULL) s->
req_from = strdup(from);
130 if(version != NULL) s->
req_version = strdup(version);
138 _sx_debug(
ZONE,
"stream request: ns %s to %s from %s version %s", ns, to, from, version);
143 if(ns != NULL) len += 9 + strlen(ns);
144 if(to != NULL) len += 6 + strlen(to);
145 if(from != NULL) len += 8 + strlen(from);
146 if(version != NULL) len += 11 + strlen(version);
150 strcpy(c,
"<?xml version='1.0'?><stream:stream xmlns:stream='" uri_STREAMS "'");
152 if(ns != NULL) { c = strchr(c,
'\0'); sprintf(c,
" xmlns='%s'", ns); }
153 if(to != NULL) { c = strchr(c,
'\0'); sprintf(c,
" to='%s'", to); }
154 if(from != NULL) { c = strchr(c,
'\0'); sprintf(c,
" from='%s'", from); }
155 if(version != NULL) { c = strchr(c,
'\0'); sprintf(c,
" version='%s'", version); }
157 c = strchr(c,
'\0'); sprintf(c,
">");
159 assert(buf->
len == strlen(buf->
data)+1);