print "Loading mod: GeneralChatDisabler v2016-08-10"

__authors__ = 'Dumadidak, Krzysztof_Chodak'
__lastchages__ = '10.08.2016'
__version__ = '(WoT 0.9.15.1)'

from messenger.gui.Scaleform.lobby_entry import LobbyEntry
from messenger.m_constants import LAZY_CHANNEL

def new_LobbyEntry__handleLazyChannelCtlInited(self, event):
    print "_LobbyEntry__handleLazyChannelCtlInited"
    ctx = event.ctx
    controller = ctx.get('controller')
    if controller is None:
        LOG_ERROR('Controller is not defined', ctx)
        return
    else:
        cname = controller.getChannel().getName()
        if cname == LAZY_CHANNEL.COMMON or cname == LAZY_CHANNEL.XMPP_COMMON:
            ctx.clear()
        else:
            old__LobbyEntry__handleLazyChannelCtlInited(self, event)

print LobbyEntry._LobbyEntry__handleLazyChannelCtlInited
old__LobbyEntry__handleLazyChannelCtlInited = LobbyEntry._LobbyEntry__handleLazyChannelCtlInited
LobbyEntry._LobbyEntry__handleLazyChannelCtlInited = new_LobbyEntry__handleLazyChannelCtlInited

def MYPPRINT(obj, name = None):
    import inspect, pprint
    if hasattr(obj, '__call__'):
        pprint.pprint(inspect.getargspec(obj))
    else:
        pprint.pprint(inspect.getmembers(obj))

from gui.app_loader.loader import g_appLoader

def onAccountBecomePlayer():
    #MYPPRINT(g_appLoader.getDefLobbyApp().loaderManager)
    pass
    
from PlayerEvents import g_playerEvents
g_playerEvents.onAccountBecomePlayer += onAccountBecomePlayer

