示例#1
0
int main( int argc, char** argv )
{
    osgAnimation::Bone* bone0 = createBone( "bone0", osg::Vec3(0.0,0.0,0.0) );
    osgAnimation::Bone* bone1 = createBone( "bone1", osg::Vec3(1.0,0.0,0.0) );
    osgAnimation::Bone* bone2 = createBone( "bone2", osg::Vec3(1.0,0.0,0.0) );

    osg::ref_ptr<osgAnimation::Skeleton> skelroot = new osgAnimation::Skeleton;
    skelroot->setDefaultUpdateCallback();
    skelroot->addChild( bone0 );
    bone0->addChild( bone1 );
    bone1->addChild( bone2 );

    osg::ref_ptr<osgAnimation::Animation> anim = new osgAnimation::Animation;
    anim->setPlaymode( osgAnimation::Animation::PPONG );
    anim->addChannel( createChannel("bone1", osg::PI_2) );
    anim->addChannel( createChannel("bone2", osg::PI_2) );

    osg::ref_ptr<osgAnimation::BasicAnimationManager> manager = new osgAnimation::BasicAnimationManager;
    manager->registerAnimation( anim.get() );
    manager->playAnimation( anim.get() );

    osg::ref_ptr<osg::Group> root = new osg::Group;
    root->addChild( skelroot.get() );
    root->setUpdateCallback( manager.get() );

    osgViewer::Viewer viewer;
    viewer.setSceneData( root.get() );
    return viewer.run();
}
示例#2
0
ChannelList Chat::getChannelList(Player* player)
{
  ChannelList list;
  NormalChannelMap::iterator itn;
  PrivateChannelMap::iterator it;
  bool gotPrivate = false;

  // If has guild
  if(player->getGuildId() && player->getGuildName().length()){
    ChatChannel *channel = getChannel(player, CHANNEL_GUILD);

    if(channel)
      list.push_back(channel);
    else if((channel = createChannel(player, CHANNEL_GUILD)))
      list.push_back(channel);
  }

  if(player->getParty()){
    ChatChannel *channel = getChannel(player, CHANNEL_PARTY);

    if(channel)
      list.push_back(channel);
    else if((channel = createChannel(player, CHANNEL_PARTY)))
      list.push_back(channel);
  }

  for(itn = m_normalChannels.begin(); itn != m_normalChannels.end(); ++itn){
    if(!player->hasFlag(PlayerFlag_CannotBeMuted)){
      if(itn->first == CHANNEL_TRADE && player->getVocationId() == 0)
        continue;
      if(itn->first == CHANNEL_TRADE_ROOK && player->getVocationId() != 0)
        continue;
    }

    ChatChannel *channel = itn->second;
    list.push_back(channel);
  }

  for(it = m_privateChannels.begin(); it != m_privateChannels.end(); ++it){
    PrivateChatChannel* channel = it->second;

    if(channel){
      if(channel->isInvited(player))
        list.push_back(channel);

      if(channel->getOwner() == player->getGUID())
        gotPrivate = true;
    }
  }

  if(!gotPrivate)
    list.push_front(dummyPrivate);

  return list;
}
示例#3
0
ChannelList Chat::getChannelList(const Player& player)
{
	ChannelList list;
	if (player.getGuild()) {
		ChatChannel* channel = getChannel(player, CHANNEL_GUILD);
		if (channel) {
			list.push_back(channel);
		} else {
			channel = createChannel(player, CHANNEL_GUILD);
			if (channel) {
				list.push_back(channel);
			}
		}
	}

	if (player.getParty()) {
		ChatChannel* channel = getChannel(player, CHANNEL_PARTY);
		if (channel) {
			list.push_back(channel);
		} else {
			channel = createChannel(player, CHANNEL_PARTY);
			if (channel) {
				list.push_back(channel);
			}
		}
	}

	for (const auto& it : normalChannels) {
		ChatChannel* channel = getChannel(player, it.first);
		if (channel) {
			list.push_back(channel);
		}
	}

	bool hasPrivate = false;
	for (const auto& it : privateChannels) {
		if (PrivateChatChannel* channel = it.second) {
			uint32_t guid = player.getGUID();
			if (channel->isInvited(guid)) {
				list.push_back(channel);
			}

			if (channel->getOwner() == guid) {
				hasPrivate = true;
			}
		}
	}

	if (!hasPrivate && player.isPremium()) {
		list.push_front(dummyPrivate);
	}
	return list;
}
示例#4
0
ChannelList Chat::getChannelList(Player* player)
{
	ChannelList list;

	if (player->getGuild()) {
		ChatChannel* channel = getChannel(player, CHANNEL_GUILD);
		if (channel) {
			list.push_back(channel);
		} else {
			channel = createChannel(player, CHANNEL_GUILD);
			if (channel) {
				list.push_back(channel);
			}
		}
	}

	if (player->getParty()) {
		ChatChannel* channel = getChannel(player, CHANNEL_PARTY);
		if (channel) {
			list.push_back(channel);
		} else {
			channel = createChannel(player, CHANNEL_PARTY);
			if (channel) {
				list.push_back(channel);
			}
		}
	}

	for (NormalChannelMap::iterator it = m_normalChannels.begin(); it != m_normalChannels.end(); ++it) {
		ChatChannel* channel = getChannel(player, it->first);
		if (channel) {
			list.push_back(it->second);
		}
	}

	bool hasPrivate = false;
	for (PrivateChannelMap::iterator pit = m_privateChannels.begin(); pit != m_privateChannels.end(); ++pit) {
		if (PrivateChatChannel* channel = pit->second) {
			if (channel->isInvited(player)) {
				list.push_back(channel);
			}

			if (channel->getOwner() == player->getGUID()) {
				hasPrivate = true;
			}
		}
	}

	if (!hasPrivate && player->isPremium()) {
		list.push_front(dummyPrivate);
	}
	return list;
}
示例#5
0
MessageChannel::MessageChannel(ExecutionContext* context)
    : m_port1(MessagePort::create(*context))
    , m_port2(MessagePort::create(*context))
{
    ScriptWrappable::init(this);
    createChannel(m_port1.get(), m_port2.get());
}
示例#6
0
/*!
  Creates a new private conference and invites additional attendees.
  The conference will get a random password.

  JSON Parameters:
  - participants (Array with fingerprints)
*/
bool ConferenceModule::Private::processJsonConferenceCreate(TcpSocketHandler &socket, const TcpProtocol::RequestHeader &header, const QVariant &data)
{
    auto json = data.toMap();
    auto participants = json.value("participants").toList();

    auto server = _pOwner->_serverBase;
    auto selfInfo = socket.getClientInfo();

    // Create invisible channel with random password.
    auto channel = server->createChannel();
    if (!server->joinChannel(selfInfo->id, channel->id)) {
        QVariantMap m;
        m["status"] = 500;
        m["error_message"] = "Can not create channel.";
        return socket.sendJsonResponse(header, m);
    }

    // Invite participants.
    foreach (auto o, participants) {
        auto fingerprint = o.toByteArray();
        auto sock = server->findSocket(fingerprint);
        if (sock) {
            QVariantMap m;
            m["method"] = "/conference/notify/invite";
            m["initiator"] = socket._key.fingerprint();
            m["channel"] = channel->toVariant();
            sock->sendJsonPackage(m);
        }
    }
示例#7
0
int FlowData::createChannelGeometry(int dimension)
{
    int result = createChannel();
	//just take the dimension as if it was an offset to the geometryData array
    channels[result]->copyValues((float*)geometry.geometryData, 3, dimension);
    return result;
}
示例#8
0
void MumbleClient::processServerSync(quint8 *message, quint64 size)
{
    MumbleProto::ServerSync sync;
    sync.ParseFromArray(message,size);
    _session_id = sync.session();
    _max_bandwidth = sync.max_bandwidth();
    std::string welcome = sync.welcome_text();
    _synchronized = true;
    qDebug() << QString::fromStdString(welcome)
             << " max bandwidth: " << _max_bandwidth
             << " session: " << QString::number(_session_id);
#ifndef NO_CRYPT
    createChannel();
#endif
    MumbleProto::UserState us;
    us.set_session(_session_id);
    us.set_actor(_session_id);
    us.set_self_deaf(true);
    us.set_self_mute(true);
    us.set_comment(_settings->_callsign.toStdString().c_str());
    int msize = us.ByteSize();
    quint8 data[msize];
    us.SerializeToArray(data,msize);
    this->sendMessage(data,9,msize);
}
Channel::shared_pointer ChannelProviderLocal::createChannel(
    string const & channelName,
    ChannelRequester::shared_pointer  const &channelRequester,
    short priority)
{
    return createChannel(channelName,channelRequester,priority,"");
}
示例#10
0
Animation::Animation(const char* id, AnimationTarget* target, int propertyId, unsigned int keyCount, unsigned long* keyTimes, float* keyValues, float* keyInValue, float* keyOutValue, unsigned int type)
    : _controller(Game::getInstance()->getAnimationController()), _id(id), _duration(0), _defaultClip(NULL), _clips(NULL)
{
    createChannel(target, propertyId, keyCount, keyTimes, keyValues, keyInValue, keyOutValue, type);
    // Release the animation because a newly created animation has a ref count of 1 and the channels hold the ref to animation.
    release();
    assert(getRefCount() == 1);
}
示例#11
0
	//------------------------------------------------------------------------
	EventManager::EventManager(){
		setTaskName("EventSystem");

		NR_Log(Log::LOG_ENGINE, "EventManager: Initialize the event management system");

		// create default system wide channel
		createChannel(NR_DEFAULT_EVENT_CHANNEL);
	}
示例#12
0
/** Constructor */
GxsChannelDialog::GxsChannelDialog(QWidget *parent)
	: RsGxsUpdateBroadcastPage(rsGxsChannels, parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(parent))
{
	/* Invoke the Qt Designer generated object setup routine */
	ui.setupUi(this);

	/* Setup UI helper */
	mStateHelper = new UIStateHelper(this);

	mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui.progressBar, UISTATE_LOADING_VISIBLE);
	mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui.progressLabel, UISTATE_LOADING_VISIBLE);

	mStateHelper->addLoadPlaceholder(TOKEN_TYPE_GROUP_DATA, ui.nameLabel);

	mStateHelper->addWidget(TOKEN_TYPE_GROUP_DATA, ui.postButton);
	mStateHelper->addWidget(TOKEN_TYPE_GROUP_DATA, ui.logoLabel);

	mChannelQueue = new TokenQueue(rsGxsChannels->getTokenService(), this);

	connect(ui.postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
//	connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));

	/*************** Setup Left Hand Side (List of Channels) ****************/

	connect(ui.treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(channelListCustomPopupMenu(QPoint)));
	connect(ui.treeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(selectChannel(QString)));
	connect(ui.todoPushButton, SIGNAL(clicked()), this, SLOT(todo()));

	mChannelId.clear();

	/* Set initial size the splitter */
	QList<int> sizes;
	sizes << 300 << width(); // Qt calculates the right sizes
	ui.splitter->setSizes(sizes);

	/* Initialize group tree */
	QToolButton *newChannelButton = new QToolButton(this);
	newChannelButton->setIcon(QIcon(":/images/add_channel24.png"));
	newChannelButton->setToolTip(tr("Create Channel"));
	connect(newChannelButton, SIGNAL(clicked()), this, SLOT(createChannel()));
	ui.treeWidget->addToolButton(newChannelButton);

	ownChannels = ui.treeWidget->addCategoryItem(tr("My Channels"), QIcon(IMAGE_CHANNELBLUE), true);
	subcribedChannels = ui.treeWidget->addCategoryItem(tr("Subscribed Channels"), QIcon(IMAGE_CHANNELRED), true);
	popularChannels = ui.treeWidget->addCategoryItem(tr("Popular Channels"), QIcon(IMAGE_CHANNELGREEN), false);
	otherChannels = ui.treeWidget->addCategoryItem(tr("Other Channels"), QIcon(IMAGE_CHANNELYELLOW), false);

	ui.progressLabel->hide();
	ui.progressBar->hide();

	ui.nameLabel->setMinimumWidth(20);

	/* load settings */
	processSettings(true);

	/* Initialize empty GUI */
	requestGroupData(mChannelId);
}
示例#13
0
FxMixer::FxMixer() :
	Model( NULL ),
	JournallingObject(),
	m_fxChannels()
{
	// create master channel
	createChannel();
	m_lastSoloed = -1;
}
Channel::shared_pointer ChannelProviderLocal::createChannel(
    string const & channelName,
    ChannelRequester::shared_pointer  const &channelRequester,
    short priority,
    string const &address)
{
    if(!address.empty()) throw std::invalid_argument("address not allowed for local implementation");
    return createChannel(channelName, channelRequester, priority);
}
示例#15
0
// make sure we have at least num channels
void FxMixer::allocateChannelsTo(int num)
{
	while( num > m_fxChannels.size() - 1 )
	{
		createChannel();

		// delete the default send to master
		deleteChannelSend( m_fxChannels.size()-1, 0 );
	}
}
示例#16
0
void Caster::onEncrypted() {
    qInfo() << "Connected";
    platform_channel_ = createChannel(QStringLiteral("sender-0"),
                                      QStringLiteral("receiver-0"));
    platform_channel_->addInterface(HeartbeatInterface::URN);
    receiver_ = static_cast<ReceiverInterface*>(
        platform_channel_->addInterface(ReceiverInterface::URN));
    Q_EMIT receiverChanged();
    Q_EMIT connected();
}
示例#17
0
//doesn't currently handle when user is already in channel
void handle_JOIN(char** params, int socket){
  char *chanName = params[1];
  channel *chan;
  char *user;
  char *nick;
  struct ClientData *beingAdded;
  char msgbuf[515];
  int ifnew = 0;
  
  //search for user by socket
  //printf("searching for user\n");
  pthread_mutex_lock(&listLock);
  beingAdded = (struct ClientData *)list_seek(&clientList, &socket);
  printf("%s\n", beingAdded->nick);
  pthread_mutex_unlock(&listLock);
  user = beingAdded->user;
  nick = beingAdded->nick;
  
  //search for channel by name
  printf("searching for channel\n");
  chan = (channel *) findChannel(chanName);

  //if it doesn't exist, create the channel
  if(chan == NULL){
    chan = createChannel(chanName, 0, 0, "", socket);
    pthread_mutex_lock(&chanListLock);
    list_append(&channelList, chan);
    pthread_mutex_unlock(&chanListLock);
    ifnew = 1;
  }
  
  //add user to that channel
  printf("adding user to channel\n");
  //start by checking if user is already joined
  if(isUserInChannel(socket, chan) != -1){
    //printf("user is already in channel\n");
    return;
  } else {
    pairUserWithChannel(beingAdded, chan, ifnew, socket);
  }
  //send out the message
  printf("sending message\n");
  sprintf(msgbuf, ":%s!%s@hostname JOIN %s\r\n", nick, user, chanName); //needs user address
  sendMessage(msgbuf, socket);
  messageAllUsers(msgbuf, chan, socket);
  if((chan->topic)[0] != '\0'){
    sprintf(msgbuf, ":%s 332 %s %s :%s\r\n", host, nick, chanName, chan->topic);
    sendMessage(msgbuf, socket);
  }
  sprintf(msgbuf, ":%s!%s@hostname 353 %s = %s :nicknames eventually go here\r\n", nick, user, nick, chanName);
  sendMessage(msgbuf, socket);
  sprintf(msgbuf, ":%s!%s@hostname 366 %s %s :End of NAMES list\r\n", nick, user, nick, chanName);
  sendMessage(msgbuf, socket);
  return;
}
示例#18
0
SoundChannel& SoundDevice::activateSound(Sound& sound)
{
   if (getChannelsCount() == m_activeChannels.size())
   {
      ASSERT_MSG( false, "All sound channels are currently occupied" );
   }

   SoundChannel* channel = createChannel(sound, m_numBuffersUsed);
   m_activeChannels.push_back(channel);
   return *channel;
}
LLAudioChannel * LLAudioEngine::getFreeChannel(const F32 priority)
{
	S32 i;
	for (i = 0; i < mNumChannels; i++)
	{
		if (!mChannels[i])
		{
			// No channel allocated here, use it.
			mChannels[i] = createChannel();
			return mChannels[i];
		}
		else
		{
			// Channel is allocated but not playing right now, use it.
			if (!mChannels[i]->isPlaying() && !mChannels[i]->isWaiting())
			{
				LL_DEBUGS("AudioEngine") << "Replacing unused channel" << llendl;
				mChannels[i]->cleanup();
				if (mChannels[i]->getSource())
				{
					mChannels[i]->getSource()->setChannel(NULL);
				}
				return mChannels[i];
			}
		}
	}

	// All channels used, check priorities.
	// Find channel with lowest priority and see if we want to replace it.
	F32 min_priority = 10000.f;
	LLAudioChannel *min_channelp = NULL;

	for (i = 0; i < mNumChannels; i++)
	{
		LLAudioChannel *channelp = mChannels[i];
		LLAudioSource *sourcep = channelp->getSource();
		if (sourcep->getPriority() < min_priority)
		{
			min_channelp = channelp;
			min_priority = sourcep->getPriority();
		}
	}

	if (min_priority > priority || !min_channelp)
	{
		// All playing channels have higher priority, return.
		return NULL;
	}

	LL_DEBUGS("AudioEngine") << "Flushing min channel" << llendl;
	// Flush the minimum priority channel, and return it.
	min_channelp->cleanup();
	return min_channelp;
}
示例#20
0
int FlowData::createChannelVectorLength(FlowChannel* chX, FlowChannel* chY, FlowChannel* chZ)
{
    int result = createChannel();
    //check whether we deal with 2D or 3D vectors
	if (chZ)
        for (int i = 0; i < geometry.getDimX()*geometry.getDimY(); i++)
			//save the vector length
            channels[result]->setValue(i,sqrt(chX->getValue(i)*chX->getValue(i) + chY->getValue(i)*chY->getValue(i) + chZ->getValue(i)*chZ->getValue(i)));
    else
        for (int i = 0; i < geometry.getDimX()*geometry.getDimY(); i++)
            channels[result]->setValue(i,sqrt(chX->getValue(i)*chX->getValue(i) + chY->getValue(i)*chY->getValue(i)));
 
    return result;
}
示例#21
0
void LoggingConfigurator::configureChannels(AbstractConfiguration* pConfig)
{
    AbstractConfiguration::Keys channels;
    pConfig->keys(channels);
    for (AbstractConfiguration::Keys::const_iterator it = channels.begin(); it != channels.end(); ++it)
    {
        AutoPtr<AbstractConfiguration> pChannelConfig(pConfig->createView(*it));
        AutoPtr<Channel> pChannel = createChannel(pChannelConfig);
        LoggingRegistry::defaultRegistry().registerChannel(*it, pChannel);
    }
    for (AbstractConfiguration::Keys::const_iterator it = channels.begin(); it != channels.end(); ++it)
    {
        AutoPtr<AbstractConfiguration> pChannelConfig(pConfig->createView(*it));
        Channel* pChannel = LoggingRegistry::defaultRegistry().channelForName(*it);
        configureChannel(pChannel, pChannelConfig);
    }
}
// IOThread: this function creates a new TestListener object (on the new
// thread), opens a channel, and does AsyncRead to it.
void
TestListener::IOThread( void *p ) {
    printf( "I/O thread (0x%08X) started...\n", (int)(void*)PR_GetCurrentThread() );

    // Argument is pointer to the nsIEventQueue for the main thread.
    nsIEventQueue *mainThreadQ = static_cast<nsIEventQueue*>(p);

    // Create channel for random web page.
    nsCOMPtr<nsIChannel> channel = createChannel( (const char*)p );

    if ( channel ) {
        // Create event queue.
        nsCOMPtr<nsIEventQueue> ioEventQ = createEventQueue();

        if ( ioEventQ ) {
            // Create test listener.
            TestListener *testListener = new TestListener();
            testListener->AddRef();

            // Read the channel.
            printf( "Doing AsyncRead...\n" );
            nsresult rv = channel->AsyncRead( testListener, 0 );

            if ( NS_SUCCEEDED( rv ) ) {
                printf( "...AsyncRead completed OK\n" );

                // Process events till testListener says stop.
                printf( "Start event loop on io thread %d...\n", testListener->mThreadNo );
                while ( !testListener->mDone ) {
                    PLEvent *event;
                    ioEventQ->GetEvent( &event );
                    ioEventQ->HandleEvent( event );
                }
                printf( "...io thread %d event loop exiting\n", testListener->mThreadNo );
            } else {
                printf( "%s %d: AsyncRead failed on thread %d, rv=0x%08X\n",
                        (char*)__FILE__, (int)__LINE__, testListener->mThreadNo, (int)rv );
            }

            // Release the test listener.
            testListener->Release();
        }
    }

    printf( "...I/O thread terminating\n" );
}
示例#23
0
/** Constructor */
ChannelFeed::ChannelFeed(QWidget *parent)
: RsAutoUpdatePage(1000,parent)
{
    /* Invoke the Qt Designer generated object setup routine */
    setupUi(this);

    connect(newChannelButton, SIGNAL(clicked()), this, SLOT(createChannel()));
    connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
    connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));

    /*************** Setup Left Hand Side (List of Channels) ****************/

    connect(treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT( channelListCustomPopupMenu( QPoint ) ) );
    connect(treeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(selectChannel(QString)));

    mChannelId.clear();

    /* Set initial size the splitter */
    QList<int> sizes;
    sizes << 300 << width(); // Qt calculates the right sizes
    splitter->setSizes(sizes);

    /* Initialize group tree */
    treeWidget->initDisplayMenu(displayButton);

    ownChannels = treeWidget->addCategoryItem(tr("My Channels"), QIcon(IMAGE_CHANNELBLUE), true);
    subcribedChannels = treeWidget->addCategoryItem(tr("Subscribed Channels"), QIcon(IMAGE_CHANNELRED), true);
    popularChannels = treeWidget->addCategoryItem(tr("Popular Channels"), QIcon(IMAGE_CHANNELGREEN ), false);
    otherChannels = treeWidget->addCategoryItem(tr("Other Channels"), QIcon(IMAGE_CHANNELYELLOW), false);

    progressLabel->hide();
    progressBar->hide();

    fillThread = NULL;

    //added from ahead
    updateChannelList();
    
    nameLabel->setMinimumWidth(20);

    /* load settings */
    processSettings(true);

    updateChannelMsgs();
}
示例#24
0
ChannelList Chat::getChannelList(Player* player)
{
	ChannelList list;
	NormalChannelMap::iterator itn;
	PrivateChannelMap::iterator it;
	bool gotPrivate = false;
		
	// If has guild
	if(player->getGuildId() && player->getGuildName().length()){
		ChatChannel *channel = getChannel(player, 0x00);
		if(channel)
			list.push_back(channel);
		else if((channel = createChannel(player, 0x00)))
			list.push_back(channel);
	}
				
	for(itn = m_normalChannels.begin(); itn != m_normalChannels.end(); ++itn){
		if(itn->first == 0x03 && !player->hasFlag(PlayerFlag_CanAnswerRuleViolations)){ //Rule violations channel
		    continue;
        }
        
	    ChatChannel *channel = itn->second;
		list.push_back(channel);
	}
	
	for(it = m_privateChannels.begin(); it != m_privateChannels.end(); ++it){
		PrivateChatChannel* channel = it->second;
		
		if(channel){
			if(channel->isInvited(player))
				list.push_back(channel);
				
			if(channel->getOwner() == player->getGUID())
				gotPrivate = true;
		}
	}
	
	if(!gotPrivate)
		list.push_front(dummyPrivate);
	
	return list;
}
示例#25
0
void LoggingConfigurator::configureLogger(AbstractConfiguration* pConfig)
{
    Logger& logger = Logger::get(pConfig->getString("name", ""));
    AbstractConfiguration::Keys props;
    pConfig->keys(props);
    for (AbstractConfiguration::Keys::const_iterator it = props.begin(); it != props.end(); ++it)
    {
        if (*it == "channel" && pConfig->hasProperty("channel.class"))
        {
            AutoPtr<AbstractConfiguration> pChannelConfig(pConfig->createView(*it));
            AutoPtr<Channel> pChannel(createChannel(pChannelConfig));
            configureChannel(pChannel, pChannelConfig);
            Logger::setChannel(logger.name(), pChannel);
        }
        else if (*it != "name")
        {
            Logger::setProperty(logger.name(), *it, pConfig->getString(*it));
        }
    }
}
// Overloading () operator. The function takes in an EXPRESSION
//   as parameter and then calls the function associated with the
//   COMMAND specified by the EXPRESSION. The function returns
//   the output of calling those functions, which usually is an informative
//   message about the status of performing the specific action.
//   Expressions are strings, and need to be parsed in order to retrieve
//   the COMMAND to be excuted. Essentially a functor
std::string IRCCommandHandler::operator()(std::string exp) {
  expression = exp;

  parse();    //  Parsing function that gets the command from the EXPRESSION
  FILE_LOG(logDEBUG) << "Command = " << command;
  FILE_LOG(logDEBUG) << "Attempting to run COMMAND...";

  std::string result;
  // Calling functions associated with an EXPRESSION's COMMAND
  if      (command == "MSG")           result = message();
  else if (command == "CONNECT")       result = connect();
  else if (command == "CONNECT")       result = disconnect();
  else if (command == "CREATECHANNEL") result = createChannel();
  else if (command == "GETCHANNELS")   result = getChannels();
  else if (command == "JOINCHANNEL")   result = joinChannel();
  else if (command == "PING")          result = ping();
  else if (command == "CHANGENAME")    result = changeName();
  else result = "Invalid IRC Command '" + command + "'";

  return result;
}
示例#27
0
SettingDialog::SettingDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SettingDialog)
{
    ui->setupUi(this);
    connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(saveSettings()));
    connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancelSettings()));
    connect(ui->createChannelButton, SIGNAL(clicked()), this, SLOT(createChannel()));
    connect(ui->enterChannelButton, SIGNAL(clicked()), this, SLOT(enterChannel()));

    QSettings *settings = DanmakuEngineSingleton::Instance()->getSettings();
    if(settings->value("firstrun").toString()=="false"){
        ui->serverLineEdit->setText(settings->value("server").toString());
        ui->channelLineEdit->setText(settings->value("channel").toString());
        ui->passwordLineEdit->setText(settings->value("password").toString());
    }else
    {
        settings->setValue("firstrun","false");
        settings->sync();
    }
    this->raise();
}
示例#28
0
//****************************************************************************
//
//****************************************************************************
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
ChannelId MsgMgr::addCommNodeSenderToChannel(const char * _channelName, CommNode * _commNode)
{
    ASSERT(_commNode);

    ChannelId channelId = InvalidChannelId; 
    
    {
        NWAutoCritSec critSec(mCritSecAddRemoveCommNodes);
        
        channelId = findChannel(_channelName);

        if(channelId == InvalidChannelId)
        {
            MsgChannel * channel = createChannel(_channelName);
            channelId = channel->getChannelId();
        }

        addCommNodeSenderToChannel(channelId, _commNode);
    }

    return channelId;
}
示例#29
0
ChannelList Chat::getChannelList(Player* player)
{
	ChannelList list;
	if(!player || player->isRemoved())
		return list;

	ChatChannel* channel = NULL;
	if(player->getParty() && ((channel = getChannel(player, CHANNEL_PARTY)) || (channel = createChannel(player, CHANNEL_PARTY))))
		list.push_back(channel);

	if(player->getGuildId() && player->getGuildName().length() && ((channel = getChannel(
		player, CHANNEL_GUILD)) || (channel = createChannel(player, CHANNEL_GUILD))))
		list.push_back(channel);

	for(NormalChannelMap::iterator it = m_normalChannels.begin(); it != m_normalChannels.end(); ++it)
	{
		if((channel = getChannel(player, it->first)))
			list.push_back(it->second);
	}

	bool hasPrivate = false;
	PrivateChatChannel* privChannel = NULL;
	for(PrivateChannelMap::iterator pit = m_privateChannels.begin(); pit != m_privateChannels.end(); ++pit)
	{
		if(!(privChannel = pit->second))
			continue;

		if(privChannel->isInvited(player))
			list.push_back(privChannel);

		if(privChannel->getOwner() == player->getGUID())
			hasPrivate = true;
	}

	if(!hasPrivate && player->isPremium())
		list.push_front(dummyPrivate);

	return list;
}
示例#30
0
BOOST_FIXTURE_TEST_CASE(CreateMulticastFaceV6, UdpFactoryMcastFixture)
{
#ifdef __linux__
  // need superuser privileges to create multicast faces on Linux
  SKIP_IF_NOT_SUPERUSER();
#endif // __linux__
  SKIP_IF_UDP_MCAST_V6_NETIF_COUNT_LT(1);

  auto multicastFace1  = createMulticastFace("::1", "ff02::114", 20070);
  auto multicastFace1a = createMulticastFace("::1", "ff02::114", 20070);
  auto multicastFace2  = createMulticastFace("::1", "ff02::114", 20030);
  BOOST_CHECK_EQUAL(multicastFace1, multicastFace1a);
  BOOST_CHECK_NE(multicastFace1, multicastFace2);

  auto address = findNonLoopbackAddressForMulticastFace(ndn::net::AddressFamily::V6);
  if (!address.is_unspecified()) {
    auto multicastFace3  = createMulticastFace(address.to_string(), "ff02::114", 20070);
    BOOST_CHECK_NE(multicastFace1, multicastFace3);
    BOOST_CHECK_NE(multicastFace2, multicastFace3);
  }

  // create with a local endpoint already used by a channel
  auto channel = createChannel("::1", 20071);
  BOOST_CHECK_EXCEPTION(createMulticastFace("::1", "ff02::114", 20071), UdpFactory::Error,
                        [] (const UdpFactory::Error& e) {
                          return strcmp(e.what(),
                                        "Cannot create UDP multicast face on [::1]:20071, "
                                        "endpoint already allocated for a UDP channel") == 0;
                        });

  // create with a local endpoint already used by a multicast face on a different multicast group
  BOOST_CHECK_EXCEPTION(createMulticastFace("::1", "ff02::42", 20070), UdpFactory::Error,
                        [] (const UdpFactory::Error& e) {
                          return strcmp(e.what(),
                                        "Cannot create UDP multicast face on [::1]:20070, "
                                        "endpoint already allocated for a different UDP multicast face") == 0;
                        });
}