Пример #1
0
void LogType::setUdpRemoteEndpoint()
{
    __udp_remote_endpoint = new boost::asio::ip::udp::endpoint(
        boost::asio::ip::udp::endpoint(
            boost::asio::ip::address::from_string(getIpAddress()),
            getRemotePort()));
}
Пример #2
0
bool LogType::parseRemotePort()
{
    setRemotePort( iniGetValue( ini::SECTION,
        ini::VAR_SWA_REMOTEPORT, ini::settings::remotePort ));

    if (iniGetError())
    {
        writeError( "Can't get 'Remote Port'" );
        return false;
    }

    if ((getRemotePort() == 0) 
        || (getRemotePort() == UINT16_MAX))
    {
        writeError( "'Remote Port' invalid" );
        return false;
    }

    writeInfo ( "Remote Port = %d", getRemotePort());

    return true;
}
Пример #3
0
void AtDrv::getRemoteData(uint8_t sock, uint8_t *ip, uint16_t *port)
{
	if(!isAtMode()) {
		if(!switchToAtMode()) {
			INFO1("Can't switch to at mode");
			memset(ip, 0, 4);
			*port = 0;
			goto end;
		}
	}

	getRemoteIp(sock, ip);
	getRemotePort(sock, port);

end:
	return;
}
Пример #4
0
    unsigned Socket::receive(void *data, const unsigned maxlen) {
        if(_myTimeOut) {
            struct timeval tv;

            fd_set readset;
            FD_ZERO(&readset);
#if defined(_MSC_VER)
#pragma warning(push,1)
#endif //defined(_MSC_VER)
            FD_SET(fd, &readset);
#if defined(_MSC_VER)
#pragma warning(pop)
#endif //defined(_MSC_VER)

            // Initialize time out struct
            tv.tv_sec = getConnectionTimeout();
            tv.tv_usec = 0;

            int result = select(fd + 1, &readset, NULL, NULL, &tv);
            if (result <= 0){
                int err = getLastSocketError();
                throw SocketError(err, std::string(
                                      "disconnect or timeout while receiveing from socket " +
                                      hostname(getRemoteAddress()) + ":" + as_string(getRemotePort())));
            }
        }

        int bytesread = recv(fd, (char*)data, maxlen, 0);

        if (bytesread>0){
            return bytesread;
        } else if (bytesread == 0) {
            _myIsConnected = false; // XXX: hack for tcp disconnect
            //throw SocketDisconnected(PLUS_FILE_LINE);
        } else {
            int err = getLastSocketError();
            if(err == OS_SOCKET_ERROR(EWOULDBLOCK)) {
                return 0;
            } else {
                throw SocketError(err, "receive() failed");
            }
        }

        return 0;
    }
Пример #5
0
bool LogType::validate()
{
    writeInfo ( "config FILE = %s", getConfigFile().c_str());

    // check if config file exists
    if( !fileExists(getConfigFile()) )
    {
        writeError ("Can't find config FILE = %s", getConfigFile().c_str());
        return false;
    }

    // check if config file can read
    if( !fileReadable(getConfigFile()) )
    {
        writeError ("Can't read from config FILE = %s", getConfigFile().c_str());
        return false;
    }

    // check if config file exists
    if( !iniParse(getConfigFile()) )
    {
        writeError ("Can't parse config FILE = %s", getConfigFile().c_str());
        return false;
    }

    bool result = parseStorageType()
                    && parseIpAddress()
                    && parseRemotePort()
                    && parseSourcePort()
                    && parseUdpBufferSize();

    if (result) {
        __udp_socket = new boost::asio::ip::udp::socket(
            __io_service,
            boost::asio::ip::udp::endpoint(
                boost::asio::ip::address::from_string(getIpAddress()),
                getSourcePort()));
        __udp_remote_endpoint = new boost::asio::ip::udp::endpoint(
            boost::asio::ip::udp::endpoint(
                boost::asio::ip::address::from_string(getIpAddress()),
                getRemotePort()));
    }

    return result;
}
Пример #6
0
void CGI::logCGIData(const QString& filename)
{
	// create a QFile object to do the file I/O
	QFile file(filename);

	// open the file
	if (file.open(QIODevice::WriteOnly))
	{
		// create a QTextStream object on the file
		Q3TextStream textFile(&file);

		// get the environment
		textFile << "REQUEST_METHOD=" << getenv("REQUEST_METHOD") << endl;
		textFile << "CONTENT_LENGTH=" << getenv("CONTENT_LENGTH") << endl;

		// write the query string to the file
		textFile << "QUERY_STRING=" << query_string << endl;

		// write misc. CGI environment pieces
		textFile << "AUTH_TYPE=" << getAuthType() << endl;
		textFile << "GATEWAY_INTERFACE=" << getGatewayInterface() << endl;
		textFile << "HTTP_ACCEPT=" << getHTTPAccept() << endl;
		textFile << "HTTP_ACCEPT_ENCODING=" << getHTTPAcceptEncoding() << endl;
		textFile << "HTTP_ACCEPT_LANGUAGE=" << getHTTPAcceptLanguage() << endl;
		textFile << "HTTP_CONNECTION=" << getHTTPConnection() << endl;
		textFile << "HTTP_REFERER=" << getHTTPReferer() << endl;
		textFile << "HTTP_USER_AGENT=" << getHTTPUserAgent() << endl;
		textFile << "REMOTE_HOST=" << getRemoteHost() << endl;
		textFile << "REMOTE_ADDRESS=" << getRemoteAddress() << endl;
		textFile << "REMOTE_PORT=" << getRemotePort() << endl;
		textFile << "REQUEST_URI=" << getRequestURI() << endl;
		textFile << "SCRIPT_NAME=" << getScriptName() << endl;
		textFile << "SERVER_ADMIN=" << getServerAdmin() << endl;
		textFile << "SERVER_NAME=" << getServerName() << endl;
		textFile << "SERVER_PORT=" << getServerPort() << endl;
		textFile << "SERVER_PROTOCOL=" << getServerProtocol() << endl;
		textFile << "SERVER_SOFTWARE=" << getServerSoftware() << endl;
	}

	// close the file
	file.close();

}
Пример #7
0
void WorldSocket::Open()
{
    cout << "Accept connection from " << getRemoteHost() << ":" << getRemotePort() << endl;

    m_closed = false;

    m_pSendHeader = new PacketHeader(0, 0);

    string serverToClient = "CONNECTION SUCCESS - SERVER TO CLIENT";

    WorldPacket data(MSG_CONNECTION);
    data << serverToClient;

    SendPacket(data);

    data.Initialize(SMSG_AUTH_CHALLENGE, 4);
    data << 0;

    SendPacket(data);
}
Пример #8
0
void UdpServer::ProcessData(Packet* packet)
{
	Packet* sendPacket = NULL;
	if(packet != NULL)
	{
		//debug->notification(2, type, "local port: %i, remote port: %i", getLocalPort(), getRemotePort());
		string port = lexical_cast<string>(getRemotePort());
		sendPacket = new Packet("ECHO", 0x00000000);
		sendPacket->SetVar("TXN", "ECHO");
		sendPacket->SetVar("IP", getRemoteIp());
		sendPacket->SetVar("PORT", port);
		sendPacket->SetVar("ERR", "0");
		sendPacket->SetVar("TYPE", "1");
		sendPacket->SetVar("TID", packet->GetVar("TID"));
		delete packet;
	}
	else
		debug->warning(2, type, "UDP - Packet is NULL");

	send_data = PacketToData(sendPacket);
}
Пример #9
0
void Socket::connect(std::string url, int port, size_t maxTries) {
    // get its ip if it is not an ip
    if (isalpha(url[0])) {
        url = ss_.getIpFromName(url);
    }

    // create socket if it invalid
    if (s_ == INVALID_SOCKET) {
        s_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        if (s_ == INVALID_SOCKET) {
            throw SocketException("Failed to create a socket: " + ss_.getLastErrorMessage());
        }
    }

    // create remote address in native API
    sockaddr_in tcpAddr;
    tcpAddr.sin_family = AF_INET;
    tcpAddr.sin_addr.s_addr = inet_addr(url.c_str());
    tcpAddr.sin_port = htons(port);

    int tryCount = 0;
    while (tryCount < maxTries) {
        ++tryCount;
        int err = ::connect(s_, (sockaddr*) & tcpAddr, sizeof (tcpAddr));

        // error return from connect does not appear to be reliable
        int rport = getRemotePort();
        if (err != SOCKET_ERROR && rport != -1) {
            return;
        }

        // wait for a while before retrying
        usleep(100 * 1000); //ignore errors
    }
    // failed to connect. throw an exception.
    throw SocketException(ss_.getLastErrorMessage());
}
Пример #10
0
unsigned short sfTcpSocket_getRemotePort(const sfTcpSocket* socket)
{
    CSFML_CALL_RETURN(socket, getRemotePort(), 0);
}
Пример #11
0
void MediaHTTPConnection::start(void)
{
    TCPConnection::start();

    // start HTTP connection
    if (isConnected() && socket().is_open())
    {
        state = STATE_OPEN;
        /*
        notify our observers about new connection;
        notify();
        */

        BLITZ_LOG_INFO("got connection from: %s, from port:%d", getRemoteIP().c_str(), getRemotePort());

        // Set a deadline for receiving HTTP headers.
        m_io_control_timer.expires_from_now(boost::posix_time::seconds(MediaHTTPConnection::receive_timeout));

        boost::asio::async_read_until(socket(), m_response, "\r\n\r\n",
                                      boost::bind(&MediaHTTPConnection::handleReadHeader, this,
                                         boost::asio::placeholders::error));

        m_io_control_timer.async_wait(boost::bind(&MediaHTTPConnection::handleTimeoutOnSocket, this,
                                        boost::asio::placeholders::error));
    }
}
Пример #12
0
void AtDrv::startClient(uint8_t sock, const char *host, uint16_t port, uint8_t protMode)
{
	// if we enable CHECK_TCP_STATE feature, always call reConnect(), or we won't get right
	// tcp port status, since we disable tcp auto reconnect.
#ifndef CHECK_TCP_STATE
	bool needReConn = false;
#else
	bool needReConn = true;
#endif
	int curMode;
	char curHostBuf[MAX_HOST_NAME_BUF_SIZE];
	uint8_t curProtocol;
	uint16_t curPort;
	uint16_t curLocalPort;
	uint32_t curTimeout;
	bool curTcpAuto;

	// clear uart buffer first
	stopClient(sock);

	if(!isAtMode()) {
		if(!switchToAtMode()) {
			INFO1("Can't switch to at mode");
			goto end;
		}
	}
	
	if(!getMode(sock, &curMode) || curMode != MODE_CLIENT) {
		needReConn = true;
		INFO1("curMode != MODE_CLIENT");
		if(!setMode(sock, MODE_CLIENT)) {
			INFO1("Can't set mode");
			goto end;			
		}
	}

	if(!getRemoteHost(sock, curHostBuf) || (strcmp(curHostBuf,  host) != 0)) {
		needReConn = true;
		INFO1("curHostBuf != host");
		if(!setRemoteHost(sock, host)) {
			INFO1("Can't set host");
			goto end;	
		}
	}
	
	if(!getProtocol(sock, &curProtocol) || curProtocol != protMode) {
		needReConn = true;
		INFO1("curProtocol != protMode");
		if(!setProtocol(sock, protMode)) {
			INFO1("Can't set protocol");
			goto end;	
		}
	}
	
	if(!getRemotePort(sock, &curPort) || curPort != port) {
		needReConn = true;
		INFO1("curPort != port");
		if(!setPort(sock, port)) {
			INFO1("Can't set port");
			goto end;	
		}
	}
	
	if(!getTcpAuto(sock, &curTcpAuto) || curTcpAuto != false) {
		needReConn = true;
		INFO1("curTcpAuto != false");	
		if(!setTcpAuto(sock, false)) {
			INFO1("Can't set tcp auto");
			goto end;	
		}
	}	
	
	if(!getLocalPort(sock, &curLocalPort) || curLocalPort != localSockPort[sock]) {
		needReConn = true;
		INFO1("curLocalPort != port");
		if(!setLocalPort(sock, localSockPort[sock])) {
			INFO1("Can't set port");
			goto end;	
		}
	}	
	
	if(needReConn) {
		if(!reConnect()) {
			INFO1("Can't reconnect");
			goto end;	
		}
	}	

	sockPort[sock] = localSockPort[sock];
	sockConnected[sock] = true;

end:
	return;
}
Пример #13
0
uint16_t AsyncClient::remotePort() {
    return getRemotePort();
}
Пример #14
0
void AtDrv::startClient(uint8_t sock, uint32_t ipAddress, uint16_t port, uint8_t protMode)
{
	// if we enable CHECK_TCP_STATE feature, always call reConnect(), or we won't get right
	// tcp port status, since we disable tcp auto reconnect.
#ifndef CHECK_TCP_STATE
	bool needReConn = false;
#else
	bool needReConn = true;
#endif
	int curMode;
	uint32_t curIp;
	uint8_t curProtocol;
	uint16_t curPort;
	uint16_t curLocalPort;
	uint32_t curTimeout;
	bool curTcpAuto;

	// clear uart buffer first
	stopClient(sock);
	
	if(!isAtMode()) {
		if(!switchToAtMode()) {
			INFO1("Can't switch to at mode");
			goto end;
		}
	}
	
	if(!getMode(sock, &curMode) || curMode != MODE_CLIENT) {
		needReConn = true;
		INFO1("curMode != MODE_CLIENT");
		if(!setMode(sock, MODE_CLIENT)) {
			INFO1("Can't set mode");
			goto end;			
		}
	}
	
	if(!getRemoteIp(sock, (uint8_t *)&curIp) || curIp != ipAddress) {
		needReConn = true;
		INFO1("curIp != ipAddress");
		if(!setRemoteIp(sock, ipAddress)) {
			INFO1("Can't set ip");
			goto end;	
		}
	}
	
	if(!getProtocol(sock, &curProtocol) || curProtocol != protMode) {
		needReConn = true;
		INFO1("curProtocol != protMode");
		if(!setProtocol(sock, protMode)) {
			INFO1("Can't set protocol");
			goto end;	
		}
	}
	
	if(!getRemotePort(sock, &curPort) || curPort != port) {
		needReConn = true;
		INFO1("curPort != port");
		if(!setPort(sock, port)) {
			INFO1("Can't set port");
			goto end;	
		}
	}

	if(!getTcpAuto(sock, &curTcpAuto) || curTcpAuto != false) {
		needReConn = true;
		INFO1("curTcpAuto != false");	
		if(!setTcpAuto(sock, false)) {
			INFO1("Can't set tcp auto");
			goto end;	
		}
	}
	
	if(!getLocalPort(sock, &curLocalPort) || curLocalPort != localSockPort[sock]) {
		needReConn = true;
		INFO1("curLocalPort != port");
		if(!setLocalPort(sock, localSockPort[sock])) {
			INFO1("Can't set port");
			goto end;	
		}
	}
	
	if(needReConn) {
		if(!reConnect()) {
			INFO1("Can't reconnect");
			goto end;	
		}
	}

	sockPort[sock] = localSockPort[sock];
	sockConnected[sock] = true;

end:
	return;
}
Пример #15
0
void AtDrv::startServer(uint8_t sock, uint16_t port, uint8_t protMode)
{
	bool needReConn = false;
	int curMode;
	uint8_t curProtocol;
	uint16_t curPort;
	uint32_t curTimeout;

	if(!isAtMode()) {
		if(!switchToAtMode()) {
			INFO1("Can't switch to at mode");
			goto end;
		}
	}
	
	if(!getMode(sock, &curMode) || curMode != MODE_SERVER) {
		needReConn = true;
		INFO1("curMode != MODE_SERVER");
		if(!setMode(sock, MODE_SERVER)) {
			INFO1("Can't set mode");
			goto end;			
		}
	}
	
	if(!getProtocol(sock, &curProtocol) || curProtocol != protMode) {
		needReConn = true;
		INFO1("curProtocol != protMode");
		if(!setProtocol(sock, protMode)) {
			INFO1("Can't set protocol");
			goto end;	
		}
	}

	if(!getRemotePort(sock, &curPort) || curPort != port) {
		needReConn = true;
		INFO1("curPort != port");
		if(!setPort(sock, port)) {
			INFO1("Can't set port");
			goto end;	
		}
	}

	if(!getNetworkTimeout(sock, &curTimeout) || curTimeout != 0) {
		needReConn = true;
		INFO1("curTimeout != 0");	
		if(!setNetworkTimeout(sock, 0)) {
			INFO1("Can't set timeout");
			goto end;	
		}
	}

	if(needReConn) {
		if(!reConnect()) {
			INFO1("Can't reconnect");
			goto end;	
		}
	}

	sockPort[sock] = port;
	sockConnected[sock] = true;

end:
	return;
}
Пример #16
0
void WorldSocket::HandleReceiveData()
{
    if (m_closed || !m_pSHSocket || m_pSHSocket->disconnected() || m_pSHSocket->nextReadSize() <= 0)
        return;

    try
    {
        uint16 readSize = m_pSHSocket->nextReadSize();
        uint16 readPos  = 0;
        m_recvDataHolder.resize(readSize);
        m_pSHSocket->Read(&m_recvDataHolder[0], readSize);

        cout << "Read From " << getRemoteHost() << ":" << getRemotePort() << ", Data Size: " << readSize << endl;

        while (readSize)
        {
            if (m_missedDataSize)
            {
                uint16 missedSize = m_missedDataSize >= readSize ? readSize : m_missedDataSize;
                m_pRecvPacket->Append(&m_recvDataHolder[0], missedSize);
                readSize         -= missedSize;
                m_missedDataSize -= missedSize;
                readPos          += missedSize;

                if (!m_missedDataSize)
                {
                    ProcessIncomingPacket(m_pRecvPacket);
                    m_pRecvPacket = NULL;
                }
            }
            else
            {
                if (readSize < 4)
                    throw SHException(SHException::SH_EXCEPTION_OUT_OF_RANGE, "Missed packet header info!");

                uint32 size    = ((m_recvDataHolder[readPos++] & 0xFF) << 8) | (m_recvDataHolder[readPos++] & 0xFF);
                uint16 msgCode = ((m_recvDataHolder[readPos++] & 0xFF) << 8) | (m_recvDataHolder[readPos++] & 0xFF);

                readSize -= 4;

                m_pRecvPacket = new WorldPacket(msgCode, size);

                if (size > readSize)
                {
                    m_missedDataSize  = size - readSize;
                    if (readSize)
                    {
                        m_pRecvPacket->Append(&m_recvDataHolder[readPos], readSize);
                        readPos  += readSize;
                        readSize -= readSize;
                    }
                }
                else
                {
                    m_pRecvPacket->Append(&m_recvDataHolder[readPos], size);
                    readPos  += size;
                    readSize -= size;

                    ProcessIncomingPacket(m_pRecvPacket);
                    m_pRecvPacket = NULL;
                }
            }
        }

        m_recvDataHolder.clear();
    }
    catch (SHException e)
    {
        m_recvDataHolder.clear();

        cout << e.what() << endl;
    }
}
LocationItem *LocationContextDialog::exec()
{
	if (remoteHostItem)
	{
		// Inject values
		ui.remoteHost->setText(remoteHostItem->getRemoteHost());
		ui.autoConnection->setChecked(remoteHostItem->isAutoConnection());

		if (remoteHostItem->isStomp())
		{
			ui.remotePort->setCurrentIndex(StompIndex);
		}
		else if (remoteHostItem->isOpenWire())
		{
			ui.remotePort->setCurrentIndex(OpenWireIndex);
		}
		else if (remoteHostItem->isHttp())
		{
			ui.remotePort->setCurrentIndex(HttpIndex);
		}
		else if (remoteHostItem->isHttps())
		{
			ui.remotePort->setCurrentIndex(HttpsIndex);
		}
		else
		{
			ui.remotePort->setEditText(remoteHostItem->getRemotePort());
		}
	}

	if (subscriptionItem)
	{
		// Inject values
		if (subscriptionItem->isTopic())
		{
			ui.subscriptionType->setCurrentIndex(TopicIndex);
		}
		else if (subscriptionItem->isQueue())
		{
			ui.subscriptionType->setCurrentIndex(QueueIndex);
		}

		ui.subscription->setText(subscriptionItem->getSubscription());
		ui.autoSubscription->setCheckable(subscriptionItem->isAutoSubscription());
	}

	// Set enabled groups
	setRemoteHostGroupEnabled(remoteHostItem == 0);
	setSubscriptionGroupEnabled(remoteHostItem != 0);

	// Can the dialog be accepted?
	updateAcceptable();

	// Set focus
	if (managementRole == AddRemoteHost)
		ui.remoteHost->setFocus();
	else if (managementRole == AddSubscription)
		ui.subscription->setFocus();

	// Call the superclass exec method
	if (QDialog::exec() != QDialog::Accepted)
		return 0;

	// Create a new location item
	LocationItem *item = new LocationItem();
	item->setRemoteHost(ui.remoteHost->text());
	item->setRemotePort(getRemotePort());
	item->setAutoConnection(ui.autoConnection->isChecked());
	item->setSubscription(getSubscription());
	item->setAutoSubscription(ui.autoSubscription->isChecked());

	// Update the visible data
	item->setText(LocationItem::DescriptionColumn, item->getDisplayText());

	// Cleanup
	ui.autoConnection->setChecked(false);
	ui.remoteHost->setText(QString::null);
	ui.remotePort->setEditText(QString::null);
	ui.remotePort->setCurrentIndex(0);
	ui.autoSubscription->setChecked(false);
	ui.subscriptionType->setCurrentIndex(TopicIndex);
	ui.subscription->setText(QString::null);

	// Done.
	return item;
}
Пример #18
0
int Cconfigurator::saveConfigAs(QByteArray path, QByteArray filename)
{
  unsigned int i;

  // try QSettings
  QSettings conf(path + filename, QSettings::IniFormat);

  conf.beginGroup("General");
  conf.setValue("mapFile", getBaseFile());
  conf.setValue("windowRect", renderer_window->geometry() );
  conf.setValue("alwaysOnTop", getAlwaysOnTop() );
  conf.setValue("startupMode", getStartupMode() );
  conf.endGroup();

  conf.beginGroup("Networking");
  conf.setValue("localPort", getLocalPort() );
  conf.setValue("remoteHost", getRemoteHost() );
  conf.setValue("remotePort", getRemotePort() );
  conf.endGroup();

  conf.beginGroup("OpenGL");
  conf.setValue("texturesVisibility", getTextureVisibility() );
  conf.setValue("detailsVisibility", getDetailsVisibility() );
  conf.setValue("visibleLayers", getVisibleLayers() );
  conf.setValue("showNotes", getShowNotesRenderer() );
  conf.setValue("showRegions", getShowRegionsInfo() );
  conf.setValue("displayRegions", getDisplayRegionsRenderer() );
  conf.setValue("multisampling", getMultisampling() );
  conf.setValue("selectOnAnyLayer", getSelectOAnyLayer());
  conf.setValue("angleX", (double) angleX );
  conf.setValue("angleY", (double) angleY );
  conf.setValue("angleZ", (double) angleZ );
  conf.setValue("userX", (double) userX );
  conf.setValue("userY", (double) userY );
  conf.setValue("userZ", (double) userZ );
  conf.setValue("noteColor", getNoteColor() );
  conf.setValue("drawPrespam", getDrawPrespam());

  conf.endGroup();

  conf.beginGroup("Engine");
  conf.setValue("checkExits", getExitsCheck() );
  conf.setValue("checkTerrain", getTerrainCheck() );
  conf.setValue("briefmode", getBriefMode() );
  conf.setValue("autoMerge", getAutomerge() );
  conf.setValue("angryLinker", getAngrylinker() );
  conf.setValue("dualLinker", getDuallinker() );
  conf.setValue("autoRefresh", getAutorefresh() );
  conf.setValue("roomNameQuote", getNameQuote() );
  conf.setValue("descQuote", getDescQuote() );
  conf.setValue("mactionUsesPrespam", getMactionUsesPrespam());
  conf.setValue("prespamTTL", getPrespamTTL());
  conf.endGroup();

  conf.beginGroup("Patterns");
  conf.setValue("exitsPattern", getExitsPattern());
  conf.setValue("spellsEffectPattern", spells_pattern);
  conf.setValue( "scorePattern", getScorePattern() );
  conf.setValue( "scorePatternShort", getShortScorePattern() );
  conf.endGroup();



  conf.beginGroup("GroupManager");
  conf.setValue("remoteHost", getGroupManagerHost() );
  conf.setValue("remotePort", getGroupManagerRemotePort() );
  conf.setValue("localServerPort", getGroupManagerLocalPort() );
  conf.setValue("charName", getGroupManagerCharName() );
  conf.setValue("charColor", getGroupManagerColor().name() );
  conf.setValue("showSelf", getGroupManagerShowSelf() );
  conf.setValue("notifyArm", getGroupManagerNotifyArmour() );
  conf.setValue("notifySanc", getGroupManagerNotifySanc() );
  conf.setValue("notifyBash", getGroupManagerNotifyBash() );
  conf.setValue("showGroupManager", getGroupManagerShowManager() );

  conf.setValue("windowRect", renderer_window->getGroupManagerRect() );

  conf.endGroup();


  conf.beginWriteArray("Spells");
  for (unsigned int i = 0; i < spells.size(); ++i) {
	  conf.setArrayIndex(i);
	  conf.setValue("addon", spells[i].addon);
	  conf.setValue("name", spells[i].name);
	  conf.setValue("upMessage", spells[i].up_mes);
	  conf.setValue("refreshMessage", spells[i].refresh_mes);
	  conf.setValue("downMessage", spells[i].down_mes);
  }
  conf.endArray();



  conf.beginGroup("Movement tracking");
  conf.beginWriteArray("Cancel Patterns");
  for (int i = 0; i < moveCancelPatterns.size(); ++i) {
	  conf.setArrayIndex(i);
	  conf.setValue("pattern", moveCancelPatterns.at(i));
  }
  conf.endArray();
  conf.beginWriteArray("Force Patterns");
  for (int i = 0; i < moveForcePatterns.size(); ++i) {
	  conf.setArrayIndex(i);
	  conf.setValue("pattern", moveForcePatterns.at(i));
  }
  conf.endArray();
  conf.endGroup();


  conf.beginWriteArray("Debug Settings");
  i = 0;
  while (debug_data[i].name) {
	  conf.setArrayIndex(i);
	  conf.setValue("name", debug_data[i].name);
	  conf.setValue("state", debug_data[i].state);

      i++;
  }
  conf.endArray();

  configFile = filename;
  configPath = path;

  setConfigModified(false);
  return true;
}