|
1 #!/usr/bin/env python |
|
2 # |
|
3 # Copyright 2007 Google Inc. |
|
4 # |
|
5 # Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 # you may not use this file except in compliance with the License. |
|
7 # You may obtain a copy of the License at |
|
8 # |
|
9 # http://www.apache.org/licenses/LICENSE-2.0 |
|
10 # |
|
11 # Unless required by applicable law or agreed to in writing, software |
|
12 # distributed under the License is distributed on an "AS IS" BASIS, |
|
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 # See the License for the specific language governing permissions and |
|
15 # limitations under the License. |
|
16 # |
|
17 |
|
18 from google.net.proto import ProtocolBuffer |
|
19 import array |
|
20 import dummy_thread as thread |
|
21 |
|
22 __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit |
|
23 unusednames=printElemNumber,debug_strs no-special""" |
|
24 |
|
25 class XmppServiceError(ProtocolBuffer.ProtocolMessage): |
|
26 |
|
27 UNSPECIFIED_ERROR = 1 |
|
28 INVALID_JID = 2 |
|
29 NO_BODY = 3 |
|
30 INVALID_XML = 4 |
|
31 INVALID_TYPE = 5 |
|
32 |
|
33 _ErrorCode_NAMES = { |
|
34 1: "UNSPECIFIED_ERROR", |
|
35 2: "INVALID_JID", |
|
36 3: "NO_BODY", |
|
37 4: "INVALID_XML", |
|
38 5: "INVALID_TYPE", |
|
39 } |
|
40 |
|
41 def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, "") |
|
42 ErrorCode_Name = classmethod(ErrorCode_Name) |
|
43 |
|
44 |
|
45 def __init__(self, contents=None): |
|
46 pass |
|
47 if contents is not None: self.MergeFromString(contents) |
|
48 |
|
49 |
|
50 def MergeFrom(self, x): |
|
51 assert x is not self |
|
52 |
|
53 def Equals(self, x): |
|
54 if x is self: return 1 |
|
55 return 1 |
|
56 |
|
57 def IsInitialized(self, debug_strs=None): |
|
58 initialized = 1 |
|
59 return initialized |
|
60 |
|
61 def ByteSize(self): |
|
62 n = 0 |
|
63 return n + 0 |
|
64 |
|
65 def Clear(self): |
|
66 pass |
|
67 |
|
68 def OutputUnchecked(self, out): |
|
69 pass |
|
70 |
|
71 def TryMerge(self, d): |
|
72 while d.avail() > 0: |
|
73 tt = d.getVarInt32() |
|
74 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
75 d.skipData(tt) |
|
76 |
|
77 |
|
78 def __str__(self, prefix="", printElemNumber=0): |
|
79 res="" |
|
80 return res |
|
81 |
|
82 |
|
83 def _BuildTagLookupTable(sparse, maxtag, default=None): |
|
84 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) |
|
85 |
|
86 |
|
87 _TEXT = _BuildTagLookupTable({ |
|
88 0: "ErrorCode", |
|
89 }, 0) |
|
90 |
|
91 _TYPES = _BuildTagLookupTable({ |
|
92 0: ProtocolBuffer.Encoder.NUMERIC, |
|
93 }, 0, ProtocolBuffer.Encoder.MAX_TYPE) |
|
94 |
|
95 _STYLE = """""" |
|
96 _STYLE_CONTENT_TYPE = """""" |
|
97 class PresenceRequest(ProtocolBuffer.ProtocolMessage): |
|
98 has_jid_ = 0 |
|
99 jid_ = "" |
|
100 has_from_jid_ = 0 |
|
101 from_jid_ = "" |
|
102 |
|
103 def __init__(self, contents=None): |
|
104 if contents is not None: self.MergeFromString(contents) |
|
105 |
|
106 def jid(self): return self.jid_ |
|
107 |
|
108 def set_jid(self, x): |
|
109 self.has_jid_ = 1 |
|
110 self.jid_ = x |
|
111 |
|
112 def clear_jid(self): |
|
113 if self.has_jid_: |
|
114 self.has_jid_ = 0 |
|
115 self.jid_ = "" |
|
116 |
|
117 def has_jid(self): return self.has_jid_ |
|
118 |
|
119 def from_jid(self): return self.from_jid_ |
|
120 |
|
121 def set_from_jid(self, x): |
|
122 self.has_from_jid_ = 1 |
|
123 self.from_jid_ = x |
|
124 |
|
125 def clear_from_jid(self): |
|
126 if self.has_from_jid_: |
|
127 self.has_from_jid_ = 0 |
|
128 self.from_jid_ = "" |
|
129 |
|
130 def has_from_jid(self): return self.has_from_jid_ |
|
131 |
|
132 |
|
133 def MergeFrom(self, x): |
|
134 assert x is not self |
|
135 if (x.has_jid()): self.set_jid(x.jid()) |
|
136 if (x.has_from_jid()): self.set_from_jid(x.from_jid()) |
|
137 |
|
138 def Equals(self, x): |
|
139 if x is self: return 1 |
|
140 if self.has_jid_ != x.has_jid_: return 0 |
|
141 if self.has_jid_ and self.jid_ != x.jid_: return 0 |
|
142 if self.has_from_jid_ != x.has_from_jid_: return 0 |
|
143 if self.has_from_jid_ and self.from_jid_ != x.from_jid_: return 0 |
|
144 return 1 |
|
145 |
|
146 def IsInitialized(self, debug_strs=None): |
|
147 initialized = 1 |
|
148 if (not self.has_jid_): |
|
149 initialized = 0 |
|
150 if debug_strs is not None: |
|
151 debug_strs.append('Required field: jid not set.') |
|
152 return initialized |
|
153 |
|
154 def ByteSize(self): |
|
155 n = 0 |
|
156 n += self.lengthString(len(self.jid_)) |
|
157 if (self.has_from_jid_): n += 1 + self.lengthString(len(self.from_jid_)) |
|
158 return n + 1 |
|
159 |
|
160 def Clear(self): |
|
161 self.clear_jid() |
|
162 self.clear_from_jid() |
|
163 |
|
164 def OutputUnchecked(self, out): |
|
165 out.putVarInt32(10) |
|
166 out.putPrefixedString(self.jid_) |
|
167 if (self.has_from_jid_): |
|
168 out.putVarInt32(18) |
|
169 out.putPrefixedString(self.from_jid_) |
|
170 |
|
171 def TryMerge(self, d): |
|
172 while d.avail() > 0: |
|
173 tt = d.getVarInt32() |
|
174 if tt == 10: |
|
175 self.set_jid(d.getPrefixedString()) |
|
176 continue |
|
177 if tt == 18: |
|
178 self.set_from_jid(d.getPrefixedString()) |
|
179 continue |
|
180 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
181 d.skipData(tt) |
|
182 |
|
183 |
|
184 def __str__(self, prefix="", printElemNumber=0): |
|
185 res="" |
|
186 if self.has_jid_: res+=prefix+("jid: %s\n" % self.DebugFormatString(self.jid_)) |
|
187 if self.has_from_jid_: res+=prefix+("from_jid: %s\n" % self.DebugFormatString(self.from_jid_)) |
|
188 return res |
|
189 |
|
190 |
|
191 def _BuildTagLookupTable(sparse, maxtag, default=None): |
|
192 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) |
|
193 |
|
194 kjid = 1 |
|
195 kfrom_jid = 2 |
|
196 |
|
197 _TEXT = _BuildTagLookupTable({ |
|
198 0: "ErrorCode", |
|
199 1: "jid", |
|
200 2: "from_jid", |
|
201 }, 2) |
|
202 |
|
203 _TYPES = _BuildTagLookupTable({ |
|
204 0: ProtocolBuffer.Encoder.NUMERIC, |
|
205 1: ProtocolBuffer.Encoder.STRING, |
|
206 2: ProtocolBuffer.Encoder.STRING, |
|
207 }, 2, ProtocolBuffer.Encoder.MAX_TYPE) |
|
208 |
|
209 _STYLE = """""" |
|
210 _STYLE_CONTENT_TYPE = """""" |
|
211 class PresenceResponse(ProtocolBuffer.ProtocolMessage): |
|
212 |
|
213 NORMAL = 0 |
|
214 AWAY = 1 |
|
215 DO_NOT_DISTURB = 2 |
|
216 CHAT = 3 |
|
217 EXTENDED_AWAY = 4 |
|
218 |
|
219 _SHOW_NAMES = { |
|
220 0: "NORMAL", |
|
221 1: "AWAY", |
|
222 2: "DO_NOT_DISTURB", |
|
223 3: "CHAT", |
|
224 4: "EXTENDED_AWAY", |
|
225 } |
|
226 |
|
227 def SHOW_Name(cls, x): return cls._SHOW_NAMES.get(x, "") |
|
228 SHOW_Name = classmethod(SHOW_Name) |
|
229 |
|
230 has_is_available_ = 0 |
|
231 is_available_ = 0 |
|
232 has_presence_ = 0 |
|
233 presence_ = 0 |
|
234 |
|
235 def __init__(self, contents=None): |
|
236 if contents is not None: self.MergeFromString(contents) |
|
237 |
|
238 def is_available(self): return self.is_available_ |
|
239 |
|
240 def set_is_available(self, x): |
|
241 self.has_is_available_ = 1 |
|
242 self.is_available_ = x |
|
243 |
|
244 def clear_is_available(self): |
|
245 if self.has_is_available_: |
|
246 self.has_is_available_ = 0 |
|
247 self.is_available_ = 0 |
|
248 |
|
249 def has_is_available(self): return self.has_is_available_ |
|
250 |
|
251 def presence(self): return self.presence_ |
|
252 |
|
253 def set_presence(self, x): |
|
254 self.has_presence_ = 1 |
|
255 self.presence_ = x |
|
256 |
|
257 def clear_presence(self): |
|
258 if self.has_presence_: |
|
259 self.has_presence_ = 0 |
|
260 self.presence_ = 0 |
|
261 |
|
262 def has_presence(self): return self.has_presence_ |
|
263 |
|
264 |
|
265 def MergeFrom(self, x): |
|
266 assert x is not self |
|
267 if (x.has_is_available()): self.set_is_available(x.is_available()) |
|
268 if (x.has_presence()): self.set_presence(x.presence()) |
|
269 |
|
270 def Equals(self, x): |
|
271 if x is self: return 1 |
|
272 if self.has_is_available_ != x.has_is_available_: return 0 |
|
273 if self.has_is_available_ and self.is_available_ != x.is_available_: return 0 |
|
274 if self.has_presence_ != x.has_presence_: return 0 |
|
275 if self.has_presence_ and self.presence_ != x.presence_: return 0 |
|
276 return 1 |
|
277 |
|
278 def IsInitialized(self, debug_strs=None): |
|
279 initialized = 1 |
|
280 if (not self.has_is_available_): |
|
281 initialized = 0 |
|
282 if debug_strs is not None: |
|
283 debug_strs.append('Required field: is_available not set.') |
|
284 return initialized |
|
285 |
|
286 def ByteSize(self): |
|
287 n = 0 |
|
288 if (self.has_presence_): n += 1 + self.lengthVarInt64(self.presence_) |
|
289 return n + 2 |
|
290 |
|
291 def Clear(self): |
|
292 self.clear_is_available() |
|
293 self.clear_presence() |
|
294 |
|
295 def OutputUnchecked(self, out): |
|
296 out.putVarInt32(8) |
|
297 out.putBoolean(self.is_available_) |
|
298 if (self.has_presence_): |
|
299 out.putVarInt32(16) |
|
300 out.putVarInt32(self.presence_) |
|
301 |
|
302 def TryMerge(self, d): |
|
303 while d.avail() > 0: |
|
304 tt = d.getVarInt32() |
|
305 if tt == 8: |
|
306 self.set_is_available(d.getBoolean()) |
|
307 continue |
|
308 if tt == 16: |
|
309 self.set_presence(d.getVarInt32()) |
|
310 continue |
|
311 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
312 d.skipData(tt) |
|
313 |
|
314 |
|
315 def __str__(self, prefix="", printElemNumber=0): |
|
316 res="" |
|
317 if self.has_is_available_: res+=prefix+("is_available: %s\n" % self.DebugFormatBool(self.is_available_)) |
|
318 if self.has_presence_: res+=prefix+("presence: %s\n" % self.DebugFormatInt32(self.presence_)) |
|
319 return res |
|
320 |
|
321 |
|
322 def _BuildTagLookupTable(sparse, maxtag, default=None): |
|
323 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) |
|
324 |
|
325 kis_available = 1 |
|
326 kpresence = 2 |
|
327 |
|
328 _TEXT = _BuildTagLookupTable({ |
|
329 0: "ErrorCode", |
|
330 1: "is_available", |
|
331 2: "presence", |
|
332 }, 2) |
|
333 |
|
334 _TYPES = _BuildTagLookupTable({ |
|
335 0: ProtocolBuffer.Encoder.NUMERIC, |
|
336 1: ProtocolBuffer.Encoder.NUMERIC, |
|
337 2: ProtocolBuffer.Encoder.NUMERIC, |
|
338 }, 2, ProtocolBuffer.Encoder.MAX_TYPE) |
|
339 |
|
340 _STYLE = """""" |
|
341 _STYLE_CONTENT_TYPE = """""" |
|
342 class XmppMessageRequest(ProtocolBuffer.ProtocolMessage): |
|
343 has_body_ = 0 |
|
344 body_ = "" |
|
345 has_raw_xml_ = 0 |
|
346 raw_xml_ = 0 |
|
347 has_type_ = 0 |
|
348 type_ = "chat" |
|
349 has_from_jid_ = 0 |
|
350 from_jid_ = "" |
|
351 |
|
352 def __init__(self, contents=None): |
|
353 self.jid_ = [] |
|
354 if contents is not None: self.MergeFromString(contents) |
|
355 |
|
356 def jid_size(self): return len(self.jid_) |
|
357 def jid_list(self): return self.jid_ |
|
358 |
|
359 def jid(self, i): |
|
360 return self.jid_[i] |
|
361 |
|
362 def set_jid(self, i, x): |
|
363 self.jid_[i] = x |
|
364 |
|
365 def add_jid(self, x): |
|
366 self.jid_.append(x) |
|
367 |
|
368 def clear_jid(self): |
|
369 self.jid_ = [] |
|
370 |
|
371 def body(self): return self.body_ |
|
372 |
|
373 def set_body(self, x): |
|
374 self.has_body_ = 1 |
|
375 self.body_ = x |
|
376 |
|
377 def clear_body(self): |
|
378 if self.has_body_: |
|
379 self.has_body_ = 0 |
|
380 self.body_ = "" |
|
381 |
|
382 def has_body(self): return self.has_body_ |
|
383 |
|
384 def raw_xml(self): return self.raw_xml_ |
|
385 |
|
386 def set_raw_xml(self, x): |
|
387 self.has_raw_xml_ = 1 |
|
388 self.raw_xml_ = x |
|
389 |
|
390 def clear_raw_xml(self): |
|
391 if self.has_raw_xml_: |
|
392 self.has_raw_xml_ = 0 |
|
393 self.raw_xml_ = 0 |
|
394 |
|
395 def has_raw_xml(self): return self.has_raw_xml_ |
|
396 |
|
397 def type(self): return self.type_ |
|
398 |
|
399 def set_type(self, x): |
|
400 self.has_type_ = 1 |
|
401 self.type_ = x |
|
402 |
|
403 def clear_type(self): |
|
404 if self.has_type_: |
|
405 self.has_type_ = 0 |
|
406 self.type_ = "chat" |
|
407 |
|
408 def has_type(self): return self.has_type_ |
|
409 |
|
410 def from_jid(self): return self.from_jid_ |
|
411 |
|
412 def set_from_jid(self, x): |
|
413 self.has_from_jid_ = 1 |
|
414 self.from_jid_ = x |
|
415 |
|
416 def clear_from_jid(self): |
|
417 if self.has_from_jid_: |
|
418 self.has_from_jid_ = 0 |
|
419 self.from_jid_ = "" |
|
420 |
|
421 def has_from_jid(self): return self.has_from_jid_ |
|
422 |
|
423 |
|
424 def MergeFrom(self, x): |
|
425 assert x is not self |
|
426 for i in xrange(x.jid_size()): self.add_jid(x.jid(i)) |
|
427 if (x.has_body()): self.set_body(x.body()) |
|
428 if (x.has_raw_xml()): self.set_raw_xml(x.raw_xml()) |
|
429 if (x.has_type()): self.set_type(x.type()) |
|
430 if (x.has_from_jid()): self.set_from_jid(x.from_jid()) |
|
431 |
|
432 def Equals(self, x): |
|
433 if x is self: return 1 |
|
434 if len(self.jid_) != len(x.jid_): return 0 |
|
435 for e1, e2 in zip(self.jid_, x.jid_): |
|
436 if e1 != e2: return 0 |
|
437 if self.has_body_ != x.has_body_: return 0 |
|
438 if self.has_body_ and self.body_ != x.body_: return 0 |
|
439 if self.has_raw_xml_ != x.has_raw_xml_: return 0 |
|
440 if self.has_raw_xml_ and self.raw_xml_ != x.raw_xml_: return 0 |
|
441 if self.has_type_ != x.has_type_: return 0 |
|
442 if self.has_type_ and self.type_ != x.type_: return 0 |
|
443 if self.has_from_jid_ != x.has_from_jid_: return 0 |
|
444 if self.has_from_jid_ and self.from_jid_ != x.from_jid_: return 0 |
|
445 return 1 |
|
446 |
|
447 def IsInitialized(self, debug_strs=None): |
|
448 initialized = 1 |
|
449 if (not self.has_body_): |
|
450 initialized = 0 |
|
451 if debug_strs is not None: |
|
452 debug_strs.append('Required field: body not set.') |
|
453 return initialized |
|
454 |
|
455 def ByteSize(self): |
|
456 n = 0 |
|
457 n += 1 * len(self.jid_) |
|
458 for i in xrange(len(self.jid_)): n += self.lengthString(len(self.jid_[i])) |
|
459 n += self.lengthString(len(self.body_)) |
|
460 if (self.has_raw_xml_): n += 2 |
|
461 if (self.has_type_): n += 1 + self.lengthString(len(self.type_)) |
|
462 if (self.has_from_jid_): n += 1 + self.lengthString(len(self.from_jid_)) |
|
463 return n + 1 |
|
464 |
|
465 def Clear(self): |
|
466 self.clear_jid() |
|
467 self.clear_body() |
|
468 self.clear_raw_xml() |
|
469 self.clear_type() |
|
470 self.clear_from_jid() |
|
471 |
|
472 def OutputUnchecked(self, out): |
|
473 for i in xrange(len(self.jid_)): |
|
474 out.putVarInt32(10) |
|
475 out.putPrefixedString(self.jid_[i]) |
|
476 out.putVarInt32(18) |
|
477 out.putPrefixedString(self.body_) |
|
478 if (self.has_raw_xml_): |
|
479 out.putVarInt32(24) |
|
480 out.putBoolean(self.raw_xml_) |
|
481 if (self.has_type_): |
|
482 out.putVarInt32(34) |
|
483 out.putPrefixedString(self.type_) |
|
484 if (self.has_from_jid_): |
|
485 out.putVarInt32(42) |
|
486 out.putPrefixedString(self.from_jid_) |
|
487 |
|
488 def TryMerge(self, d): |
|
489 while d.avail() > 0: |
|
490 tt = d.getVarInt32() |
|
491 if tt == 10: |
|
492 self.add_jid(d.getPrefixedString()) |
|
493 continue |
|
494 if tt == 18: |
|
495 self.set_body(d.getPrefixedString()) |
|
496 continue |
|
497 if tt == 24: |
|
498 self.set_raw_xml(d.getBoolean()) |
|
499 continue |
|
500 if tt == 34: |
|
501 self.set_type(d.getPrefixedString()) |
|
502 continue |
|
503 if tt == 42: |
|
504 self.set_from_jid(d.getPrefixedString()) |
|
505 continue |
|
506 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
507 d.skipData(tt) |
|
508 |
|
509 |
|
510 def __str__(self, prefix="", printElemNumber=0): |
|
511 res="" |
|
512 cnt=0 |
|
513 for e in self.jid_: |
|
514 elm="" |
|
515 if printElemNumber: elm="(%d)" % cnt |
|
516 res+=prefix+("jid%s: %s\n" % (elm, self.DebugFormatString(e))) |
|
517 cnt+=1 |
|
518 if self.has_body_: res+=prefix+("body: %s\n" % self.DebugFormatString(self.body_)) |
|
519 if self.has_raw_xml_: res+=prefix+("raw_xml: %s\n" % self.DebugFormatBool(self.raw_xml_)) |
|
520 if self.has_type_: res+=prefix+("type: %s\n" % self.DebugFormatString(self.type_)) |
|
521 if self.has_from_jid_: res+=prefix+("from_jid: %s\n" % self.DebugFormatString(self.from_jid_)) |
|
522 return res |
|
523 |
|
524 |
|
525 def _BuildTagLookupTable(sparse, maxtag, default=None): |
|
526 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) |
|
527 |
|
528 kjid = 1 |
|
529 kbody = 2 |
|
530 kraw_xml = 3 |
|
531 ktype = 4 |
|
532 kfrom_jid = 5 |
|
533 |
|
534 _TEXT = _BuildTagLookupTable({ |
|
535 0: "ErrorCode", |
|
536 1: "jid", |
|
537 2: "body", |
|
538 3: "raw_xml", |
|
539 4: "type", |
|
540 5: "from_jid", |
|
541 }, 5) |
|
542 |
|
543 _TYPES = _BuildTagLookupTable({ |
|
544 0: ProtocolBuffer.Encoder.NUMERIC, |
|
545 1: ProtocolBuffer.Encoder.STRING, |
|
546 2: ProtocolBuffer.Encoder.STRING, |
|
547 3: ProtocolBuffer.Encoder.NUMERIC, |
|
548 4: ProtocolBuffer.Encoder.STRING, |
|
549 5: ProtocolBuffer.Encoder.STRING, |
|
550 }, 5, ProtocolBuffer.Encoder.MAX_TYPE) |
|
551 |
|
552 _STYLE = """""" |
|
553 _STYLE_CONTENT_TYPE = """""" |
|
554 class XmppMessageResponse(ProtocolBuffer.ProtocolMessage): |
|
555 |
|
556 NO_ERROR = 0 |
|
557 INVALID_JID = 1 |
|
558 OTHER_ERROR = 2 |
|
559 |
|
560 _XmppMessageStatus_NAMES = { |
|
561 0: "NO_ERROR", |
|
562 1: "INVALID_JID", |
|
563 2: "OTHER_ERROR", |
|
564 } |
|
565 |
|
566 def XmppMessageStatus_Name(cls, x): return cls._XmppMessageStatus_NAMES.get(x, "") |
|
567 XmppMessageStatus_Name = classmethod(XmppMessageStatus_Name) |
|
568 |
|
569 |
|
570 def __init__(self, contents=None): |
|
571 self.status_ = [] |
|
572 if contents is not None: self.MergeFromString(contents) |
|
573 |
|
574 def status_size(self): return len(self.status_) |
|
575 def status_list(self): return self.status_ |
|
576 |
|
577 def status(self, i): |
|
578 return self.status_[i] |
|
579 |
|
580 def set_status(self, i, x): |
|
581 self.status_[i] = x |
|
582 |
|
583 def add_status(self, x): |
|
584 self.status_.append(x) |
|
585 |
|
586 def clear_status(self): |
|
587 self.status_ = [] |
|
588 |
|
589 |
|
590 def MergeFrom(self, x): |
|
591 assert x is not self |
|
592 for i in xrange(x.status_size()): self.add_status(x.status(i)) |
|
593 |
|
594 def Equals(self, x): |
|
595 if x is self: return 1 |
|
596 if len(self.status_) != len(x.status_): return 0 |
|
597 for e1, e2 in zip(self.status_, x.status_): |
|
598 if e1 != e2: return 0 |
|
599 return 1 |
|
600 |
|
601 def IsInitialized(self, debug_strs=None): |
|
602 initialized = 1 |
|
603 return initialized |
|
604 |
|
605 def ByteSize(self): |
|
606 n = 0 |
|
607 n += 1 * len(self.status_) |
|
608 for i in xrange(len(self.status_)): n += self.lengthVarInt64(self.status_[i]) |
|
609 return n + 0 |
|
610 |
|
611 def Clear(self): |
|
612 self.clear_status() |
|
613 |
|
614 def OutputUnchecked(self, out): |
|
615 for i in xrange(len(self.status_)): |
|
616 out.putVarInt32(8) |
|
617 out.putVarInt32(self.status_[i]) |
|
618 |
|
619 def TryMerge(self, d): |
|
620 while d.avail() > 0: |
|
621 tt = d.getVarInt32() |
|
622 if tt == 8: |
|
623 self.add_status(d.getVarInt32()) |
|
624 continue |
|
625 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
626 d.skipData(tt) |
|
627 |
|
628 |
|
629 def __str__(self, prefix="", printElemNumber=0): |
|
630 res="" |
|
631 cnt=0 |
|
632 for e in self.status_: |
|
633 elm="" |
|
634 if printElemNumber: elm="(%d)" % cnt |
|
635 res+=prefix+("status%s: %s\n" % (elm, self.DebugFormatInt32(e))) |
|
636 cnt+=1 |
|
637 return res |
|
638 |
|
639 |
|
640 def _BuildTagLookupTable(sparse, maxtag, default=None): |
|
641 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) |
|
642 |
|
643 kstatus = 1 |
|
644 |
|
645 _TEXT = _BuildTagLookupTable({ |
|
646 0: "ErrorCode", |
|
647 1: "status", |
|
648 }, 1) |
|
649 |
|
650 _TYPES = _BuildTagLookupTable({ |
|
651 0: ProtocolBuffer.Encoder.NUMERIC, |
|
652 1: ProtocolBuffer.Encoder.NUMERIC, |
|
653 }, 1, ProtocolBuffer.Encoder.MAX_TYPE) |
|
654 |
|
655 _STYLE = """""" |
|
656 _STYLE_CONTENT_TYPE = """""" |
|
657 class XmppInviteRequest(ProtocolBuffer.ProtocolMessage): |
|
658 has_jid_ = 0 |
|
659 jid_ = "" |
|
660 has_from_jid_ = 0 |
|
661 from_jid_ = "" |
|
662 |
|
663 def __init__(self, contents=None): |
|
664 if contents is not None: self.MergeFromString(contents) |
|
665 |
|
666 def jid(self): return self.jid_ |
|
667 |
|
668 def set_jid(self, x): |
|
669 self.has_jid_ = 1 |
|
670 self.jid_ = x |
|
671 |
|
672 def clear_jid(self): |
|
673 if self.has_jid_: |
|
674 self.has_jid_ = 0 |
|
675 self.jid_ = "" |
|
676 |
|
677 def has_jid(self): return self.has_jid_ |
|
678 |
|
679 def from_jid(self): return self.from_jid_ |
|
680 |
|
681 def set_from_jid(self, x): |
|
682 self.has_from_jid_ = 1 |
|
683 self.from_jid_ = x |
|
684 |
|
685 def clear_from_jid(self): |
|
686 if self.has_from_jid_: |
|
687 self.has_from_jid_ = 0 |
|
688 self.from_jid_ = "" |
|
689 |
|
690 def has_from_jid(self): return self.has_from_jid_ |
|
691 |
|
692 |
|
693 def MergeFrom(self, x): |
|
694 assert x is not self |
|
695 if (x.has_jid()): self.set_jid(x.jid()) |
|
696 if (x.has_from_jid()): self.set_from_jid(x.from_jid()) |
|
697 |
|
698 def Equals(self, x): |
|
699 if x is self: return 1 |
|
700 if self.has_jid_ != x.has_jid_: return 0 |
|
701 if self.has_jid_ and self.jid_ != x.jid_: return 0 |
|
702 if self.has_from_jid_ != x.has_from_jid_: return 0 |
|
703 if self.has_from_jid_ and self.from_jid_ != x.from_jid_: return 0 |
|
704 return 1 |
|
705 |
|
706 def IsInitialized(self, debug_strs=None): |
|
707 initialized = 1 |
|
708 if (not self.has_jid_): |
|
709 initialized = 0 |
|
710 if debug_strs is not None: |
|
711 debug_strs.append('Required field: jid not set.') |
|
712 return initialized |
|
713 |
|
714 def ByteSize(self): |
|
715 n = 0 |
|
716 n += self.lengthString(len(self.jid_)) |
|
717 if (self.has_from_jid_): n += 1 + self.lengthString(len(self.from_jid_)) |
|
718 return n + 1 |
|
719 |
|
720 def Clear(self): |
|
721 self.clear_jid() |
|
722 self.clear_from_jid() |
|
723 |
|
724 def OutputUnchecked(self, out): |
|
725 out.putVarInt32(10) |
|
726 out.putPrefixedString(self.jid_) |
|
727 if (self.has_from_jid_): |
|
728 out.putVarInt32(18) |
|
729 out.putPrefixedString(self.from_jid_) |
|
730 |
|
731 def TryMerge(self, d): |
|
732 while d.avail() > 0: |
|
733 tt = d.getVarInt32() |
|
734 if tt == 10: |
|
735 self.set_jid(d.getPrefixedString()) |
|
736 continue |
|
737 if tt == 18: |
|
738 self.set_from_jid(d.getPrefixedString()) |
|
739 continue |
|
740 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
741 d.skipData(tt) |
|
742 |
|
743 |
|
744 def __str__(self, prefix="", printElemNumber=0): |
|
745 res="" |
|
746 if self.has_jid_: res+=prefix+("jid: %s\n" % self.DebugFormatString(self.jid_)) |
|
747 if self.has_from_jid_: res+=prefix+("from_jid: %s\n" % self.DebugFormatString(self.from_jid_)) |
|
748 return res |
|
749 |
|
750 |
|
751 def _BuildTagLookupTable(sparse, maxtag, default=None): |
|
752 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) |
|
753 |
|
754 kjid = 1 |
|
755 kfrom_jid = 2 |
|
756 |
|
757 _TEXT = _BuildTagLookupTable({ |
|
758 0: "ErrorCode", |
|
759 1: "jid", |
|
760 2: "from_jid", |
|
761 }, 2) |
|
762 |
|
763 _TYPES = _BuildTagLookupTable({ |
|
764 0: ProtocolBuffer.Encoder.NUMERIC, |
|
765 1: ProtocolBuffer.Encoder.STRING, |
|
766 2: ProtocolBuffer.Encoder.STRING, |
|
767 }, 2, ProtocolBuffer.Encoder.MAX_TYPE) |
|
768 |
|
769 _STYLE = """""" |
|
770 _STYLE_CONTENT_TYPE = """""" |
|
771 class XmppInviteResponse(ProtocolBuffer.ProtocolMessage): |
|
772 |
|
773 def __init__(self, contents=None): |
|
774 pass |
|
775 if contents is not None: self.MergeFromString(contents) |
|
776 |
|
777 |
|
778 def MergeFrom(self, x): |
|
779 assert x is not self |
|
780 |
|
781 def Equals(self, x): |
|
782 if x is self: return 1 |
|
783 return 1 |
|
784 |
|
785 def IsInitialized(self, debug_strs=None): |
|
786 initialized = 1 |
|
787 return initialized |
|
788 |
|
789 def ByteSize(self): |
|
790 n = 0 |
|
791 return n + 0 |
|
792 |
|
793 def Clear(self): |
|
794 pass |
|
795 |
|
796 def OutputUnchecked(self, out): |
|
797 pass |
|
798 |
|
799 def TryMerge(self, d): |
|
800 while d.avail() > 0: |
|
801 tt = d.getVarInt32() |
|
802 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
803 d.skipData(tt) |
|
804 |
|
805 |
|
806 def __str__(self, prefix="", printElemNumber=0): |
|
807 res="" |
|
808 return res |
|
809 |
|
810 |
|
811 def _BuildTagLookupTable(sparse, maxtag, default=None): |
|
812 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) |
|
813 |
|
814 |
|
815 _TEXT = _BuildTagLookupTable({ |
|
816 0: "ErrorCode", |
|
817 }, 0) |
|
818 |
|
819 _TYPES = _BuildTagLookupTable({ |
|
820 0: ProtocolBuffer.Encoder.NUMERIC, |
|
821 }, 0, ProtocolBuffer.Encoder.MAX_TYPE) |
|
822 |
|
823 _STYLE = """""" |
|
824 _STYLE_CONTENT_TYPE = """""" |
|
825 |
|
826 __all__ = ['XmppServiceError','PresenceRequest','PresenceResponse','XmppMessageRequest','XmppMessageResponse','XmppInviteRequest','XmppInviteResponse'] |