Changeset 204:c13df6bb0135 for wokkel
- Timestamp:
- Oct 3, 2016, 8:49:10 AM (6 years ago)
- Branch:
- default
- rebase_source:
- 2799a3d645058f1131ac7b5a41ed308780cbb5ab
- Location:
- wokkel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
wokkel/compat.py
r200 r204 10 10 from __future__ import division, absolute_import 11 11 12 from twisted.python.deprecate import deprecatedModuleAttribute13 from twisted.python.versions import Version14 12 from twisted.words.protocols.jabber import xmlstream 15 13 -
wokkel/muc.py
r200 r204 10 10 U{XEP-0045<http://xmpp.org/extensions/xep-0045.html>}. 11 11 """ 12 13 from __future__ import division, absolute_import 14 12 15 from dateutil.tz import tzutc 13 16 … … 15 18 16 19 from twisted.internet import defer 20 from twisted.python.compat import unicode 17 21 from twisted.python.constants import Values, ValueConstant 18 22 from twisted.words.protocols.jabber import jid, error, xmlstream … … 73 77 L{STATUS_CODE}. Instances of this class provide L{IMUCStatuses}, that 74 78 defines the supported operations. Even though this class currently derives 75 from C{set}, future versions might not. This provides an upgrade path to79 from L{set}, future versions might not. This provides an upgrade path to 76 80 cater for extensible status conditions, as defined in 77 81 U{XEP-0306<http://xmpp.org/extensions/xep-0306.html>}. … … 225 229 226 230 @param reason: Optional reason for the destruction of this room. 227 @type reason: C{unicode}.231 @type reason: L{unicode}. 228 232 229 233 @param alternate: Optional room JID of an alternate venue. … … 231 235 232 236 @param password: Optional password for entering the alternate venue. 233 @type password: C{unicode}237 @type password: L{unicode} 234 238 """ 235 239 … … 274 278 Render into a domish Element. 275 279 276 @param legacyDelay: If C{True} send the delayed delivery information280 @param legacyDelay: If L{True} send the delayed delivery information 277 281 in legacy format. 278 282 """ … … 324 328 (where the character count is the characters of the complete XML 325 329 stanzas, not only their XML character data). 326 @type maxchars: C{int}330 @type maxchars: L{int} 327 331 328 332 @ivar maxstanzas: Limit the total number of messages in the history to "X". 329 @type mazstanzas: C{int}333 @type mazstanzas: L{int} 330 334 331 335 @ivar seconds: Send only the messages received in the last "X" seconds. 332 @type seconds: C{int}336 @type seconds: L{int} 333 337 334 338 @ivar since: Send only the messages received since the datetime specified. … … 392 396 393 397 @ivar affiliation: Affiliation of the entity to the room. 394 @type affiliation: C{unicode}398 @type affiliation: L{unicode} 395 399 396 400 @ivar role: Role of the entity in the room. 397 @type role: C{unicode}401 @type role: L{unicode} 398 402 399 403 @ivar entity: The real JID of the entity this presence is from. … … 405 409 406 410 @ivar nick: The nick name of the entity in the room. 407 @type nick: C{unicode}411 @type nick: L{unicode} 408 412 """ 409 413 … … 546 550 @param timeout: The number of seconds to wait before the deferred is 547 551 timed out. 548 @type timeout: C{int}552 @type timeout: L{int} 549 553 550 554 The deferred object L{defer.Deferred} is returned. … … 592 596 593 597 @param nick: The nick name for the entitity joining the room. 594 @type nick: C{unicode}598 @type nick: L{unicode} 595 599 596 600 @param historyOptions: Options for conversation history sent by the … … 599 603 600 604 @param password: Optional password for the room. 601 @type password: C{unicode}605 @type password: L{unicode} 602 606 603 607 @return: A deferred that fires when the entity is in the room or an … … 625 629 626 630 @param nick: The new nick name within the room. 627 @type nick: C{unicode}631 @type nick: L{unicode} 628 632 """ 629 633 occupantJID = jid.JID(tuple=(roomJID.user, roomJID.host, nick)) … … 643 647 @param show: The availability of the entity. Common values are xa, 644 648 available, etc 645 @type show: C{unicode}649 @type show: L{unicode} 646 650 647 651 @param status: The current status of the entity. 648 @type status: C{unicode}652 @type status: L{unicode} 649 653 """ 650 654 occupantJID = self._roomOccupantMap[roomJID] … … 701 705 702 706 @param subject: The subject you want to set. 703 @type subject: C{unicode}707 @type subject: L{unicode} 704 708 """ 705 709 message = GroupChat(roomJID.userhostJID(), subject=subject) … … 720 724 721 725 @param reason: The reason for the invite. 722 @type reason: C{unicode}726 @type reason: L{unicode} 723 727 """ 724 728 message = InviteMessage(recipient=roomJID, invitee=invitee, … … 752 756 @type roomJID: L{JID<twisted.words.protocols.jabber.jid.JID>} 753 757 754 @param options: A mapping of field names to values, or C{None} to758 @param options: A mapping of field names to values, or L{None} to 755 759 cancel. 756 @type options: C{dict}760 @type options: L{dict} 757 761 """ 758 762 if options is None: … … 784 788 @param messages: The history to send to the room as an ordered list of 785 789 message, represented by a dictionary with the keys 786 C{'stanza'}, holding the original stanza a787 L{domish.Element}, and C{'timestamp'} with the790 L{'stanza'}, holding the original stanza a 791 L{domish.Element}, and L{'timestamp'} with the 788 792 timestamp. 789 @type messages: C{list} of L{domish.Element}793 @type messages: L{list} of L{domish.Element} 790 794 """ 791 795 … … 819 823 820 824 @return: A deferred that fires with the room's configuration form as 821 a L{data_form.Form} or C{None} if there are no configuration825 a L{data_form.Form} or L{None} if there are no configuration 822 826 options available. 823 827 """ … … 839 843 @type roomJID: L{JID<twisted.words.protocols.jabber.jid.JID>} 840 844 841 @param options: A mapping of field names to values, or C{None} to845 @param options: A mapping of field names to values, or L{None} to 842 846 cancel. 843 @type options: C{dict}847 @type options: L{dict} 844 848 """ 845 849 if options is None: … … 963 967 964 968 @param entities: The list of entities to change for a room. 965 @type entities: C{list} of969 @type entities: L{list} of 966 970 L{JID<twisted.words.protocols.jabber.jid.JID>} 967 971 968 972 @param affiliation: The affilation to the entities will acquire. 969 @type affiliation: C{unicode}973 @type affiliation: L{unicode} 970 974 971 975 @param sender: The entity sending the request. … … 989 993 990 994 @param nick: The nick name for the user in this room. 991 @type nick: C{unicode}995 @type nick: L{unicode} 992 996 993 997 @param reason: The reason for granting voice to the entity. 994 @type reason: C{unicode}998 @type reason: L{unicode} 995 999 996 1000 @param sender: The entity sending the request. … … 1012 1016 1013 1017 @param nick: The nick name for the user in this room. 1014 @type nick: C{unicode}1018 @type nick: L{unicode} 1015 1019 1016 1020 @param reason: The reason for revoking voice from the entity. 1017 @type reason: C{unicode}1021 @type reason: L{unicode} 1018 1022 1019 1023 @param sender: The entity sending the request. … … 1032 1036 1033 1037 @param nick: The nick name for the user in this room. 1034 @type nick: C{unicode}1038 @type nick: L{unicode} 1035 1039 1036 1040 @param reason: The reason for granting moderation to the entity. 1037 @type reason: C{unicode}1041 @type reason: L{unicode} 1038 1042 1039 1043 @param sender: The entity sending the request. … … 1055 1059 1056 1060 @param reason: The reason for banning the entity. 1057 @type reason: C{unicode}1061 @type reason: L{unicode} 1058 1062 1059 1063 @param sender: The entity sending the request. … … 1072 1076 1073 1077 @param nick: The occupant to be banned. 1074 @type nick: C{unicode}1078 @type nick: L{unicode} 1075 1079 1076 1080 @param reason: The reason given for the kick. 1077 @type reason: C{unicode}1081 @type reason: L{unicode} 1078 1082 1079 1083 @param sender: The entity sending the request. … … 1092 1096 1093 1097 @param reason: The reason for the destruction of the room. 1094 @type reason: C{unicode}1098 @type reason: L{unicode} 1095 1099 1096 1100 @param alternate: The JID of the room suggested as an alternate venue. … … 1132 1136 1133 1137 @ivar nick: The nick name for the client in this room. 1134 @type nick: C{unicode}1138 @type nick: L{unicode} 1135 1139 1136 1140 @ivar occupantJID: The JID of the occupant in the room. Generated from … … 1142 1146 L{MUCClientProtocol.getConfiguration} and 1143 1147 L{MUCClientProtocol.configure}. 1144 @type locked: C{bool}1148 @type locked: L{bool} 1145 1149 """ 1146 1150 … … 1187 1191 1188 1192 @param nick: The nick for the user in the MUC room. 1189 @type nick: C{unicode}1193 @type nick: L{unicode} 1190 1194 """ 1191 1195 return self.roster.get(nick) … … 1214 1218 room. Note that a particular entity can only join a room once 1215 1219 at a time. 1216 @type _rooms: C{dict}1220 @type _rooms: L{dict} 1217 1221 """ 1218 1222 … … 1399 1403 @type room: L{Room} 1400 1404 1401 @param user: The user that sent the message, or C{None} if it was a1405 @param user: The user that sent the message, or L{None} if it was a 1402 1406 message from the room itself. 1403 1407 @type user: L{User} … … 1420 1424 @type room: L{Room} 1421 1425 1422 @param user: The user that sent the message, or C{None} if it was a1426 @param user: The user that sent the message, or L{None} if it was a 1423 1427 message from the room itself. 1424 1428 @type user: L{User} … … 1439 1443 1440 1444 @param nick: The nick name for the entitity joining the room. 1441 @type nick: C{unicode}1445 @type nick: L{unicode} 1442 1446 1443 1447 @param historyOptions: Options for conversation history sent by the … … 1446 1450 1447 1451 @param password: Optional password for the room. 1448 @type password: C{unicode}1452 @type password: L{unicode} 1449 1453 1450 1454 @return: A deferred that fires with the room when the entity is in the … … 1483 1487 1484 1488 @param nick: The new nick name within the room. 1485 @type nick: C{unicode}1489 @type nick: L{unicode} 1486 1490 """ 1487 1491 def cb(presence): … … 1525 1529 @param show: The availability of the entity. Common values are xa, 1526 1530 available, etc 1527 @type show: C{unicode}1531 @type show: L{unicode} 1528 1532 1529 1533 @param status: The current status of the entity. 1530 @type status: C{unicode}1534 @type status: L{unicode} 1531 1535 """ 1532 1536 room = self._getRoom(roomJID) … … 1544 1548 1545 1549 @param reason: The reason for the destruction of the room. 1546 @type reason: C{unicode}1550 @type reason: L{unicode} 1547 1551 1548 1552 @param alternate: The JID of the room suggested as an alternate venue. -
wokkel/test/test_muc.py
r185 r204 6 6 """ 7 7 8 from __future__ import division, absolute_import 9 8 10 from datetime import datetime 9 11 from dateutil.tz import tzutc … … 13 15 from twisted.trial import unittest 14 16 from twisted.internet import defer, task 17 from twisted.python.compat import iteritems, unicode 15 18 from twisted.words.xish import domish, xpath 16 19 from twisted.words.protocols.jabber.jid import JID … … 79 82 } 80 83 81 for code, condition in codes.iteritems():84 for code, condition in iteritems(codes): 82 85 constantName = condition.replace('-', '_').upper() 83 86 self.assertEqual(getattr(muc.STATUS_CODE, constantName), … … 824 827 self.assertNotIdentical(None, nodes, 'Missing query element') 825 828 826 self.assertRaises(StopIteration, n odes[0].elements().next)829 self.assertRaises(StopIteration, next, nodes[0].elements()) 827 830 828 831 xml = u""" … … 970 973 self.assertNotIdentical(None, nodes, 'Missing query element') 971 974 972 self.assertRaises(StopIteration, n odes[0].elements().next)975 self.assertRaises(StopIteration, next, nodes[0].elements()) 973 976 974 977 xml = u"""
Note: See TracChangeset
for help on using the changeset viewer.