예제 #1
0
파일: imaccount.py 프로젝트: sgricci/digsby
info = log.info; warning = log.warning

from common.protocolmeta import proto_init

import protocols
class IConnectCallable(protocols.Interface):
    protocols.advise(equivalentProtocols =
                     [protocols.protocolForURI("http://www.dotsyntax.com/protocols/connectcallable")])
    def __call__(callable):
        pass

def get_netcall(*a, **k):
    from common import netcall
    return netcall

protocols.declareAdapterForType(IConnectCallable, get_netcall, object)

class ChatProtocol(object):
    def __init__(self):
        self.reconnected_callbacks = Delegate()

    def when_reconnect(self, callback):
        '''
        Register a callback to be called when this account reconnects.

        It will only be called once--call this method again if you need to be registered
        for future reconnects.
        '''
        self.reconnected_callbacks += callback

예제 #2
0
    def icon(self):
        from gui import skin
        return skin.get('serviceicons.%s' % self.subject, skin.get('serviceprovidericons.%s' % self.subject, None))
    @property
    def type(self):
        from common import protocolmeta
        p = protocolmeta.protocols.get(self.subject)
        return p.get('component_type', p.get('type')) if p else 'unknown'
    @property
    def component_id(self):
        return self.subject

def get_meta_for_provider(provider_instance):
    return IServiceProviderGUIMetaData(sp.get_meta_service_provider(provider_instance.provider_id))

protocols.declareAdapterForType(IServiceProviderGUIMetaData, get_meta_for_provider, sp.ServiceProvider)

class IPaintable(protocols.Interface):
    def on_paint(e):
        pass

class wxPaintingMixin(object):
    def __init__(self, *a, **k):
        try:
            IPaintable(self)
        except protocols.AdaptationFailure:
            raise
        super(wxPaintingMixin, self).__init__(*a, **k)
        self.Bind(wx.EVT_PAINT, self.on_paint)

class IDrawable(protocols.Interface):
예제 #3
0
    steal_focus = prefs.pop(old_focus_pref, None)
    if steal_focus is not None:
        log.info('upgraded conversation_window.steal_focus pref')
        prefs[new_focus_pref] = 'stealfocus' if steal_focus else 'minimize'

hooks.register('blobs.update.prefs', on_prefs_loaded)


def load_local_accounts(username, password):
    '''
    Loads local accounts for a username and password.

    Returns tuple of (digsby.accounts.Accounts,
                      server_hash,
                      server_order)
    '''
    local_info = digsbylocal.load_local(username, password)
    server_info = digsbylocal.load_server(username, password)

    from digsby.accounts import Accounts
    return Accounts.from_local_store(local_info), server_info['accounts_hash'], server_info['server_order']


def set_simple_status(status):
    profile.set_status(profile.status.copy(status=status.title()))

from digsby_chatlogs.interfaces import IAliasProvider
from digsby_chatlogs.profilealiases import ProfileAliasProvider
import protocols as ptcls
ptcls.declareAdapterForType(IAliasProvider, ProfileAliasProvider, DigsbyProfile)
예제 #4
0
파일: xmppfb.py 프로젝트: sgricci/digsby
    show = property(__get_show, __set_show)

    def set_message(self,
                    message,
                    status,
                    format=None,
                    default_status='normal'):
        return super(FaceBookChatXMPP, self).set_message(message = None,
                                                         status  = '',
                                                         format = format,
                                                         default_status = \
                                                           default_status)


def do_call(callable):
    callable()


def get_call_wrapper(*a, **k):
    return do_call


#we've got some stuff to do before the actual socket.connect, so we'll be
#responsible for what thread things are on, not jabber

import protocols
protocols.declareAdapterForType(
    protocols.protocolForURI(
        "http://www.dotsyntax.com/protocols/connectcallable"),
    get_call_wrapper, FaceBookChatXMPP)
예제 #5
0
파일: xmppfb.py 프로젝트: AlexUlrich/digsby
    def __set_show(self, state):
        pass

    def __get_show(self):
        if self._idle:
            return 'away'
        else:
            return None

    show = property(__get_show, __set_show)

    def set_message(self, message, status, format = None, default_status='normal'):
        return super(FaceBookChatXMPP, self).set_message(message = None,
                                                         status  = '',
                                                         format = format,
                                                         default_status = \
                                                           default_status)

def do_call(callable):
    callable()

def get_call_wrapper(*a, **k):
    return do_call

#we've got some stuff to do before the actual socket.connect, so we'll be
#responsible for what thread things are on, not jabber

import protocols
protocols.declareAdapterForType(protocols.protocolForURI("http://www.dotsyntax.com/protocols/connectcallable"),
                                get_call_wrapper, FaceBookChatXMPP)