Exemple #1
0
Statusbar::Statusbar( wxWindow* parent )
	:wxStatusBar( parent, wxNewId() ),
	m_addMessageSink( this, &GetStatusEventSender(UiEvents::addStatusMessage) ),
	m_removeMessageSink( this, &GetStatusEventSender(UiEvents::removeStatusMessage) )

{
	int w[3] = {460,-1,120};
	SetFieldsCount( 3, w );
	PushStatusText( TowxString(getSpringlobbyVersion()), 1 );
	taskBar = new TaskBar(this);
}
Exemple #2
0
bool ContentManager::IsNewApplicationVersionAvailable() {
	std::string latestVersion = GetLatestApplicationVersionAvailable();
	// Need to replace crap chars or versions will always be inequal

	/*Some error occurred*/
	if (latestVersion.empty()) {
		return false;
	}

	//get current rev w/o AUX_VERSION added
	const std::string myVersion = getSpringlobbyVersion();

	/*Check versions for equality*/
	return (latestVersion != myVersion);
}
Exemple #3
0
slAboutBox::slAboutBox()
{
	info = new wxAboutDialogInfo();

	info->SetName( TowxString(getSpringlobbyName()) );
	info->SetVersion (TowxString(getSpringlobbyVersion()));
	info->SetDescription( TowxString(getSpringlobbyName()) + _("is a cross-plattform lobby client for the Spring RTS engine"));
	//info.SetCopyright(wxEmptyString;
	info->SetLicence(_T("GPL v2 or later"));
	info->AddDeveloper(_T("abma"));
	info->AddDeveloper(_T("BrainDamage"));
	info->AddDeveloper(_T("dizekat"));
	info->AddDeveloper(_T("insaneinside"));
	info->AddDeveloper(_T("Kaot"));
	info->AddDeveloper(_T("koshi"));
	info->AddDeveloper(_T("semi_"));
	info->AddDeveloper(_T("tc-"));
    info->AddTranslator(_T("chaosch (simplified chinese)"));
	info->AddTranslator(_T("lejocelyn (french)"));
	info->AddTranslator(_T("Suprano (german)"));
    info->AddTranslator(_T("tc- (swedish)"));
	info->AddTranslator(_("The numerous contributors from launchpad.net"));
}
Exemple #4
0
const std::string getSpringlobbyAgent()
{
	std::string agent = getSpringlobbyName() + " ";
	agent += getSpringlobbyVersion();
	agent += " (";
#if WIN32
	agent += "win";
#elif __APPLE__
	agent += "osx";
#else
	agent += "unix";
#endif

	agent += " ";

#if __WORDSIZE == 64
	agent += "x64";
#else
	agent += "x32";
#endif
	agent += ")";

	return agent;
}
Exemple #5
0
bool Channel::ExecuteSayCommand( const std::string& in )
{
  if ( in.length() == 0 ) return true;

  if ( in[0] != '/' ) return false;

  wxString subcmd = TowxString(in).BeforeFirst(' ').Lower();
  wxString params = TowxString(in).AfterFirst( ' ' );

  wxString cmdline = TowxString(in);
  wxString param = GetWordParam( cmdline );
  if ( param == _T("/me") ) {
    DoAction(STD_STRING(cmdline));
    return true;
  } else if (( in == "/part") || (in == "/p") ) {
    Leave();
    uidata.panel = 0;
    return true;
  } else if ( param == _T("/sayver") ) {
	  //!this instance is not replaced with GetAppname for sake of help/debug online
    DoAction( "is using SpringLobby v" + getSpringlobbyVersion() );
    return true;
  } else if(subcmd==_T("/userban")){
    m_banned_users.insert(STD_STRING(params));
    m_serv.SayPrivate(_T("ChanServ"),_T("!kick #")+TowxString(GetName())+_T(" ")+params);
    return true;
  } else if(subcmd==_T("/userunban")){
    m_banned_users.erase(STD_STRING(params));
    return true;
  } else if(subcmd==_T("/banregex")){
    ui().OnChannelMessage(*this,_T("/banregex ")+params);
    m_do_ban_regex=!params.empty();
    if(m_do_ban_regex){
      #ifdef wxHAS_REGEX_ADVANCED
      m_ban_regex.Compile(params, wxRE_ADVANCED);
      #else
      m_ban_regex.Compile(params, wxRE_EXTENDED);
      #endif
      if(!m_ban_regex.IsValid())ui().OnChannelMessage(*this,_T("Invalid regular expression"));
    }
    return true;
  } else if(subcmd==_T("/unbanregex")){
    ui().OnChannelMessage(*this,_T("/unbanregex ")+params);
    m_do_unban_regex=!params.empty();
    if(m_do_unban_regex){
      #ifdef wxHAS_REGEX_ADVANCED
      m_unban_regex.Compile(params, wxRE_ADVANCED);
      #else
      m_unban_regex.Compile(params, wxRE_EXTENDED);
      #endif
      if(!m_unban_regex.IsValid())ui().OnChannelMessage(*this,_T("Invalid regular expression"));
    }
    return true;
  } else if (subcmd==_T("/checkban")) {
    if(IsBanned(STD_STRING(params))){
      ui().OnChannelMessage(*this,params+_T(" is banned"));
    }else{
      ui().OnChannelMessage(*this,params+_T(" is not banned"));
    }
    return true;
  }


  else if(subcmd==_T("/banregexmsg")){
    ui().OnChannelMessage(*this,_T("/banregexmsg ")+params);
    m_ban_regex_msg=STD_STRING(params);
    return true;
  }

  return false;
}
Exemple #6
0
bool ChatPanel::Say(const wxString& message)
{
	static const unsigned int flood_threshold = 5;
	slLogDebugFunc("");
	wxStringTokenizer lines(message, _T('\n'));
	if (lines.CountTokens() > flood_threshold) {
		PasteDialog dl(this, wxString::Format(_("Are you sure you want to paste %d lines?"), lines.CountTokens()));
		switch (dl.ShowModal()) {
			case wxID_NO:
				return true;
			case PasteDialog::pasteButtonReturnCode: {
				wxString url = Paste2Pastebin(message);
				if (url != wxEmptyString && wxStringTokenizer(url, _T('\n')).CountTokens() <= flood_threshold) {
					Say(url);
					return true;
				} else {
					customMessageBoxNoModal(SL_MAIN_ICON, _("Failed to post to pastebin.com."));
					return false;
				}
			}
			default:
				break;
		}
	}
	while (lines.HasMoreTokens()) {
		wxString line = lines.GetNextToken();
		wxLogMessage(_T( "line: %s" ), line.c_str());

		if (line.Find('/') == 0) {
			if (ui().ExecuteSayCommand(line))
				return true;
		}

		if (line == _T( "/ver" )) {
			//!this instance is not replaced with GetAppname for sake of help/debug online
			OutputLine(_(" You have SpringLobby v") + TowxString(getSpringlobbyVersion()), sett().GetChatColorNormal());
			return true;
		}

		if (line == _T( "/clear" )) {
			m_chatlog_text->SetValue(wxEmptyString);
			return true;
		}

		if (m_type == CPT_Channel) {

			if (m_channel == 0) {
				OutputError(_("You are not in channel or channel does not exist."));
				return true;
			}
			if (line.StartsWith(_T( "/" ))) {
				if (m_channel->ExecuteSayCommand(STD_STRING(line)))
					return true;
				if (m_channel->GetServer().ExecuteSayCommand(STD_STRING(line)))
					return true;
				OutputError(wxString::Format(_("Command (%s) does not exist, use /help for a list of available commands."), line.c_str()));
				return true;
			}
			m_channel->Say(STD_STRING(line));

		} else if (m_type == CPT_Battle) {

			if (m_battle == 0) {
				OutputError(_("You are not in battle or battle does not exist, use /help for a list of available commands."));
				return true;
			}
			if (line.StartsWith(_T( "/" ))) {
				if (m_battle->ExecuteSayCommand(STD_STRING(line)))
					return true;
				if (m_battle->GetServer().ExecuteSayCommand(STD_STRING(line)))
					return true;
				OutputError(wxString::Format(_("Command (%s) does not exist, use /help for a list of available commands."), line.c_str()));
				return true;
			}
			m_battle->Say(STD_STRING(line));

		} else if (m_type == CPT_User) {

			if (m_user == 0) {
				OutputError(_(" User is offline."));
				return true;
			}
			if (line.StartsWith(_T( "/" ))) {
				if (m_user->ExecuteSayCommand(STD_STRING(line)))
					return true;
				if (m_user->GetServer().ExecuteSayCommand(STD_STRING(line)))
					return true;
				OutputError(wxString::Format(_("Command (%s) does not exist, use /help for a list of available commands."), line.c_str()));
				return true;
			}
			m_user->Say(STD_STRING(line));

		} else if (m_type == CPT_Server) {
			if (m_server == 0) {
				OutputError(_("Not connected to server"));
				return true;
			}

			if (line.StartsWith(_T( "/" ))) {
				if (m_server->ExecuteSayCommand(STD_STRING(line)))
					return true;
				OutputError(wxString::Format(_("Command (%s) does not exist, use /help for a list of available commands."), line.c_str()));
				return true;
			}

			//we need to disable the channel tab if leaving manually
			if (line.Upper().StartsWith(_T( "LEAVE" ))) {
				wxString channame = line.AfterFirst(' ').BeforeFirst(' ');
				try {
					Channel& chan = m_server->GetChannel(STD_STRING(channame));
					chan.Leave();
					chan.uidata.panel = 0;
				} catch (assert_exception) {
				}
			}

			m_server->SendCmd(STD_STRING(line), "");
			OutputLine(_(" Sent: \"") + line + _("\""), sett().GetChatColorNormal());
		}
	}
	return true;
}