Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Commit

Permalink
Merge branch 'feature/modern-im' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
horazont committed Apr 11, 2017
2 parents a94a34f + ad976dc commit 4cfdd1f
Show file tree
Hide file tree
Showing 30 changed files with 6,619 additions and 1,500 deletions.
1 change: 1 addition & 0 deletions aioxmpp/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ def connect(self, coro):
:meth:`connect` returns a token which can be used with
:meth:`disconnect` to disconnect the coroutine.
"""
self.logger.debug("connecting %r", coro)
return self._connect(coro)

def context_connect(self, coro):
Expand Down
73 changes: 73 additions & 0 deletions aioxmpp/im/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
########################################################################
# File name: __init__.py
# This file is part of: aioxmpp
#
# LICENSE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
########################################################################
"""
:mod:`~aioxmpp.im` --- Instant Messaging Utilities and Services
###############################################################
This subpackage provides tools for Instant Messaging applications based on
XMPP. The tools are meant to be useful for both user-facing as well as
automated IM applications.
Terminology
===========
This is a short overview of the terminology. The full definitions can be found
in the glossary and are linked.
:term:`Conversation`
Communication context for two or more parties.
:term:`Conversation Member`
An entity taking part in a :term:`Conversation`.
:term:`Conversation Implementation`
A :term:`Service` which provides means to create and manage specific
:class:`~.AbstractConversation` subclasses.
Enumerations
============
.. autoclass:: ConversationState
.. autoclass:: ConversationFeature
.. autoclass:: InviteMode
Abstract base classes
=====================
.. module:: aioxmpp.im.conversation
.. currentmodule:: aioxmpp.im.conversation
Conversations
-------------
.. autoclass:: AbstractConversation
.. autoclass:: AbstractConversationMember
"""

from .conversation import ( # NOQA
ConversationState,
ConversationFeature,
InviteMode,
)
45 changes: 45 additions & 0 deletions aioxmpp/im/body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
########################################################################
# File name: body.py
# This file is part of: aioxmpp
#
# LICENSE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
########################################################################
import functools

import aioxmpp.structs


@functools.singledispatch
def set_message_body(x, message):
raise NotImplementedError(
"type {!r} is not supported as message body".format(
type(x)
)
)


@set_message_body.register(str)
def set_message_body_str(x, message):
message.body.clear()
message.body[None] = x


@set_message_body.register(aioxmpp.structs.LanguageMap)
def set_message_body_langmap(x, message):
message.body.clear()
message.body.update(x)
Loading

0 comments on commit 4cfdd1f

Please sign in to comment.