Exemple #1
0
void Channel::handleNumericMessage(IrcNumericMessage *message)
{
  switch (message->code()) {
    case Irc::RPL_NOTOPIC:
      setTopic(QString());
      break;

    case Irc::RPL_TOPIC:
      setTopic(message->parameters()[2]);
      break;

    case Irc::RPL_NAMREPLY:
      m_mutex.lock();
      m_newNicks << message->parameters()[3].split(" ");
      m_mutex.unlock();
      break;

    case Irc::RPL_ENDOFNAMES:
      m_mutex.lock();
      m_newNicks.sort();
      m_nickListModel->setNicks(m_newNicks);
      m_newNicks.clear();
      m_mutex.unlock();
      break;

    case Irc::RPL_TOPICWHOTIME:
      /* Ignore */
      break;

    default:
      emit numericMessageReceived(message);
      break;
  }
}
Exemple #2
0
void TopicWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
    QItemSelectionRange changedArea(topLeft, bottomRight);
    QModelIndex currentTopicIndex = selectionModel()->currentIndex().sibling(selectionModel()->currentIndex().row(), 1);
    if (changedArea.contains(currentTopicIndex))
        setTopic(selectionModel()->currentIndex());
};
void MainWindow::channelSettingsPressed(QString channel)
{
    if (channel.isEmpty())
        channel = ui->treeWidget->selectedChannel();
    if (!channelsettingsdialog)
    {
        channelsettingsdialog = new ChannelSettingsDialog(this);
        connect(irc, SIGNAL(sigBanList(QString,QString,QString,QString)), channelsettingsdialog,
                SLOT(bansReceived(QString,QString,QString,QString)));
        connect(irc, SIGNAL(sigChannelMode(QString,QStringList)), channelsettingsdialog,
                SLOT(channelModeReceived(QString,QStringList)));
        connect(channelsettingsdialog, SIGNAL(updatePressed(QString)), irc,
                SLOT(getBans(QString)));
        connect(channelsettingsdialog, SIGNAL(channelModeChanged(QString,QString)), irc,
                SLOT(setChannelMode(QString,QString)));
        connect(channelsettingsdialog, SIGNAL(topicChanged(QString,QString)), irc,
                SLOT(setTopic(QString,QString)));
    }
    channelsettingsdialog->clearItems();
    channelsettingsdialog->channel = channel;
    channelsettingsdialog->setWindowTitle(tr("%1 settings").arg(channel));
    channelsettingsdialog->setTopicText(getTopic(channelsettingsdialog->channel));
    channelsettingsdialog->show();
    irc->getBans(channelsettingsdialog->channel);
    irc->getChannelMode(channelsettingsdialog->channel);
}
void ChannelBufferItem::attachIrcChannel(IrcChannel *ircChannel)
{
    if (_ircChannel) {
        qWarning() << Q_FUNC_INFO << "IrcChannel already set; cleanup failed!?";
        disconnect(_ircChannel, 0, this, 0);
    }

    _ircChannel = ircChannel;

    connect(ircChannel, SIGNAL(destroyed(QObject*)),
        this, SLOT(ircChannelDestroyed()));
    connect(ircChannel, SIGNAL(topicSet(QString)),
        this, SLOT(setTopic(QString)));
    connect(ircChannel, SIGNAL(encryptedSet(bool)),
        this, SLOT(setEncrypted(bool)));
    connect(ircChannel, SIGNAL(ircUsersJoined(QList<IrcUser *> )),
        this, SLOT(join(QList<IrcUser *> )));
    connect(ircChannel, SIGNAL(ircUserParted(IrcUser *)),
        this, SLOT(part(IrcUser *)));
    connect(ircChannel, SIGNAL(parted()),
        this, SLOT(ircChannelParted()));
    connect(ircChannel, SIGNAL(ircUserModesSet(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));
    connect(ircChannel, SIGNAL(ircUserModeAdded(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));
    connect(ircChannel, SIGNAL(ircUserModeRemoved(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));

    if (!ircChannel->ircUsers().isEmpty())
        join(ircChannel->ircUsers());

    emit dataChanged();
}
Exemple #5
0
void ChannelBufferItem::attachIrcChannel(IrcChannel *ircChannel)
{
    Q_ASSERT(!_ircChannel && ircChannel);

    _ircChannel = ircChannel;

    connect(ircChannel, SIGNAL(topicSet(QString)),
        this, SLOT(setTopic(QString)));
    connect(ircChannel, SIGNAL(encryptedSet(bool)),
        this, SLOT(setEncrypted(bool)));
    connect(ircChannel, SIGNAL(ircUsersJoined(QList<IrcUser *> )),
        this, SLOT(join(QList<IrcUser *> )));
    connect(ircChannel, SIGNAL(ircUserParted(IrcUser *)),
        this, SLOT(part(IrcUser *)));
    connect(ircChannel, SIGNAL(parted()),
        this, SLOT(ircChannelParted()));
    connect(ircChannel, SIGNAL(ircUserModesSet(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));
    connect(ircChannel, SIGNAL(ircUserModeAdded(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));
    connect(ircChannel, SIGNAL(ircUserModeRemoved(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));

    if (!ircChannel->ircUsers().isEmpty())
        join(ircChannel->ircUsers());

    emit dataChanged();
}
void RosoutPanel::onSetup(wxCommandEvent& evt)
{
  RosoutSetupDialog dialog(this, topic_, max_messages_);

  if (dialog.ShowModal() == wxOK)
  {
    setTopic(dialog.getTopic());
    setBufferSize(dialog.getBufferSize());
  }
}
Exemple #7
0
void CoreIrcChannel::setEncrypted(bool e)
{
    if (!Cipher::neededFeaturesAvailable())
        return;

    if (e) {
        if (topic().isEmpty())
            return;

        QByteArray decrypted = cipher()->decryptTopic(topic().toAscii());
        setTopic(decodeString(decrypted));
    }
}
RosoutPanel::RosoutPanel(wxWindow* parent, int id, wxPoint pos, wxSize size, int style)
: RosoutPanelBase(parent, id, pos, size, style)
, enabled_(false)
, message_id_counter_(0)
, max_messages_(20000)
, needs_refilter_(false)
, refilter_timer_(0.0f)
, pause_(false)
, logger_level_frame_(0)
{
  wxInitAllImageHandlers();

  nh_.setCallbackQueue(&callback_queue_);

  process_timer_ = new wxTimer(this);
  process_timer_->Start(250);

  Connect(process_timer_->GetId(), wxEVT_TIMER, wxTimerEventHandler(RosoutPanel::onProcessTimer), NULL, this);

  table_->setModel(this);

  setTopic("/rosout_agg");
  setEnabled(true);

  std::string icon_path = ros::package::getPath(ROS_PACKAGE_NAME) + "/icons/";
  delete_filter_bitmap_ = wxBitmap(wxString::FromAscii((icon_path + "delete-filter-16.png").c_str()), wxBITMAP_TYPE_PNG);

  wxBitmap add_bitmap(wxString::FromAscii((icon_path + "add-16.png").c_str()), wxBITMAP_TYPE_PNG);
  add_filter_button_->SetBitmapLabel(add_bitmap);

  add_filter_button_->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(RosoutPanel::onAddFilterPressed), NULL, this);

  {
    RosoutSeverityFilterPtr filter(new RosoutSeverityFilter);
    RosoutSeverityFilterControl* control = new RosoutSeverityFilterControl(this, filter);
    severity_filter_ = filter;
    severity_sizer_->Add(control, 0, wxEXPAND);
    severity_filter_->getChangedSignal().connect(boost::bind(&RosoutPanel::onFilterChanged, this, _1));
  }

  createTextFilter();

  filters_window_->SetMinSize(wxSize(-1, filters_[0].panel->GetSize().GetHeight() + add_filter_button_->GetSize().GetHeight() + 5));
}
void CoreIrcChannel::setEncrypted(bool e) {
  if(!Cipher::neededFeaturesAvailable())
    return;

  if(e) {
    if(topic().isEmpty())
      return;

    QByteArray key = qobject_cast<CoreNetwork *>(network())->cipherKey(name());
    if(key.isEmpty())
      return;

    if(!cipher()->setKey(key))
      return;

    QByteArray decrypted = cipher()->decryptTopic(topic().toAscii());
    setTopic(decodeString(decrypted));
  }
}
GridCellsDisplay::GridCellsDisplay( const std::string& name, Ogre::SceneManager* sceneMgr, FrameTransformer* frameMgr, ros::CallbackQueueInterface* updateQueue, ros::CallbackQueueInterface* threadQueue )
: Display( name, sceneMgr, frameMgr, updateQueue, threadQueue )
, color( 0.1f, 1.0f, 0.0f, 1.0f )
, tf_filter_(*frameMgr->getTFClient(), "", 10, update_nh_)
, messages_received_(0)
{
  scene_node_ = sceneMgr->getRootSceneNode()->createChildSceneNode();

  static int count = 0;
  std::stringstream ss;
  ss << "PolyLine" << count++;

  cloud_ = new ogre_tools::PointCloud();
  cloud_->setRenderMode( ogre_tools::PointCloud::RM_BILLBOARDS_COMMON_FACING );
  cloud_->setCommonDirection( Ogre::Vector3::UNIT_Y );
  cloud_->setCommonUpVector( Ogre::Vector3::NEGATIVE_UNIT_Z );
  scene_node_->attachObject(cloud_);

  setTopic(ROS_TOPIC);

  tf_filter_.connectInput(sub_);
  tf_filter_.registerCallback(boost::bind(&GridCellsDisplay::incomingMessage, this, _1));
  frameMgr->registerFilterForTransformStatusCheck(tf_filter_, this);
}
void PlanningDisplay::initialize( const std::string& description_param, const std::string& kinematic_path_topic )
{
  setRobotDescription( description_param );
  setTopic( kinematic_path_topic );
}
Exemple #12
0
inline void
irccon::parse (const string & what)
{
	//m_parser.enterMutex();
	ircargs ia (htmlspecialchars(what));
	/*
	  Insertme:
	  if (ia.command() == "NICK") {
	    yace->irc().insertUser(ia.arg(0), ia(arg4));
	    replace(yace->sql().getString("enters"),"%CNAME%",ia.arg(0));
	    return;
	  }
	*/
	if (ia.command () == "PRIVMSG")
	{
		  commandargs ca(ia.rest());
	  if (ia.arg(0) == "YaCEServ") {
		  if (ia.prefix() == "NickServ") {
			  yace->sql().insertRegistry(ca.arg(0),ca.arg(1),ca.arg(2));
		   	  //m_parser.leaveMutex();
			  return;
			}

			// YaCEServ needs OperServ access for some Features
			commandargs ca(ia.rest());
			typedef hash_map<string, commandfunc> commandmap;
			string command;
			commandargs argz("");
			commandfunc f;
			commandmap cmds;
      register_commands(cmds);
			
			bool iscmd = false;
			if (ca.arg(0) == "help") {
			  cout << "HELP REQUEST!" << endl;
			  iscmd = false;
			  yace->irc().send(":YaCEServ PRIVMSG " + ia.prefix() + ": YaCEServ Help:");
				yace->irc().send(":YaCEServ PRIVMSG " + ia.prefix() + ": Pic <url>: Inserts picture");
				yace->irc().send(":YaCEServ PRIVMSG " + ia.prefix() + ": YaCEServ Sound <url>: Inserts Sound");
			  yace->irc().send(":YaCEServ PRIVMSG " + ia.prefix() + ": YaCEServ Vipmsg <text>: Vipmsg with <text>");
			  yace->irc().send(":YaCEServ PRIVMSG " + ia.prefix() + ": YaCEServ Amsg <text>: Admin msg with <text>");
			}
			else if (ca.arg(0) == "Pic") {
			  iscmd = true;
				command = "p";
				argz = ca.rest(0);
			}
			if (iscmd) {
			  f = cmds[command];
			  f(ia.prefix(),argz);
			}
		}

	  user* u = yace->users().getUser(ia.prefix());
		u->incrProp("said");
		u->isetProp("silence",0);

		if (ia.arg (0)[0] == '#')
		{
			if (ia.rest ()[0] == (char) 1)
			{
				string s_me = ia.rest ().substr (0, ia.rest ().length () - 2);
				s_me = s_me.substr (s_me.find (" "), s_me.length () - s_me.find ("N"));
				i2y_me (ia.prefix (), s_me, ia.arg(0));
			    //m_parser.leaveMutex();
				return;
				} else {
				i2y_say (ia.prefix (), ia.rest (), ia.arg (0));
		        //m_parser.leaveMutex();
				return; 
				}
			} else {
			i2y_whisper (ia.prefix (), ia.rest (), ia.arg (0));
		//m_parser.leaveMutex();
		return;
		}
	} else	if (ia.command() == "PING")
	{
		string pong = "PONG " + name + " " + ia.arg (0);
		yace->irc ().send (pong);
		//m_parser.leaveMutex();
		return;
	}
	else if (ia.command() == "TOPIC") 
	{
	  string msg = yace->sql().getString("settopic");
		msg = replaceCommon(msg);
		msg = replaceUser(ia.prefix(), msg);
		msg = replace(msg, "%TEXT%", ia.rest().substr(0, ia.rest().length()-1));
		sendRoomU(ia.prefix(),msg);
	  setTopic(getRoom(ia.arg(0)),ia.rest());
	  //m_parser.leaveMutex();
		return;
	}
  else if (ia.command() == "NICK")
	{
	  if (ia.prefix() != "") {
			string tosend;
			tosend = yace->sql().getString("nick");
			tosend = replaceCommon(tosend);
			tosend = replace(tosend, "%NICK%", ia.arg(0));
			tosend = replaceUser(ia.prefix(), tosend);
			yace->users().getUser(ia.prefix())->ssetProp("nick", ia.arg(0));
			sendRoomU(ia.prefix(), tosend);
			//m_parser.leaveMutex();
		  return;																			
		}
	  string nick = ia.arg(0);
		string host = ia.arg(4);
		bool hasreg = false;
		if (yace->users().existsUser(nick)) {
		  //m_parser.leaveMutex();
			return;
		}
		
		hasreg = yace->sql().isReg(nick);

		//if (hasreg) {
		  // We need NickServ-Plugins for identify
		  // yace->irc().send(":yace.filbboard.de KILL " + nick + " :Registered. If its your nick, please reconnect and identify");
		  //return;
		//}

		if(nick.length() >= 5) {
		  if (nick.substr(nick.length()-4,4) == "Serv" || nick == "DevNull" || nick == "Global" || nick == "BrotSheep") {
		    //m_parser.leaveMutex();
			  return;
		  }
	   }
		
	  user* irchehe = new user(ia.arg(0),ia.arg(4));
	  user* hehe = irchehe;
		irchehe->IncRef();
		yace->users().insertUser(irchehe);
		 yace->rooms().joinRoom(irchehe->getName(), "TEMP-ROOM"); // this is untill we got a JOIN
	   //TOLLE SACHEN
		string regstrings = yace->sql().getConfStr("regstrings");
    string regnums = yace->sql().getConfStr("regnums");

    {
      if(hasreg)
	yace->sql().updateTime(hehe->getName());

      commandargs str(regstrings);
      
      string act;
      string actval;
      for(int i = 0; (act = str.arg(i)) != ""; ++i) {
	
	unsigned long pos = act.find("=");
	if(pos != string::npos) {
	  actval = act.substr(pos + 1);
	  act = act.substr(0, pos);
	}
	else {
	  actval = "";
	}

	if(hasreg)
	  hehe->ssetProp(act, yace->sql().getRegStr(nick, act));
	else
	  hehe->ssetProp(act, actval);
      }

      commandargs num(regnums);

      for(int i = 0; (act = num.arg(i)) != ""; ++i) {
	unsigned long pos = act.find("=");
	if(pos != string::npos) {
	  actval = act.substr(pos + 1);
	  act = act.substr(0, pos);
	}
	else {
	  actval = "";
	}

	long actnumval;
	istringstream is(actval);
	is >> actnumval;
	
	if(hasreg)
	  hehe->isetProp(act, yace->sql().getRegNum(nick, act));
	else
	  hehe->isetProp(act, actnumval);
      }
    }
    // END TOLLE SACHEN
		enters(irchehe);
    	yace->rooms().leaves(irchehe->getName(), true, "TEMP-ROOM");

	    irchehe->DecRef();
	    //m_parser.leaveMutex();
	    return;
	}
  else if (ia.command() == "JOIN") {
Exemple #13
0
void Skype::getTopic(const QString &chat) {
	kdDebug(14311) << k_funcinfo <<  endl;//some debug info

	emit setTopic(chat, (d->connection % QString("GET CHAT %1 FRIENDLYNAME").arg(chat)).section(' ', 3).stripWhiteSpace());
}
Exemple #14
0
void TopicWidget::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{
    Q_UNUSED(previous);
    setTopic(current);
}
Exemple #15
0
void Channel::handleTopicMessage(IrcTopicMessage *message)
{
  setTopic(message->topic());
}
NewGameConfirmDlg::NewGameConfirmDlg(std::string title, std::string topic)
{
	setTitle(title);
	setTopic(topic);
}
JNIEXPORT jobject JNICALL
Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesGet
  (JNIEnv *env, jobject obj, jlong j_appDomain_handle)
{
  // jni types
  jclass         cls_sp   = NULL; // SubsProp class
  jclass         cls_ntpT = NULL; // NtpTime class
  jobject        obj_sp   = NULL; // instance of SubsProp
  jobject        obj_ntpT = NULL; // instance of NtpTime
  jfieldID       fid      = NULL;
  jmethodID      mid;
  //
  int            b = 0;
  int            flag_ok = 0;
  ORTESubsProp   sp;
  ORTESubsProp  *subs_prop = &sp;

  #ifdef TEST_STAGE
  printf(":c: ORTESubscriptionPropertiesGet() called.. \n");
  #endif

  // create new SubsProps instance and set its fields
  do {
    // calling ORTE function
    b = ORTESubscriptionPropertiesGet((ORTESubscription *)j_appDomain_handle,
				      subs_prop);
    if (b == ORTE_BAD_HANDLE) {
      printf(":!c: subscription get properties failed!  [bad sub handle] \n");
      break;
    }
    // get cls
    cls_sp = findClass(env, "org.ocera.orte.types.SubsProp");
    if (cls_sp == 0) {
      #ifdef TEST_STAGE
      printf(":!c: cls_sp = NULL \n");
      #endif
      break;
    }
    // call object constructor
    mid = (*env)->GetMethodID(env, cls_sp, "<init>", "()V");
    if (mid == 0) {
    #ifdef TEST_STAGE
      printf(":!c: mid = NULL \n");
      #endif
      break;
    }
    // new object
    obj_sp = (*env)->NewObject(env, cls_sp, mid);
    if (obj_sp == 0) {
    #ifdef TEST_STAGE
      printf(":!c: obj_sp = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.SubsProp' created..\n");
    #endif
    // ///////////////////////////////////////////////
    // setting object's fields
    /////////////////////////////////////////////////
    // set topic
    if (!setTopic(env, cls_sp, obj_sp, (const char *)subs_prop->topic)) {
      #ifdef TEST_STAGE
      printf(":!c: setTopic() failed! \n");
      #endif
      break;
    }
    /////////////////////////////////////////////////
    // set type
    if (!setType(env, cls_sp, obj_sp, (const char *)subs_prop->typeName)) {
      #ifdef TEST_STAGE
      printf(":!c: setType() failed! \n");
      #endif
      break;
    }
    /////////////////////////////////////////////////
    // fieldID - typeChecksum
    fid = (*env)->GetFieldID(env,
			     cls_sp,
			     "typeChecksum",
			     "I");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetIntField(env,
			obj_sp,
			fid,
			(jint)subs_prop->typeChecksum);
    /////////////////////////////////////////////////
    // fieldID - minSeparation
    cls_ntpT = findClass(env, "org.ocera.orte.types.NtpTime");
    if (cls_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: cls_ntpT = NULL \n");
      #endif
      break;
    }
    // call object constructor
    mid = (*env)->GetMethodID(env, cls_ntpT, "<init>", "(IJ)V");
    if (mid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: mid = NULL \n");
      #endif
      break;
    }
    // new object
    obj_ntpT = (*env)->NewObject(env,
				 cls_ntpT,
				 mid,
				 (jint)subs_prop->minimumSeparation.seconds,
				 (jlong)subs_prop->minimumSeparation.fraction);
    if (obj_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_ntpT = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
    #endif
    // set 'SubsProp' NtpTime's field
    fid = (*env)->GetFieldID(env,
			     cls_sp,
			     "minSeparation",
			     "Lorg/ocera/orte/types/NtpTime;");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetObjectField(env,
			   obj_sp,
			   fid,
			   obj_ntpT);
    /////////////////////////////////////////////////
    // fieldID - deadline
    // pointers cls_ntpT, obj_ntpT already set
    // new object
    obj_ntpT = (*env)->NewObject(env,
				 cls_ntpT,
				 mid,
				 (jint)subs_prop->deadline.seconds,
				 (jlong)subs_prop->deadline.fraction);
    if (obj_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_ntpT = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
    #endif
    // set 'SubsProp' NtpTime's field
    fid = (*env)->GetFieldID(env,
			     cls_sp,
			     "deadline",
			     "Lorg/ocera/orte/types/NtpTime;");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetObjectField(env,
			   obj_sp,
			   fid,
			   obj_ntpT);
    /////////////////////////////////////////////////
    // fieldID - recvQueueSize
    fid = (*env)->GetFieldID(env,
			     cls_sp,
			     "recvQueueSize",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_sp,
			 fid,
			 (jlong)subs_prop->recvQueueSize);
    /////////////////////////////////////////////////
    // fieldID - reliabilityRequested
    fid = (*env)->GetFieldID(env,
			     cls_sp,
			     "reliabilityRequested",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_sp,
			 fid,
			 (jlong)subs_prop->reliabilityRequested);
    /////////////////////////////////////////////////
    // fieldID - mode
    fid = (*env)->GetFieldID(env,
			     cls_sp,
			     "mode",
			     "I");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetIntField(env,
			obj_sp,
			fid,
			(jint)subs_prop->mode);
    /////////////////////////////////////////////////
    // fieldID - multicastIPAddr
    fid = (*env)->GetFieldID(env,
			     cls_sp,
			     "multicastIPAddr",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_sp,
			 fid,
			 (jlong)subs_prop->multicast);
    // set flag
    flag_ok = 1;

  } while (0);

  // return created object
  if (flag_ok == 0) {
    return NULL;
  }

  return obj_sp;

}
Exemple #18
0
GoalTool::GoalTool( const std::string& name, char shortcut_key, VisualizationManager* manager )
: PoseTool( name, shortcut_key, manager )
{
  setTopic("goal");
}
Exemple #19
0
// Read the topic name from the QLineEdit and call setTopic() with the
// results.  This is connected to QLineEdit::editingFinished() which
// fires when the user presses Enter or Tab or otherwise moves focus
// away.
void TeleopPanel::updateTopic()
{
  setTopic( output_topic_editor_->text() );
}
Exemple #20
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    for (int i = 0; i < 6 ;i++)
    {
        levels.append(0);
    }
    ui->setupUi(this);
    settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "enkidu", "battalbot");
    ui->le_server->setText(settings->value("server", "").toString());
    ui->le_channel->setText(settings->value("channel", "").toString());
    ui->le_botname->setText(settings->value("botname", "").toString());
    QHash<QString, QVariant> tmp;
    auths = settings->value("auths", tmp).toHash();
    onFinish = false;
    added = 0;
    QLocale::setDefault(QLocale::English);
    trayIcon = new QSystemTrayIcon();
    QMenu *menu = new QMenu();
    QAction *actionQuit = new QAction("Quit", trayIcon);
    menu->addAction(actionQuit);
    trayIcon->setContextMenu(menu);
    trayIcon->setIcon(QIcon(":/icon.png"));
    trayIcon->show();
    this->setWindowIcon(QIcon(":/icon.png"));
    this->setWindowTitle("eRepublik wall-watching BOT");
    connect(ui->pb_connect, SIGNAL(clicked()), this, SLOT(connectToServer()));
    irc = new Irc(this);
    reader = new Reader;
    battle = new Battle;
    refreshTree();
    connect(battle, SIGNAL(getWall()), reader, SLOT(read()));
    connect(ui->pb_StartCount, SIGNAL(clicked()), this, SLOT(getInfo()));
    connect(reader, SIGNAL(startCounting(int,QTime)), battle, SLOT(startCounting(int, QTime)));
    connect(reader, SIGNAL(startCounting(int,QTime)), this, SLOT(setInitialWall(int,QTime)));
    connect(battle, SIGNAL(setTimeT(QTime)), this, SLOT(setTimeElapsed(QTime)));
    connect(reader, SIGNAL(wall(int,bool)), battle, SLOT(actWall(int,bool)));
    connect(reader, SIGNAL(wall(int,bool)), this, SLOT(setWall(int,bool)));
    connect(battle, SIGNAL(setText(QString)), irc, SLOT(write(QString)));
    connect(reader, SIGNAL(battleInfo(QString)), irc, SLOT(setTopic(QString)));

    connect(trayIcon,
            SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this,
            SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));

    connect(irc, SIGNAL(authRequest(QString,QString,QString)),
            this, SLOT(auth(QString,QString,QString)));

    connect(irc, SIGNAL(wallRequest(QString,QString)),
            this, SLOT(wall(QString,QString)));

    connect(irc, SIGNAL(playerRequest(QString)),
            reader, SLOT(getPlayer(QString)));

    connect(reader, SIGNAL(playerInfo(QString)),
            irc, SLOT(write(QString)));

    connect(ui->pb_authAdd, SIGNAL(clicked()),
            this, SLOT(addAuth()));

    connect(ui->pb_delAuth, SIGNAL(clicked()),
            this, SLOT(delAuth()));

    connect(actionQuit, SIGNAL(triggered()), this, SLOT(appQuit()));
    curve = new QwtPlotCurve();
    curve->setRenderHint(QwtPlotItem::RenderAntialiased);
    curve->attach(ui->qwtPlot);
    for (int i = 0; i < 6; i++)
    {
        QwtPlotCurve *line = new QwtPlotCurve();
        if (i == 0 || i == 5)
        {
            line->setPen(QPen(QColor(0,0,255)));
        }
        else
        {
            line->setPen(QPen(QColor(0,200,0)));
        }
        line->attach(ui->qwtPlot);
        lines.append(line);
    }
}
JNIEXPORT jobject JNICALL
Java_org_ocera_orte_Publication_jORTEPublicationPropertiesGet
  (JNIEnv *env, jobject obj, jlong j_appDomain_handle)
{
  // jni types
  jclass         cls_pp   = NULL; // PublProp class
  jclass         cls_ntpT = NULL; // NtpTime class
  jobject        obj_pp   = NULL; // instance of PublProp
  jobject        obj_ntpT = NULL; // instance of NtpTime
  jfieldID       fid      = NULL;
  jmethodID      mid;
  jboolean       jbool = 0;
  //
  int            b = 0;
  int            flag_ok = 0;
  ORTEPublProp   pp;
  ORTEPublProp  *publ_prop = &pp;

  // calling original orte function
  #ifdef TEST_STAGE
  printf(":c: ORTEPublicationPropertiesGet() called.. \n");
  #endif

  // create new PublProps instance and set its fields
  do {
    // call ORTE function
    b = ORTEPublicationPropertiesGet((ORTEPublication *)j_appDomain_handle,
				     publ_prop);
    if (b == ORTE_BAD_HANDLE) {
      printf(":!c: PublicationPropertiesGet() failed! [bad pub handle] \n");
      break;
    }
    // find class
    cls_pp = findClass(env, "org.ocera.orte.types.PublProp");
    if (cls_pp == 0) {
      #ifdef TEST_STAGE
      printf(":!c: cls_pp = NULL \n");
      #endif
      break;
    }
    // call object constructor
    mid = (*env)->GetMethodID(env, cls_pp, "<init>", "()V");
    if (mid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: mid = NULL \n");
      #endif
      break;
    }
    // new object
    obj_pp = (*env)->NewObject(env, cls_pp, mid);
    if (obj_pp == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_pp = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.PublProp' created..\n");
    #endif
    // ///////////////////////////////////////////////
    // setting object's fields
    /////////////////////////////////////////////////
    // set topic
    if (!setTopic(env, cls_pp, obj_pp, (const char *)publ_prop->topic)) {
      #ifdef TEST_STAGE
      printf(":!c: setTopic() failed! \n");
      #endif
      break;
    }
    /////////////////////////////////////////////////
    // set type
    if (!setType(env, cls_pp, obj_pp, (const char *)publ_prop->typeName)) {
      #ifdef TEST_STAGE
      printf(":!c: setType() failed! \n");
      #endif
      break;
    }
    /////////////////////////////////////////////////
    // fieldID - typeChecksum
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "typeChecksum",
			     "I");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetIntField(env,
			obj_pp,
			fid,
			(jint)publ_prop->typeChecksum);
    /////////////////////////////////////////////////
    // fieldID - expectsAck
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "expectsAck",
			     "Z");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    if (publ_prop->expectsAck == ORTE_FALSE)
      jbool = 0;
    else
      jbool = 1;
    (*env)->SetBooleanField(env,
			    obj_pp,
			    fid,
			    jbool);
    /////////////////////////////////////////////////
    // fieldID - persistence
    cls_ntpT = findClass(env, "org.ocera.orte.types.NtpTime");
    if (cls_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: cls_ntpT = NULL \n");
      #endif
      break;
    }
    // call object constructor
    mid = (*env)->GetMethodID(env, cls_ntpT, "<init>", "(IJ)V");
    if (mid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: mid = NULL \n");
      #endif
      break;
    }
    // new object
    obj_ntpT = (*env)->NewObject(env,
				 cls_ntpT,
				 mid,
				 (jint)publ_prop->persistence.seconds,
				 (jlong)publ_prop->persistence.fraction);
    if (obj_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_ntpT = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
    #endif
    // set 'PublProp' NtpTime's field
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "persistence",
			     "Lorg/ocera/orte/types/NtpTime;");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetObjectField(env,
			   obj_pp,
			   fid,
			   obj_ntpT);
    /////////////////////////////////////////////////
    // fieldID - HBNornalRate
    // cls_ntpT and obj_ntpT already readed!!
    // new object
    obj_ntpT = (*env)->NewObject(env,
				 cls_ntpT,
				 mid,
				 (jint)publ_prop->HBNornalRate.seconds,
				 (jlong)publ_prop->HBNornalRate.fraction);
    if (obj_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_ntpT = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
    #endif
    // set 'PublProp' NtpTime's field
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "HBNornalRate",
			     "Lorg/ocera/orte/types/NtpTime;");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetObjectField(env,
			   obj_pp,
			   fid,
			   obj_ntpT);
    /////////////////////////////////////////////////
    // fieldID - HBCQLRate
    // cls_ntpT and obj_ntpT already readed!!
    // new object
    obj_ntpT = (*env)->NewObject(env,
				 cls_ntpT,
				 mid,
				 (jint)publ_prop->HBCQLRate.seconds,
				 (jlong)publ_prop->HBCQLRate.fraction);
    if (obj_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_ntpT = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
    #endif
    // set 'PublProp' NtpTime's field
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "HBCQLRate",
			     "Lorg/ocera/orte/types/NtpTime;");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetObjectField(env,
			   obj_pp,
			   fid,
			   obj_ntpT);
    /////////////////////////////////////////////////
    // fieldID - HBCQLRate
    // cls_ntpT and obj_ntpT already readed!!
    // new object
    obj_ntpT = (*env)->NewObject(env,
				 cls_ntpT,
				 mid,
				 (jint)publ_prop->maxBlockTime.seconds,
				 (jlong)publ_prop->maxBlockTime.fraction);
    if (obj_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_ntpT = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
    #endif
    // set 'PublProp' NtpTime's field
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "maxBlockTime",
			     "Lorg/ocera/orte/types/NtpTime;");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetObjectField(env,
			   obj_pp,
			   fid,
			   obj_ntpT);
    /////////////////////////////////////////////////
    // fieldID - reliabilityOffered
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "reliabilityOffered",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_pp,
			 fid,
			 (jlong)publ_prop->reliabilityOffered);
    /////////////////////////////////////////////////
    // fieldID - sendQueueSize
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "sendQueueSize",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_pp,
			 fid,
			 (jlong)publ_prop->sendQueueSize);
    /////////////////////////////////////////////////
    // fieldID - strength
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "strength",
			     "I");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetIntField(env,
			obj_pp,
			fid,
			(jint)publ_prop->strength);
    /////////////////////////////////////////////////
    // fieldID - criticalQueueLevel
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "criticalQueueLevel",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_pp,
			 fid,
			 (jlong)publ_prop->criticalQueueLevel);
    /////////////////////////////////////////////////
    // fieldID - HBMaxRetries
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "HBMaxRetries",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_pp,
			 fid,
			 (jlong)publ_prop->HBMaxRetries);
    // set flag
    flag_ok = 1;
  } while (0);

  if (flag_ok == 0) {
    return NULL;
  }

  return obj_pp;

}
Exemple #22
0
jobject
createPubInfo(JNIEnv *env, const ORTEPubInfo *pinfo)
{
  jclass    cls;
  jobject   obj;
  jmethodID mid;
  //
  int flag_ok = 0;

  do {
    // find cls
    cls = findClass(env, "org.ocera.orte.types.PubInfo");
    if (cls == 0) {
      #ifdef TEST_STAGE
      printf(":!c: cls = NULL \n");
      #endif
      break;
    }
    // call object constructor
    mid = (*env)->GetMethodID(env, cls, "<init>", "()V");
    if (mid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: constructor failed! \n");
      #endif
      break;
    }
    // create new object
    obj = (*env)->NewObject(env, cls, mid);
    if (obj == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj = NULL \n");
      #endif
      break;
    }
/////////////////////////////////////////////////
    // set topic
    if (!setTopic(env, cls, obj, pinfo->topic)) {
      #ifdef TEST_STAGE
      printf(":!c: seTopic() failed! \n");
      #endif
      break;
    }
    // set type
    if (!setType(env, cls, obj, pinfo->type)) {
      #ifdef TEST_STAGE
      printf(":!c: seType() failed! \n");
      #endif
      break;
    }
/////////////////////////////////////////////////

    flag_ok = 1;
  } while (0);

  if (!flag_ok) {
    //detach...()
    return NULL;
  }

  return obj;
}