annotate plugins/jabber/jid.c @ 1636:b16aa4569521

[gaim-migrate @ 1646] ha. that only took me an hour to get the joke. and i'm the one that made it. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 23 Mar 2001 13:03:45 +0000
parents afa63ac2fd84
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1347
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * This program is free software; you can redistribute it and/or modify
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 * it under the terms of the GNU General Public License as published by
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * the Free Software Foundation; either version 2 of the License, or
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 * (at your option) any later version.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 *
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * This program is distributed in the hope that it will be useful,
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 * GNU General Public License for more details.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 *
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * You should have received a copy of the GNU General Public License
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * along with this program; if not, write to the Free Software
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 *
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * Jabber
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 #include "jabber.h"
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 jid jid_safe(jid id)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 char *str;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 if(strlen(id->server) == 0 || strlen(id->server) > 255)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 return NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 /* lowercase the hostname, make sure it's valid characters */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 for(str = id->server; *str != '\0'; str++)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 *str = tolower(*str);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 if(!(isalnum(*str) || *str == '.' || *str == '-' || *str == '_')) return NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 /* cut off the user */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 if(id->user != NULL && strlen(id->user) > 64)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 id->user[64] = '\0';
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 /* check for low and invalid ascii characters in the username */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 if(id->user != NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 for(str = id->user; *str != '\0'; str++)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 if(*str <= 32 || *str == ':' || *str == '@' || *str == '<' || *str == '>' || *str == '\'' || *str == '"' || *str == '&') return NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 return id;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 jid jid_new(pool p, char *idstr)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 char *server, *resource, *type, *str;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 jid id;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 if(p == NULL || idstr == NULL || strlen(idstr) == 0)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 return NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 /* user@server/resource */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 str = pstrdup(p, idstr);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 id = pmalloc(p,sizeof(struct jid_struct));
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 id->full = id->server = id->user = id->resource = NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 id->p = p;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 id->next = NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 resource = strstr(str,"/");
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 if(resource != NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 *resource = '\0';
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 ++resource;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 if(strlen(resource) > 0)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 id->resource = resource;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 }else{
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 resource = str + strlen(str); /* point to end */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76 type = strstr(str,":");
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 if(type != NULL && type < resource)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 *type = '\0';
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 ++type;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81 str = type; /* ignore the type: prefix */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84 server = strstr(str,"@");
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 if(server == NULL || server > resource)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 { /* if there's no @, it's just the server address */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 id->server = str;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 }else{
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 *server = '\0';
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90 ++server;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 id->server = server;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 if(strlen(str) > 0)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 id->user = str;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96 return jid_safe(id);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99 void jid_set(jid id, char *str, int item)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 char *old;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 if(id == NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 return;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 /* invalidate the cached copy */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 id->full = NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109 switch(item)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111 case JID_RESOURCE:
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112 if(str != NULL && strlen(str) != 0)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113 id->resource = pstrdup(id->p, str);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 else
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115 id->resource = NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116 break;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 case JID_USER:
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118 old = id->user;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119 if(str != NULL && strlen(str) != 0)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 id->user = pstrdup(id->p, str);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 else
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122 id->user = NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123 if(jid_safe(id) == NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
124 id->user = old; /* revert if invalid */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
125 break;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126 case JID_SERVER:
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127 old = id->server;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 id->server = pstrdup(id->p, str);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 if(jid_safe(id) == NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 id->server = old; /* revert if invalid */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131 break;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 char *jid_full(jid id)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 spool s;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 if(id == NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 return NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 /* use cached copy */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144 if(id->full != NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 return id->full;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 s = spool_new(id->p);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 if(id->user != NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 spooler(s, id->user,"@",s);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152 spool_add(s, id->server);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 if(id->resource != NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155 spooler(s, "/",id->resource,s);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157 id->full = spool_print(s);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 return id->full;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 /* parses a /resource?name=value&foo=bar into an xmlnode representing <resource name="value" foo="bar"/> */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 xmlnode jid_xres(jid id)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 char *cur, *qmark, *amp, *eq;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 xmlnode x;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167 if(id == NULL || id->resource == NULL) return NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169 cur = pstrdup(id->p, id->resource);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 qmark = strstr(cur, "?");
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171 if(qmark == NULL) return NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
172 *qmark = '\0';
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
173 qmark++;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175 x = _xmlnode_new(id->p, cur, NTYPE_TAG);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 cur = qmark;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 while(cur != '\0')
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180 eq = strstr(cur, "=");
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 if(eq == NULL) break;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 *eq = '\0';
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 eq++;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185 amp = strstr(eq, "&");
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 if(amp != NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 *amp = '\0';
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 amp++;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 xmlnode_put_attrib(x,cur,eq);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 if(amp != NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 cur = amp;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 else
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197 break;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 return x;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 /* local utils */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 int _jid_nullstrcmp(char *a, char *b)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 if(a == NULL && b == NULL) return 0;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 if(a == NULL || b == NULL) return -1;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 return strcmp(a,b);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 int _jid_nullstrcasecmp(char *a, char *b)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 if(a == NULL && b == NULL) return 0;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 if(a == NULL || b == NULL) return -1;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 return strcasecmp(a,b);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217 int jid_cmp(jid a, jid b)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 if(a == NULL || b == NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 return -1;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222 if(_jid_nullstrcmp(a->resource, b->resource) != 0) return -1;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 if(_jid_nullstrcasecmp(a->user, b->user) != 0) return -1;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 if(_jid_nullstrcmp(a->server, b->server) != 0) return -1;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 return 0;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
229 /* suggested by Anders Qvist <quest@valdez.netg.se> */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 int jid_cmpx(jid a, jid b, int parts)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232 if(a == NULL || b == NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
233 return -1;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 if(parts & JID_RESOURCE && _jid_nullstrcmp(a->resource, b->resource) != 0) return -1;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 if(parts & JID_USER && _jid_nullstrcasecmp(a->user, b->user) != 0) return -1;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237 if(parts & JID_SERVER && _jid_nullstrcmp(a->server, b->server) != 0) return -1;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
239 return 0;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242 /* makes a copy of b in a's pool, requires a valid a first! */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243 jid jid_append(jid a, jid b)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245 jid next;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247 if(a == NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 return NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 if(b == NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 return a;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253 next = a;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 while(next != NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 /* check for dups */
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 if(jid_cmp(next,b) == 0)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 break;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 if(next->next == NULL)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 next->next = jid_new(a->p,jid_full(b));
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 next = next->next;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263 return a;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 xmlnode jid_nodescan(jid id, xmlnode x)
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 xmlnode cur;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 pool p;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 jid tmp;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 if(id == NULL || xmlnode_get_firstchild(x) == NULL) return NULL;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 p = pool_new();
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275 for(cur = xmlnode_get_firstchild(x); cur != NULL; cur = xmlnode_get_nextsibling(cur))
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 {
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 if(xmlnode_get_type(cur) != NTYPE_TAG) continue;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 tmp = jid_new(p,xmlnode_get_attrib(cur,"jid"));
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 if(tmp == NULL) continue;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 if(jid_cmp(tmp,id) == 0) break;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 }
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 pool_free(p);
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286 return cur;
afa63ac2fd84 [gaim-migrate @ 1357]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 }