Skip to content

Commit

Permalink
forcejoin support
Browse files Browse the repository at this point in the history
  • Loading branch information
renefritze committed Mar 8, 2012
1 parent 04e9aee commit 85b7914
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/iserverevents.h
Expand Up @@ -136,6 +136,7 @@ class IServerEvents

virtual void OnFileDownload( bool autolaunch, bool autoclose, bool disconnectonrefuse, const wxString& FileName, const wxString& url, const wxString& description ) = 0;
virtual void OnSpringDownloadEvent( wxCommandEvent& event ) = 0;
virtual void OnForceJoinBattle( int battleid, const wxString& line ) = 0;

};

Expand Down
9 changes: 9 additions & 0 deletions src/serverevents.cpp
Expand Up @@ -1060,3 +1060,12 @@ void ServerEvents::OnSpringDownloadEvent( wxCommandEvent& event )

}
}

void ServerEvents::OnForceJoinBattle(int battleid, const wxString &scriptPW)
{
if ( m_serv.GetCurrentBattle() )
m_serv.GetCurrentBattle()->Leave();
m_serv.JoinBattle( battleid, scriptPW );
UiEvents::GetStatusEventSender( UiEvents::addStatusMessage ).SendEvent(
UiEvents::StatusData( _("Automatically moved to new battle"), 1 ) );
}
1 change: 1 addition & 0 deletions src/serverevents.h
Expand Up @@ -115,6 +115,7 @@ class ServerEvents : public IServerEvents, public wxEvtHandler

void OnFileDownload( bool autolaunch, bool autoclose, bool disconnectonrefuse, const wxString& FileName, const wxString& url, const wxString& description );
void OnSpringDownloadEvent( wxCommandEvent& event );
void OnForceJoinBattle( int battleid, const wxString& line );

protected:
Server& m_serv;
Expand Down
8 changes: 7 additions & 1 deletion src/tasserver.cpp
Expand Up @@ -459,7 +459,7 @@ void TASServer::Login()
localaddr = m_sock->GetLocalAddress();
if ( localaddr.IsEmpty() ) localaddr = _T("*");
m_id_transmission = false;
wxFormat login_cmd( _T("%s %s %s %s %s\t%s\ta sp") );
wxFormat login_cmd( _T("%s %s %s %s %s\t%s\ta m sp") );
SendCmd ( _T("LOGIN"), (login_cmd % m_user % pass % GetHostCPUSpeed() % localaddr % Useragent() % protocol).str() );
m_id_transmission = true;
}
Expand Down Expand Up @@ -1181,6 +1181,12 @@ void TASServer::ExecuteCommand( const wxString& cmd, const wxString& inparams, i
wxString description = GetSentenceParam( params );
m_se->OnFileDownload( parsingdata.tasdata.autoopen, parsingdata.tasdata.closelobbyondownload, parsingdata.tasdata.disconnectonrefuse, FileName, url, description );
}
else if ( cmd == _T("FORCEJOINBATTLE") )
{
const int battleID = GetIntParam( params );
const wxString scriptpw = GetWordParam( params );
m_se->OnForceJoinBattle( battleID, scriptpw );
}
else
{
wxLogMessage( _T("??? Cmd: %s params: %s"), cmd.c_str(), params.c_str() );
Expand Down
2 changes: 1 addition & 1 deletion src/utils/downloader.cpp
Expand Up @@ -214,7 +214,7 @@ void PlasmaInterface::downloadFile(const wxString& host, const wxString& remote_
FileDownloading.Connect( host, 80);

wxInputStream* httpstream = FileDownloading.GetInputStream( _T("/") + remote_path );
wxLogDebug( _T("downloading file %s/%s"),host,remote_path );
//wxLogDebug( _T("downloading file %s/%s"),host,remote_path );

if ( httpstream )
{
Expand Down

0 comments on commit 85b7914

Please sign in to comment.