コード例 #1
0
AddParticipantBox::AddParticipantBox(ChatData *chat) :
	_scroll(this, st::newGroupScroll), _inner(chat),
	_filter(this, st::contactsFilter, lang(lng_participant_filter)),
	_invite(this, lang(lng_participant_invite), st::btnSelectDone),
	_cancel(this, lang(lng_cancel), st::btnSelectCancel),
	_hiding(false), a_opacity(0, 1), af_opacity(anim::linear) {

	_width = st::participantWidth;
	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom();
	if (_height > st::participantMaxHeight) _height = st::participantMaxHeight;

	resize(_width, _height);

	_scroll.setWidget(&_inner);
	_scroll.setFocusPolicy(Qt::NoFocus);

	connect(&_invite, SIGNAL(clicked()), this, SLOT(onInvite()));
	connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(closed()));
	connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
	connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
	connect(&_filter, SIGNAL(cancelled()), this, SIGNAL(onClose()));
	connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int)));
	connect(&_inner, SIGNAL(selectAllQuery()), &_filter, SLOT(selectAll()));

	showAll();
	_cache = myGrab(this, rect());
	hideAll();
}
コード例 #2
0
ファイル: AmSession.cpp プロジェクト: Chocolatbuddha/sems
void AmSession::onSipRequest(const AmSipRequest& req)
{
  CALL_EVENT_H(onSipRequest,req);

  DBG("onSipRequest: method = %s\n",req.method.c_str());

  updateRefreshMethod(req.hdrs);

  if(req.method == SIP_METH_INVITE){

    try {
      onInvite(req);
    }
    catch(const string& s) {
      ERROR("%s\n",s.c_str());
      setStopped();
      dlg->reply(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR);
    }
    catch(const AmSession::Exception& e) {
      ERROR("%i %s\n",e.code,e.reason.c_str());
      setStopped();
      dlg->reply(req, e.code, e.reason, NULL, e.hdrs);
    }
  }
  else if(req.method == SIP_METH_ACK){
    return;
  }
  else if( req.method == SIP_METH_BYE ){
    dlg->reply(req,200,"OK");
    onBye(req);
  }
  else if( req.method == SIP_METH_CANCEL ){
    onCancel(req);
  } 
  else if( req.method == SIP_METH_INFO ){

    const AmMimeBody* dtmf_body = 
      req.body.hasContentType("application/dtmf-relay");

    if (dtmf_body) {
      string dtmf_body_str((const char*)dtmf_body->getPayload(),
			   dtmf_body->getLen());
      postDtmfEvent(new AmSipDtmfEvent(dtmf_body_str));
      dlg->reply(req, 200, "OK");
    } else {
      dlg->reply(req, 415, "Unsupported Media Type");
    }
  } else if (req.method == SIP_METH_PRACK) {
    // TODO: SDP
    dlg->reply(req, 200, "OK");
    // TODO: WARN: only include latest SDP if req.rseq == dlg->rseq (latest 1xx)
  }
  else {
    dlg->reply(req, 501, "Not implemented");
  }
}
コード例 #3
0
ファイル: GWSession.cpp プロジェクト: Chocolatbuddha/sems
// we just need a hack this function for INVITE as orginal executes onSessionStart imediately after OnInvite
void GWSession::onSipRequest(const AmSipRequest& req)
{
    DBG("GWSession::onSipRequest check 1\n");
    if(req.method == "INVITE"){
	dlg.updateStatus(req);
	onInvite(req);
  } else {
    DBG("GWSession::onSipRequest calling parent\n");
    AmSession::onSipRequest(req);
  }
}
コード例 #4
0
void AmSession::onSipRequest(const AmSipRequest& req)
{
  CALL_EVENT_H(onSipRequest,req);

  dlg.updateStatus(req);
    
  DBG("onSipRequest: method = %s\n",req.method.c_str());
  if(req.method == "INVITE"){
	
    onInvite(req);

    if(detached.get() && !getStopped()){
	
      onSessionStart(req);
	    
      if(input || output)
	AmMediaProcessor::instance()->addSession(this, callgroup);
      else {
	ERROR("missing audio input and/or ouput.\n");
      }
    }
  }
  else if( req.method == "BYE" ){
	
    dlg.reply(req,200,"OK");
    onBye(req);
  }
  else if( req.method == "CANCEL" ){

    dlg.reply(req,200,"OK");
    onCancel();

  } else if( req.method == "INFO" ){

    if ((strip_header_params(getHeader(req.hdrs, "Content-Type"))
	 =="application/dtmf-relay")|| 
	(strip_header_params(getHeader(req.hdrs, "c"))
	 =="application/dtmf-relay")){
      postDtmfEvent(new AmSipDtmfEvent(req.body));
      dlg.reply(req, 200, "OK");
    }
  } 
}
コード例 #5
0
ファイル: cppmodule.cpp プロジェクト: S1M0NE/IrcBot
bool CPPModule::onEvent(IrcConnection* connection, const std::string& senderID, const std::string& eventName, const std::string& json, const std::string& optString) {
	JSONNode n;
	if(!json.empty()) {
		n = libjson::parse(json);
	}

	if(senderID=="IRCCONNECTION") {
		//Create a IrcModuleConnection instance
		IrcModuleConnection ircModuleConnection(mID, mModuleManager, connection);


		//Call onConnect if its the called event
		if(eventName=="onConnect") {
			return onConnect(ircModuleConnection);
		}


		//Convert the IRC Message
		IrcMessage message;
		message.ircLine = n["ircLine"].as_string();
		message.prefix = n["prefix"].as_string();
		message.hasDetailedPrefix = n["hasDetailedPrefix"].as_bool();

		if(message.hasDetailedPrefix) {
			message.msgPrefix.nick_or_server = n["msgPrefix"]["nick_or_server"].as_string();
			message.msgPrefix.user = n["msgPrefix"]["user"].as_string();
			message.msgPrefix.host = n["msgPrefix"]["host"].as_string();
		}

		message.command = n["command"].as_string();
		message.isNumeric = n["isNumeric"].as_bool();
		message.target = n["target"].as_string();
		message.params = n["params"].as_string();


		//Call all other event handlers
		if(eventName=="onMessage") {
			return onMessage(ircModuleConnection, message);
		}
		else if(eventName=="onJoin") {
			return onJoin(ircModuleConnection, message);
		}
		else if(eventName=="onPart") {
			return onPart(ircModuleConnection, message);
		}
		else if(eventName=="onKick") {
			return onKick(ircModuleConnection, message, optString);
		}
		else if(eventName=="onQuit") {
			return onQuit(ircModuleConnection, message);
		}
		else if(eventName=="onKill") {
			return onKill(ircModuleConnection, message, optString);
		}
		else if(eventName=="onPrivateMessage") {
			return onPrivateMessage(ircModuleConnection, message);
		}
		else if(eventName=="onChannelMessage") {
			return onChannelMessage(ircModuleConnection, message);
		}
		else if(eventName=="onNotice") {
			return onNotice(ircModuleConnection, message);
		}
		else if(eventName=="onInvite") {
			return onInvite(ircModuleConnection, message);
		}
		else if(eventName=="onTopicChanged") {
			return onTopicChanged(ircModuleConnection, message);
		}
		else if(eventName=="onNickChanged") {
			return onNickChanged(ircModuleConnection, message);
		}
	}

	return true;
}