# Path: xmpp_backends/constants.py
# CONNECTION_HTTP_BINDING = 2
# 
# Path: xmpp_backends/constants.py
# CONNECTION_HTTP_POLLING = 1
# 
# Path: xmpp_backends/constants.py
# CONNECTION_UNKNOWN = 4
# 
# Path: xmpp_backends/constants.py
# CONNECTION_WEBSOCKETS = 3
# 
# Path: xmpp_backends/constants.py
# CONNECTION_XMPP = 0


from django.contrib.auth.models import AbstractBaseUser
from django.db import models
from django.utils import timezone
from django.utils.crypto import get_random_string
from django.utils.translation import gettext as _
from ...constants import CONNECTION_HTTP_BINDING
from ...constants import CONNECTION_HTTP_POLLING
from ...constants import CONNECTION_UNKNOWN
from ...constants import CONNECTION_WEBSOCKETS
from ...constants import CONNECTION_XMPP

    USERNAME_FIELD = 'username'

    class Meta:
        verbose_name = _('Fake XMPP User')
        verbose_name_plural = _('Fake XMPP Users')

    @property
    def node(self):
        return self.username.split('@', 1)[0]

    @property
    def domain(self):
        return self.username.split('@', 1)[1]

    def message(self, subject, message, sender):
        self.messages.create(subject=subject, message=message, sender=sender)


class FakeUserSession(models.Model):
    user = models.ForeignKey(FakeUser, models.CASCADE, related_name='sessions')
    resource = models.CharField(max_length=255, default=get_random_string)
    priority = models.IntegerField(default=0)
    ip_address = models.GenericIPAddressField(default='127.0.0.1')
    uptime = models.DateTimeField(default=timezone.now)
    status = models.CharField(max_length=255)
    status_text = models.CharField(max_length=255)
    connection_type = models.SmallIntegerField(choices=(
        (CONNECTION_XMPP, _('XMPP')),
        (CONNECTION_HTTP_POLLING, _('HTTP Polling')),

# Path: xmpp_backends/constants.py
# CONNECTION_HTTP_BINDING = 2
# 
# Path: xmpp_backends/constants.py
# CONNECTION_HTTP_POLLING = 1
# 
# Path: xmpp_backends/constants.py
# CONNECTION_UNKNOWN = 4
# 
# Path: xmpp_backends/constants.py
# CONNECTION_WEBSOCKETS = 3
# 
# Path: xmpp_backends/constants.py
# CONNECTION_XMPP = 0


# Path: xmpp_backends/django/fake_xmpp/models.py
from django.contrib.auth.models import AbstractBaseUser
from django.db import models
from django.utils import timezone
from django.utils.crypto import get_random_string
from django.utils.translation import gettext as _
from ...constants import CONNECTION_HTTP_BINDING
from ...constants import CONNECTION_HTTP_POLLING
from ...constants import CONNECTION_UNKNOWN
from ...constants import CONNECTION_WEBSOCKETS
from ...constants import CONNECTION_XMPP


    USERNAME_FIELD = 'username'

    class Meta:
        verbose_name = _('Fake XMPP User')
        verbose_name_plural = _('Fake XMPP Users')

    @property
    def node(self):
        return self.username.split('@', 1)[0]

    @property
    def domain(self):
        return self.username.split('@', 1)[1]

    def message(self, subject, message, sender):
        self.messages.create(subject=subject, message=message, sender=sender)


class FakeUserSession(models.Model):
    user = models.ForeignKey(FakeUser, models.CASCADE, related_name='sessions')
    resource = models.CharField(max_length=255, default=get_random_string)
    priority = models.IntegerField(default=0)
    ip_address = models.GenericIPAddressField(default='127.0.0.1')
    uptime = models.DateTimeField(default=timezone.now)
    status = models.CharField(max_length=255)
    status_text = models.CharField(max_length=255)
    connection_type = models.SmallIntegerField(choices=(
        (CONNECTION_XMPP, _('XMPP')),
        (CONNECTION_HTTP_POLLING, _('HTTP Polling')),

        (CONNECTION_HTTP_BINDING, _('HTTP Binding')),