Ticket #2491: global-XMPP-receive-v2.diff

File global-XMPP-receive-v2.diff, 5.2 KB (added by Josh, 10 years ago)

Also remove old (now useless) API

  • binaries/data/mods/public/gui/session/session.js

     
    435435
    436436    // Clear renamed entities list
    437437    Engine.GuiInterfaceCall("ClearRenamedEntities");
    438 
    439     // If the lobby is running, wake it up every 10 seconds so we stay connected.
    440     if (Engine.HasXmppClient() && (Date.now() - lastXmppClientPoll) > 10000)
    441     {
    442         Engine.RecvXmppClient();
    443         lastXmppClientPoll = Date.now();
    444     }
    445438}
    446439
    447440function checkPlayerState()
  • binaries/data/mods/public/gui/lobby/lobby.js

     
    446446
    447447function onTick()
    448448{
    449     // Wake up XmppClient
    450     Engine.RecvXmppClient();
    451 
    452449    updateTimers();
    453450    checkSpamMonitor();
    454451
  • binaries/data/mods/public/gui/lobby/prelobby.js

     
    138138    // The XmppClient has been created, we are waiting
    139139    // to be connected or to receive an error.
    140140
    141     //Wake up XmppClient
    142     Engine.RecvXmppClient();
    143 
    144141    //Receive messages
    145142    while (true)
    146143    {
  • binaries/data/mods/public/gui/gamesetup/gamesetup.js

     
    704704            handleNetMessage(message);
    705705        }
    706706    }
    707 
    708     // If the lobby is running, wake it up every 10 seconds so we stay connected.
    709     if (Engine.HasXmppClient() && (Date.now() - lastXmppClientPoll) > 10000)
    710     {
    711         Engine.RecvXmppClient();
    712         lastXmppClientPoll = Date.now();
    713     }
    714707}
    715708
    716709// Called when user selects number of players
  • source/lobby/XmppClient.cpp

     
    2222#include "lib/utf8.h"
    2323
    2424// Debug
    25 // TODO: Use builtin error/warning/logging functions.
    26 #include <iostream>
    2725#include "ps/CLogger.h"
    2826
    2927// Gloox
  • source/lobby/scripting/JSInterface_Lobby.cpp

     
    8080    g_XmppClient->disconnect();
    8181}
    8282
    83 void JSI_Lobby::RecvXmppClient(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
    84 {
    85     if (!g_XmppClient)
    86         return;
    87     g_XmppClient->recv();
    88 }
    89 
    9083void JSI_Lobby::SendGetGameList(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
    9184{
    9285    if (!g_XmppClient)
  • source/lobby/scripting/JSInterface_Lobby.h

     
    3434    void StopXmppClient(ScriptInterface::CxPrivate* pCxPrivate);
    3535    void ConnectXmppClient(ScriptInterface::CxPrivate* pCxPrivate);
    3636    void DisconnectXmppClient(ScriptInterface::CxPrivate* pCxPrivate);
    37     void RecvXmppClient(ScriptInterface::CxPrivate* pCxPrivate);
    3837    void SendGetGameList(ScriptInterface::CxPrivate* pCxPrivate);
    3938    void SendGetBoardList(ScriptInterface::CxPrivate* pCxPrivate);
    4039    void SendGetRatingList(ScriptInterface::CxPrivate* pCxPrivate);
  • source/main.cpp

     
    6666#include "network/NetClient.h"
    6767#include "network/NetServer.h"
    6868#include "network/NetSession.h"
     69#include "lobby/IXmppClient.h"
    6970#include "graphics/Camera.h"
    7071#include "graphics/GameView.h"
    7172#include "graphics/TextureManager.h"
     
    348349    if (g_NetClient)
    349350        g_NetClient->Flush();
    350351
     352    // Keep us connected to any XMPP servers
     353    if (g_XmppClient)
     354        g_XmppClient->recv();
     355
    351356    g_UserReporter.Update();
    352357
    353358    g_Console->Update(realTimeSinceLastFrame);
  • source/gui/scripting/ScriptFunctions.cpp

     
    957957    scriptInterface.RegisterFunction<void, &JSI_Lobby::StopXmppClient>("StopXmppClient");
    958958    scriptInterface.RegisterFunction<void, &JSI_Lobby::ConnectXmppClient>("ConnectXmppClient");
    959959    scriptInterface.RegisterFunction<void, &JSI_Lobby::DisconnectXmppClient>("DisconnectXmppClient");
    960     scriptInterface.RegisterFunction<void, &JSI_Lobby::RecvXmppClient>("RecvXmppClient");
    961960    scriptInterface.RegisterFunction<void, &JSI_Lobby::SendGetGameList>("SendGetGameList");
    962961    scriptInterface.RegisterFunction<void, &JSI_Lobby::SendGetBoardList>("SendGetBoardList");
    963962    scriptInterface.RegisterFunction<void, &JSI_Lobby::SendGetRatingList>("SendGetRatingList");