// <dogmode>
void LLChatBar::sendChat( EChatType type )
{
	if (mInputEditor)
	{
		LLWString text = mInputEditor->getConvertedText();
		if (!text.empty())
		{
			// store sent line in history, duplicates will get filtered
			if (mInputEditor) mInputEditor->updateHistory();

			S32 channel = 0;
			stripChannelNumber(text, &channel);
			
			std::string utf8text = wstring_to_utf8str(text);//+" and read is "+llformat("%f",readChan)+" and undone is "+llformat("%d",undoneChan)+" but actualy channel is "+llformat("%d",channel);
			// Try to trigger a gesture, if not chat to a script.
			std::string utf8_revised_text;
			if (0 == channel)
			{
				convert_roleplay_text(utf8text);
				// discard returned "found" boolean
				LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
			}
			else
			{
				utf8_revised_text = utf8text;
			}

			utf8_revised_text = utf8str_trim(utf8_revised_text);
			EChatType nType(type == CHAT_TYPE_OOC ? CHAT_TYPE_NORMAL : type);
			if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, nType))
			{
				// Chat with animation
#if SHY_MOD //Command handler
				if(!SHCommandHandler::handleCommand(true, utf8_revised_text, gAgentID, (LLViewerObject*)gAgentAvatarp))//returns true if handled
#endif //shy_mod
				sendChatFromViewer(utf8_revised_text, nType, TRUE);
			}
		}
	}

	childSetValue("Chat Editor", LLStringUtil::null);

	gAgent.stopTyping();

	// If the user wants to stop chatting on hitting return, lose focus
	// and go out of chat mode.
	if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn"))
	{
		stopChat();
	}
}
Example #2
0
		void getAddress(float lat, float lon,std::string &address){

			bool placeIDExist(false);
			mapValue.clear();

			pqxx::nontransaction nType((*ptrConn));

	        for (int i=0; i < 10; ++i){

	        	sql="select place_id,parent_place_id,rank_search from placex WHERE ST_DWithin(ST_SetSRID(ST_Point("+std::to_string(lon)+","+std::to_string(lat)+"),4326), "
	   		         "geometry, "+std::to_string(radius)+") and rank_search != 28 and rank_search >= 26 and (name is not null or housenumber is not null) and"
	   		         " class not in ('waterway','railway','tunnel','bridge') and indexed_status = 0 and "
	   		         "(ST_GeometryType(geometry) not in ('ST_Polygon','ST_MultiPolygon') "
	   		         "OR ST_DWithin(ST_SetSRID(ST_Point("+std::to_string(lon)+","+std::to_string(lat)+"),4326), centroid, "+std::to_string(radius)+")) "
	   		         "ORDER BY ST_distance(ST_SetSRID(ST_Point("+std::to_string(lon)+","+std::to_string(lat)+"),4326), geometry) ASC limit 1";

	        	//std::cout << sql << std::endl;

	        	resultSet = nType.exec(sql);

				if (!resultSet.empty()) {
					for (pqxx::result::const_iterator c = resultSet.begin(); c != resultSet.end(); ++c){
						//cout << '\t' << c[0].as(string()) << '\t' << c[1].as(string()) <<'\t' << c[2].as(string()) <<endl;
						place_id = c[0].as(std::string());
					}
					placeIDExist=true;
					break;
				}

				radius*=2;

	        }// end of for loop

	        if(placeIDExist){

	        	resultSet = nType.exec("select name,class,type from get_addressdata(" + place_id + ") where isaddress order by rank_address asc");

	            if (!resultSet.empty()) {
	            	for (pqxx::result::const_iterator c = resultSet.begin(); c != resultSet.end(); ++c){
	            		parseLocation( c[0].as(std::string()), c[1].as(std::string()), c[2].as(std::string()));
	            	}
	            }

	        }

	        printAddress(address);

		} // end of func getAddress