Skip to content

Commit

Permalink
Merge pull request twisted#561 from twisted/6320-rodrigc-irc-py3-2
Browse files Browse the repository at this point in the history
Author: rodrigc
Reviewer: acabhishek942
Fixes: twisted#6320

Port twisted.words.protocols.irc to Python 3
rodrigc authored Oct 31, 2016
2 parents f1e1e8a + 9c456e0 commit 48dfa77
Showing 10 changed files with 662 additions and 260 deletions.
13 changes: 0 additions & 13 deletions src/twisted/python/_setup.py
Original file line number Diff line number Diff line change
@@ -495,21 +495,8 @@ def _checkCPython(sys=sys, platform=platform):
"twisted.web.test.test_soap",
"twisted.web.test.test_xml",
"twisted.web.twcgi",
"twisted.words.ewords",
"twisted.words.im.baseaccount",
"twisted.words.im.interfaces",
"twisted.words.im.ircsupport",
"twisted.words.im.pbsupport",
"twisted.words.iwords",
"twisted.words.protocols.irc",
"twisted.words.protocols.oscar",
"twisted.words.service",
"twisted.words.tap",
"twisted.words.test.test_basesupport",
"twisted.words.test.test_irc",
"twisted.words.test.test_irc_service",
"twisted.words.test.test_ircsupport",
"twisted.words.test.test_oscar",
"twisted.words.test.test_service",
"twisted.words.test.test_tap",
]
36 changes: 36 additions & 0 deletions src/twisted/words/im/interfaces.py
Original file line number Diff line number Diff line change
@@ -68,6 +68,8 @@ def getPerson(personName):
@rtype: L{Person<IPerson>}
"""



class IClient(Interface):

account = Attribute('The L{IAccount} I am a Client for')
@@ -95,10 +97,12 @@ def leaveGroup(groupName):
def getGroupConversation(name, hide=0):
pass


def getPerson(name):
pass



class IPerson(Interface):

def __init__(name, account):
@@ -111,25 +115,29 @@ def __init__(name, account):
@type account: I{Account}
"""


def isOnline():
"""
Am I online right now?
@rtype: boolean
"""


def getStatus():
"""
What is my on-line status?
@return: L{locals.StatusEnum}
"""


def getIdleTime():
"""
@rtype: string (XXX: How about a scalar?)
"""


def sendMessage(text, metadata=None):
"""
Send a message to this person.
@@ -139,6 +147,7 @@ def sendMessage(text, metadata=None):
"""



class IGroup(Interface):
"""
A group which you may have a conversation with.
@@ -160,13 +169,15 @@ def __init__(name, account):
@type account: L{Account<IAccount>}
"""


def setTopic(text):
"""
Set this Groups topic on the server.
@type text: string
"""


def sendGroupMessage(text, metadata=None):
"""
Send a message to this group.
@@ -180,17 +191,20 @@ def sendGroupMessage(text, metadata=None):
- C{'emote'}: indicates this is an action
"""


def join():
"""
Join this group.
"""


def leave():
"""
Depart this group.
"""



class IConversation(Interface):
"""
A conversation with a specific person.
@@ -201,50 +215,62 @@ def __init__(person, chatui):
@type person: L{IPerson}
"""


def show():
"""
doesn't seem like it belongs in this interface.
"""


def hide():
"""
nor this neither.
"""


def sendText(text, metadata):
pass


def showMessage(text, metadata):
pass


def changedNick(person, newnick):
"""
@param person: XXX Shouldn't this always be Conversation.person?
"""



class IGroupConversation(Interface):

def show():
"""
doesn't seem like it belongs in this interface.
"""


def hide():
"""
nor this neither.
"""


def sendText(text, metadata):
pass


def showGroupMessage(sender, text, metadata):
pass


def setGroupMembers(members):
"""
Sets the list of members in the group and displays it to the user.
"""


def setTopic(topic, author):
"""
Displays the topic (from the server) for the group conversation window.
@@ -253,6 +279,7 @@ def setTopic(topic, author):
@type author: string (XXX: Not Person?)
"""


def memberJoined(member):
"""
Adds the given member to the list of members in the group conversation
@@ -261,6 +288,7 @@ def memberJoined(member):
@type member: string (XXX: Not Person?)
"""


def memberChangedNick(oldnick, newnick):
"""
Changes the oldnick in the list of members to C{newnick} and displays this
@@ -270,6 +298,7 @@ def memberChangedNick(oldnick, newnick):
@type newnick: string
"""


def memberLeft(member):
"""
Deletes the given member from the list of members in the group
@@ -279,6 +308,7 @@ def memberLeft(member):
"""



class IChatUI(Interface):

def registerAccountClient(client):
@@ -288,13 +318,15 @@ def registerAccountClient(client):
@type client: L{Client<IClient>}
"""


def unregisterAccountClient(client):
"""
Notifies user that an account has been signed off or disconnected.
@type client: L{Client<IClient>}
"""


def getContactsList():
"""
@rtype: L{ContactsList}
@@ -315,6 +347,7 @@ def getConversation(person, Class, stayHidden=0):
@rtype: L{Conversation<IConversation>}
"""


def getGroupConversation(group, Class, stayHidden=0):
"""
For the given group object, returns the group conversation window or
@@ -327,6 +360,7 @@ def getGroupConversation(group, Class, stayHidden=0):
@rtype: L{GroupConversation<interfaces.IGroupConversation>}
"""


def getPerson(name, client):
"""
Get a Person for a client.
@@ -339,6 +373,7 @@ def getPerson(name, client):
@rtype: L{Person<IPerson>}
"""


def getGroup(name, client):
"""
Get a Group for a client.
@@ -351,6 +386,7 @@ def getGroup(name, client):
@rtype: L{Group<IGroup>}
"""


def contactChangedNick(oldnick, newnick):
"""
For the given person, changes the person's name to newnick, and
Loading
Oops, something went wrong.

0 comments on commit 48dfa77

Please sign in to comment.