Changeset 204:c13df6bb0135


Ignore:
Timestamp:
Oct 3, 2016, 8:49:10 AM (4 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
rebase_source:
2799a3d645058f1131ac7b5a41ed308780cbb5ab
Message:

imported patch py3-muc.patch

Location:
wokkel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wokkel/compat.py

    r200 r204  
    1010from __future__ import division, absolute_import
    1111
    12 from twisted.python.deprecate import deprecatedModuleAttribute
    13 from twisted.python.versions import Version
    1412from twisted.words.protocols.jabber import xmlstream
    1513
  • wokkel/muc.py

    r200 r204  
    1010U{XEP-0045<http://xmpp.org/extensions/xep-0045.html>}.
    1111"""
     12
     13from __future__ import division, absolute_import
     14
    1215from dateutil.tz import tzutc
    1316
     
    1518
    1619from twisted.internet import defer
     20from twisted.python.compat import unicode
    1721from twisted.python.constants import Values, ValueConstant
    1822from twisted.words.protocols.jabber import jid, error, xmlstream
     
    7377    L{STATUS_CODE}. Instances of this class provide L{IMUCStatuses}, that
    7478    defines the supported operations. Even though this class currently derives
    75     from C{set}, future versions might not. This provides an upgrade path to
     79    from L{set}, future versions might not. This provides an upgrade path to
    7680    cater for extensible status conditions, as defined in
    7781    U{XEP-0306<http://xmpp.org/extensions/xep-0306.html>}.
     
    225229
    226230    @param reason: Optional reason for the destruction of this room.
    227     @type reason: C{unicode}.
     231    @type reason: L{unicode}.
    228232
    229233    @param alternate: Optional room JID of an alternate venue.
     
    231235
    232236    @param password: Optional password for entering the alternate venue.
    233     @type password: C{unicode}
     237    @type password: L{unicode}
    234238    """
    235239
     
    274278        Render into a domish Element.
    275279
    276         @param legacyDelay: If C{True} send the delayed delivery information
     280        @param legacyDelay: If L{True} send the delayed delivery information
    277281        in legacy format.
    278282        """
     
    324328        (where the character count is the characters of the complete XML
    325329        stanzas, not only their XML character data).
    326     @type maxchars: C{int}
     330    @type maxchars: L{int}
    327331
    328332    @ivar maxstanzas: Limit the total number of messages in the history to "X".
    329     @type mazstanzas: C{int}
     333    @type mazstanzas: L{int}
    330334
    331335    @ivar seconds: Send only the messages received in the last "X" seconds.
    332     @type seconds: C{int}
     336    @type seconds: L{int}
    333337
    334338    @ivar since: Send only the messages received since the datetime specified.
     
    392396
    393397    @ivar affiliation: Affiliation of the entity to the room.
    394     @type affiliation: C{unicode}
     398    @type affiliation: L{unicode}
    395399
    396400    @ivar role: Role of the entity in the room.
    397     @type role: C{unicode}
     401    @type role: L{unicode}
    398402
    399403    @ivar entity: The real JID of the entity this presence is from.
     
    405409
    406410    @ivar nick: The nick name of the entity in the room.
    407     @type nick: C{unicode}
     411    @type nick: L{unicode}
    408412    """
    409413
     
    546550        @param timeout: The number of seconds to wait before the deferred is
    547551            timed out.
    548         @type timeout: C{int}
     552        @type timeout: L{int}
    549553
    550554        The deferred object L{defer.Deferred} is returned.
     
    592596
    593597        @param nick: The nick name for the entitity joining the room.
    594         @type nick: C{unicode}
     598        @type nick: L{unicode}
    595599
    596600        @param historyOptions: Options for conversation history sent by the
     
    599603
    600604        @param password: Optional password for the room.
    601         @type password: C{unicode}
     605        @type password: L{unicode}
    602606
    603607        @return: A deferred that fires when the entity is in the room or an
     
    625629
    626630        @param nick: The new nick name within the room.
    627         @type nick: C{unicode}
     631        @type nick: L{unicode}
    628632        """
    629633        occupantJID = jid.JID(tuple=(roomJID.user, roomJID.host, nick))
     
    643647        @param show: The availability of the entity. Common values are xa,
    644648            available, etc
    645         @type show: C{unicode}
     649        @type show: L{unicode}
    646650
    647651        @param status: The current status of the entity.
    648         @type status: C{unicode}
     652        @type status: L{unicode}
    649653        """
    650654        occupantJID = self._roomOccupantMap[roomJID]
     
    701705
    702706        @param subject: The subject you want to set.
    703         @type subject: C{unicode}
     707        @type subject: L{unicode}
    704708        """
    705709        message = GroupChat(roomJID.userhostJID(), subject=subject)
     
    720724
    721725        @param reason: The reason for the invite.
    722         @type reason: C{unicode}
     726        @type reason: L{unicode}
    723727        """
    724728        message = InviteMessage(recipient=roomJID, invitee=invitee,
     
    752756        @type roomJID: L{JID<twisted.words.protocols.jabber.jid.JID>}
    753757
    754         @param options: A mapping of field names to values, or C{None} to
     758        @param options: A mapping of field names to values, or L{None} to
    755759            cancel.
    756         @type options: C{dict}
     760        @type options: L{dict}
    757761        """
    758762        if options is None:
     
    784788        @param messages: The history to send to the room as an ordered list of
    785789                         message, represented by a dictionary with the keys
    786                          C{'stanza'}, holding the original stanza a
    787                          L{domish.Element}, and C{'timestamp'} with the
     790                         L{'stanza'}, holding the original stanza a
     791                         L{domish.Element}, and L{'timestamp'} with the
    788792                         timestamp.
    789         @type messages: C{list} of L{domish.Element}
     793        @type messages: L{list} of L{domish.Element}
    790794        """
    791795
     
    819823
    820824        @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 configuration
     825            a L{data_form.Form} or L{None} if there are no configuration
    822826            options available.
    823827        """
     
    839843        @type roomJID: L{JID<twisted.words.protocols.jabber.jid.JID>}
    840844
    841         @param options: A mapping of field names to values, or C{None} to
     845        @param options: A mapping of field names to values, or L{None} to
    842846            cancel.
    843         @type options: C{dict}
     847        @type options: L{dict}
    844848        """
    845849        if options is None:
     
    963967
    964968        @param entities: The list of entities to change for a room.
    965         @type entities: C{list} of
     969        @type entities: L{list} of
    966970            L{JID<twisted.words.protocols.jabber.jid.JID>}
    967971
    968972        @param affiliation: The affilation to the entities will acquire.
    969         @type affiliation: C{unicode}
     973        @type affiliation: L{unicode}
    970974
    971975        @param sender: The entity sending the request.
     
    989993
    990994        @param nick: The nick name for the user in this room.
    991         @type nick: C{unicode}
     995        @type nick: L{unicode}
    992996
    993997        @param reason: The reason for granting voice to the entity.
    994         @type reason: C{unicode}
     998        @type reason: L{unicode}
    995999
    9961000        @param sender: The entity sending the request.
     
    10121016
    10131017        @param nick: The nick name for the user in this room.
    1014         @type nick: C{unicode}
     1018        @type nick: L{unicode}
    10151019
    10161020        @param reason: The reason for revoking voice from the entity.
    1017         @type reason: C{unicode}
     1021        @type reason: L{unicode}
    10181022
    10191023        @param sender: The entity sending the request.
     
    10321036
    10331037        @param nick: The nick name for the user in this room.
    1034         @type nick: C{unicode}
     1038        @type nick: L{unicode}
    10351039
    10361040        @param reason: The reason for granting moderation to the entity.
    1037         @type reason: C{unicode}
     1041        @type reason: L{unicode}
    10381042
    10391043        @param sender: The entity sending the request.
     
    10551059
    10561060        @param reason: The reason for banning the entity.
    1057         @type reason: C{unicode}
     1061        @type reason: L{unicode}
    10581062
    10591063        @param sender: The entity sending the request.
     
    10721076
    10731077        @param nick: The occupant to be banned.
    1074         @type nick: C{unicode}
     1078        @type nick: L{unicode}
    10751079
    10761080        @param reason: The reason given for the kick.
    1077         @type reason: C{unicode}
     1081        @type reason: L{unicode}
    10781082
    10791083        @param sender: The entity sending the request.
     
    10921096
    10931097        @param reason: The reason for the destruction of the room.
    1094         @type reason: C{unicode}
     1098        @type reason: L{unicode}
    10951099
    10961100        @param alternate: The JID of the room suggested as an alternate venue.
     
    11321136
    11331137    @ivar nick: The nick name for the client in this room.
    1134     @type nick: C{unicode}
     1138    @type nick: L{unicode}
    11351139
    11361140    @ivar occupantJID: The JID of the occupant in the room. Generated from
     
    11421146        L{MUCClientProtocol.getConfiguration} and
    11431147        L{MUCClientProtocol.configure}.
    1144     @type locked: C{bool}
     1148    @type locked: L{bool}
    11451149    """
    11461150
     
    11871191
    11881192        @param nick: The nick for the user in the MUC room.
    1189         @type nick: C{unicode}
     1193        @type nick: L{unicode}
    11901194        """
    11911195        return self.roster.get(nick)
     
    12141218                  room. Note that a particular entity can only join a room once
    12151219                  at a time.
    1216     @type _rooms: C{dict}
     1220    @type _rooms: L{dict}
    12171221    """
    12181222
     
    13991403        @type room: L{Room}
    14001404
    1401         @param user: The user that sent the message, or C{None} if it was a
     1405        @param user: The user that sent the message, or L{None} if it was a
    14021406            message from the room itself.
    14031407        @type user: L{User}
     
    14201424        @type room: L{Room}
    14211425
    1422         @param user: The user that sent the message, or C{None} if it was a
     1426        @param user: The user that sent the message, or L{None} if it was a
    14231427            message from the room itself.
    14241428        @type user: L{User}
     
    14391443
    14401444        @param nick: The nick name for the entitity joining the room.
    1441         @type nick: C{unicode}
     1445        @type nick: L{unicode}
    14421446
    14431447        @param historyOptions: Options for conversation history sent by the
     
    14461450
    14471451        @param password: Optional password for the room.
    1448         @type password: C{unicode}
     1452        @type password: L{unicode}
    14491453
    14501454        @return: A deferred that fires with the room when the entity is in the
     
    14831487
    14841488        @param nick: The new nick name within the room.
    1485         @type nick: C{unicode}
     1489        @type nick: L{unicode}
    14861490        """
    14871491        def cb(presence):
     
    15251529        @param show: The availability of the entity. Common values are xa,
    15261530            available, etc
    1527         @type show: C{unicode}
     1531        @type show: L{unicode}
    15281532
    15291533        @param status: The current status of the entity.
    1530         @type status: C{unicode}
     1534        @type status: L{unicode}
    15311535        """
    15321536        room = self._getRoom(roomJID)
     
    15441548
    15451549        @param reason: The reason for the destruction of the room.
    1546         @type reason: C{unicode}
     1550        @type reason: L{unicode}
    15471551
    15481552        @param alternate: The JID of the room suggested as an alternate venue.
  • wokkel/test/test_muc.py

    r185 r204  
    66"""
    77
     8from __future__ import division, absolute_import
     9
    810from datetime import datetime
    911from dateutil.tz import tzutc
     
    1315from twisted.trial import unittest
    1416from twisted.internet import defer, task
     17from twisted.python.compat import iteritems, unicode
    1518from twisted.words.xish import domish, xpath
    1619from twisted.words.protocols.jabber.jid import JID
     
    7982        }
    8083
    81         for code, condition in codes.iteritems():
     84        for code, condition in iteritems(codes):
    8285            constantName = condition.replace('-', '_').upper()
    8386            self.assertEqual(getattr(muc.STATUS_CODE, constantName),
     
    824827        self.assertNotIdentical(None, nodes, 'Missing query element')
    825828
    826         self.assertRaises(StopIteration, nodes[0].elements().next)
     829        self.assertRaises(StopIteration, next, nodes[0].elements())
    827830
    828831        xml = u"""
     
    970973        self.assertNotIdentical(None, nodes, 'Missing query element')
    971974
    972         self.assertRaises(StopIteration, nodes[0].elements().next)
     975        self.assertRaises(StopIteration, next, nodes[0].elements())
    973976
    974977        xml = u"""
Note: See TracChangeset for help on using the changeset viewer.