kafka_writer(std::string brokers, std::string topicA) {
     conf = RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL);
     tconf = RdKafka::Conf::create(RdKafka::Conf::CONF_TOPIC);
     set_brokers(brokers);
     create_producer();
     set_topic(topicA);
 }
Exemple #2
0
void
inbound_topic (server * serv, char *chan, char *topic_text)
{
    session *sess = find_channel (serv, chan);

    if (sess)
    {
        if (!prefs.topic_color)
            set_topic(sess, topic_text, strip_color(topic_text, -1, STRIP_ALL));
        else
            set_topic(sess, topic_text, topic_text);
    }
    else
        sess = serv->server_session;

    EMIT_SIGNAL (XP_TE_TOPIC, sess, chan, topic_text, NULL, NULL, 0);
}
Exemple #3
0
/**************************************************************************
  Creates a new help widget displaying the specified topic.
**************************************************************************/
help_widget::help_widget(const help_item *topic, QWidget *parent) :
  QWidget(parent),
  main_widget(NULL), text_browser(NULL), bottom_panel(NULL),
  info_panel(NULL), splitter(NULL), info_layout(NULL)
{
  setup_ui();
  set_topic(topic);
}
Exemple #4
0
void
inbound_privmsg (server *serv, char *from, char *ip, char *text, int id,
					  const message_tags_data *tags_data)
{
	session *sess;
	struct User *user;
	char idtext[64];
	gboolean nodiag = FALSE;

	sess = find_dialog (serv, from);

	if (sess || prefs.hex_gui_autoopen_dialog)
	{
		/*0=ctcp  1=priv will set hex_gui_autoopen_dialog=0 here is flud detected */
		if (!sess)
		{
			if (flood_check (from, ip, serv, current_sess, 1))
				/* Create a dialog session */
				sess = inbound_open_dialog (serv, from, tags_data);
			else
				sess = serv->server_session;
			if (!sess)
				return; /* ?? */
		}

		if (ip && ip[0])
			set_topic (sess, ip, ip);
		inbound_chanmsg (serv, NULL, NULL, from, text, FALSE, id, tags_data);
		return;
	}

	sess = find_session_from_nick (from, serv);
	if (!sess)
	{
		sess = serv->front_session;
		nodiag = TRUE; /* We don't want it to look like a normal message in front sess */
	}

	user = userlist_find (sess, from);
	if (user)
	{
		user->lasttalk = time (0);
		if (user->account)
			id = TRUE;
	}
	
	inbound_make_idtext (serv, idtext, sizeof (idtext), id);

	if (sess->type == SESS_DIALOG && !nodiag)
		EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0,
									  tags_data->timestamp);
	else
		EMIT_SIGNAL_TIMESTAMP (XP_TE_PRIVMSG, sess, from, text, idtext, NULL, 0, 
									  tags_data->timestamp);
}
void GscHelpWindow::on_tree_selection_changed()
{
	if (!this->selection_callback_enabled)
		return;

	if (selection->count_selected_rows()) {
		Gtk::TreeIter iter = selection->get_selected();
		Gtk::TreeRow row = *iter;

		set_topic(row[col_topic]);
	}
}
Exemple #6
0
void
inbound_privmsg (server * serv, char *from, char *ip, char *text, int id)
{
    session *sess;
    char idtext[64];

    sess = find_dialog (serv, from);

    if (sess || prefs.autodialog)
    {
        /*0=ctcp  1=priv will set autodialog=0 here is flud detected */
        if (!sess)
        {
            if (flood_check (from, ip, serv, current_sess, 1))
                /* Create a dialog session */
                sess = inbound_open_dialog (serv, from);
            else
                sess = serv->server_session;
            if (!sess)
                return;     /* ?? */
        }

        if (ip && ip[0])
        {
            if (prefs.logging && sess->logfd != -1 &&
                    (!sess->topic || strcmp (sess->topic, ip)))
            {
                char tbuf[1024];
                snprintf (tbuf, sizeof (tbuf), "[%s has address %s]\n",
                          from, ip);
                write (sess->logfd, tbuf, strlen (tbuf));
            }
            set_topic (sess, ip, ip);
        }
        inbound_chanmsg (serv, NULL, NULL, from, text, FALSE, id);
        return;
    }

    inbound_make_idtext (serv, idtext, sizeof (idtext), id);

    sess = find_session_from_nick (from, serv);
    if (!sess)
    {
        sess = serv->front_session;
        EMIT_SIGNAL (XP_TE_PRIVMSG, sess, from, text, idtext, NULL, 0);
        return;
    }

    if (sess->type == SESS_DIALOG)
        EMIT_SIGNAL (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0);
    else
        EMIT_SIGNAL (XP_TE_PRIVMSG, sess, from, text, idtext, NULL, 0);
}
Exemple #7
0
void
inbound_topic (server * serv, char *chan, char *topic_text)
{
    session *sess = find_channel (serv, chan);

    if (sess)
    {
        set_topic (sess, topic_text, topic_text);
    }
    else
        sess = serv->server_session;

    EMIT_SIGNAL (XP_TE_TOPIC, sess, chan, topic_text, NULL, NULL, 0);
}
Exemple #8
0
void
inbound_topicnew (server *serv, char *nick, char *chan, char *topic)
{
	session *sess;
	char *new_topic;

	sess = find_channel (serv, chan);
	if (sess)
	{
		new_topic = strip_color (topic);
		set_topic (sess, new_topic);
		free (new_topic);
		EMIT_SIGNAL (XP_TE_NEWTOPIC, sess, nick, topic, chan, NULL, 0);
	}
}
Exemple #9
0
void
inbound_topicnew (server *serv, char *nick, char *chan, char *topic)
{
	session *sess;
	char *stripped_topic;

	sess = find_channel (serv, chan);
	if (sess)
	{
		EMIT_SIGNAL (XP_TE_NEWTOPIC, sess, nick, topic, chan, NULL, 0);
		stripped_topic = strip_color (topic, -1, STRIP_ALL);
		set_topic (sess, topic, stripped_topic);
		g_free (stripped_topic);
	}
}
Exemple #10
0
void
inbound_topic (server *serv, char *chan, char *topic_text)
{
	session *sess = find_channel (serv, chan);
	char *stripped_topic;

	if (sess)
	{
		stripped_topic = strip_color (topic_text, -1, STRIP_ALL);
		set_topic (sess, topic_text, stripped_topic);
		g_free (stripped_topic);
	} else
		sess = serv->server_session;

	EMIT_SIGNAL (XP_TE_TOPIC, sess, chan, topic_text, NULL, NULL, 0);
}
Exemple #11
0
void
inbound_topicnew (server *serv, char *nick, char *chan, char *topic,
						const message_tags_data *tags_data)
{
	session *sess;
	char *stripped_topic;

	sess = find_channel (serv, chan);
	if (sess)
	{
		EMIT_SIGNAL_TIMESTAMP (XP_TE_NEWTOPIC, sess, tags_data->timestamp, nick, topic, chan);
		stripped_topic = strip_color (topic, -1, STRIP_ALL);
		set_topic (sess, topic, stripped_topic);
		g_free (stripped_topic);
	}
}
Exemple #12
0
void
inbound_topic (server *serv, char *chan, char *topic_text)
{
	session *sess = find_channel (serv, chan);
	char *new_topic;

	if (sess)
	{
		new_topic = strip_color (topic_text);
		set_topic (sess, new_topic);
		free (new_topic);
	} else
		sess = serv->server_session;

	EMIT_SIGNAL (XP_TE_TOPIC, sess, chan, topic_text, NULL, NULL, 0);
}
Exemple #13
0
void
inbound_topic (server *serv, char *chan, char *topic_text,
					const message_tags_data *tags_data)
{
	session *sess = find_channel (serv, chan);
	char *stripped_topic;

	if (sess)
	{
		stripped_topic = strip_color (topic_text, -1, STRIP_ALL);
		set_topic (sess, topic_text, stripped_topic);
		g_free (stripped_topic);
	} else
		sess = serv->server_session;

	EMIT_SIGNAL_TIMESTAMP (XP_TE_TOPIC, sess, tags_data->timestamp, chan, topic_text);
}
Exemple #14
0
session *
new_ircwindow (server *serv, char *name, int type, int focus)
{
	session *sess;

	switch (type)
	{
	case SESS_SERVER:
		serv = server_new ();
		if (prefs.hex_gui_tab_server)
			sess = session_new (serv, name, SESS_SERVER, focus);
		else
			sess = session_new (serv, name, SESS_CHANNEL, focus);
		serv->server_session = sess;
		serv->front_session = sess;
		break;
	case SESS_DIALOG:
		sess = session_new (serv, name, type, focus);
		break;
	default:
/*	case SESS_CHANNEL:
	case SESS_NOTICES:
	case SESS_SNOTICES:*/
		sess = session_new (serv, name, type, focus);
		break;
	}

	irc_init (sess);
	chanopt_load (sess);
	scrollback_load (sess);
	if (sess->scrollwritten && sess->scrollback_replay_marklast)
		sess->scrollback_replay_marklast (sess);
	if (type == SESS_DIALOG)
	{
		struct User *user;

		log_open_or_close (sess);

		user = userlist_find_global (serv, name);
		if (user && user->hostname)
			set_topic (sess, user->hostname, user->hostname);
	}
	plugin_emit_dummy_print (sess, "Open Context");

	return sess;
}
void
Transmitter::update_def(const transmitterDef& def)
{
  // cout << "Transmitter::update_def(" << partition_id() << ", " << m_def.transmitter_id << ")" << endl;

  assert(m_def.transmitter_id == def.transmitter_id);
  assert(m_active);

  // check for changes requiring thread restart
  if (m_def.scheduling_class != def.scheduling_class ||
      m_def.thread_priority != def.thread_priority ||
      m_def.topic_kind != def.topic_kind ||
      m_def.topic_id != def.topic_id)
    {
      // stop writer thread
      m_active = false;
      m_writer_thread.join();

      // check for topic change
      if (m_def.topic_kind != def.topic_kind ||
	  m_def.topic_id != def.topic_id)
	{
	  m_def = def;
	  set_topic();
	  set_qos();
	}
      else
	{
	  m_def = def;
	}

      // finish updating
      m_config_number++;
      
      // restart writer thread
      m_active = true;
      m_writer_thread.create(&Transmitter::writer_thread);
    }
  else
    {
      // update without stopping and restarting thread
      m_def = def;
      m_config_number++;
    }
}
Exemple #16
0
void		cmd_topic(t_message *msg, t_client *client, t_chan *chans)
{
  t_chan	*channel;

  if (is_topic_valid(msg, client, chans) == true)
    {
      channel = find_chan(chans, msg->params[0]);
      if (is_chan_op(client, channel) == false)
	dprintf(client->client, ERR_CHANOPRIVSNEEDED, S_NAME, S_ADDR,
		client->nick, msg->params[0]);
      else
	{
	  if (get_nb_params(msg->params) == 1)
	    display_topic(client, channel);
	  else
	    set_topic(msg, client, channel);
	}
    }
}
/* ms_tburst()
 * 
 *      parv[0] = sender prefix
 *      parv[1] = channel timestamp
 *      parv[2] = channel
 *      parv[3] = topic timestamp
 *      parv[4] = topic setter
 *      parv[5] = topic
 */
static void
ms_tburst(struct Client *client_p, struct Client *source_p,
          int parc, char *parv[])
{
  struct Channel *chptr;
  time_t newchannelts = atol(parv[1]);
  time_t newtopicts = atol(parv[3]);

  if((chptr = hash_find_channel(parv[2])))
  {
    /* Don't allow newly created channels to change the topic ever,
     * only change the topic if we are on the old channel TS with
     * a new topic_time. -metalrock
     */
    if (chptr->channelts > newchannelts)
      return;
    else if (chptr->topic == NULL || (chptr->topic_time > newtopicts))
      set_topic(source_p, chptr, newtopicts, parv[4], parv[5]);
  }
}
Exemple #18
0
static void
ms_tb(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
  struct Channel *chptr;
  time_t tb_topicts = atol(tb_topicts_str);
  char *tb_whoset = NULL;
  char *tb_topic = NULL;

  if ((chptr = hash_find_channel(tb_channel)) == NULL)
    return;

  if (parc == 5)
  {
    tb_whoset = parv[3];
    tb_topic = parv[4];
  }
  else
  {
    tb_whoset = source_p->name;
    tb_topic = parv[3];
  }

  set_topic(source_p, chptr, tb_topicts, tb_whoset, tb_topic);
}
Exemple #19
0
void
inbound_privmsg (server *serv, char *from, char *ip, char *text, int id)
{
	session *sess;
	struct User *user;
	char idtext[64];
	gboolean nodiag = FALSE;

	sess = find_dialog (serv, from);

	if (sess || prefs.hex_gui_autoopen_dialog)
	{
		/*0=ctcp  1=priv will set hex_gui_autoopen_dialog=0 here is flud detected */
		if (!sess)
		{
			if (flood_check (from, ip, serv, current_sess, 1))
				/* Create a dialog session */
				sess = inbound_open_dialog (serv, from);
			else
				sess = serv->server_session;
			if (!sess)
				return; /* ?? */
		}

		if (ip && ip[0])
		{
			if (prefs.hex_irc_logging && sess->logfd != -1 &&
				(!sess->topic || strcmp(sess->topic, ip)))
			{
				char tbuf[1024];
				snprintf (tbuf, sizeof (tbuf), "[%s has address %s]\n", from, ip);
				write (sess->logfd, tbuf, strlen (tbuf));
			}
			set_topic (sess, ip, ip);
		}
		inbound_chanmsg (serv, NULL, NULL, from, text, FALSE, id);
		return;
	}

	sess = find_session_from_nick (from, serv);
	if (!sess)
	{
		sess = serv->front_session;
		nodiag = TRUE; /* We don't want it to look like a normal message in front sess */
	}

	user = userlist_find (sess, from);
	if (user)
	{
		user->lasttalk = time (0);
		if (user->account)
			id = TRUE;
	}
	
	inbound_make_idtext (serv, idtext, sizeof (idtext), id);

	if (sess->type == SESS_DIALOG && !nodiag)
		EMIT_SIGNAL (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0);
	else
		EMIT_SIGNAL (XP_TE_PRIVMSG, sess, from, text, idtext, NULL, 0);
}
void
Transmitter::create(const transmitterDef& def)
{
  m_def = def;
  // cout << "Transmitter::create(" << partition_id() << ", " << m_def.transmitter_id << ")" << endl;

  // setup QueryCondition for reading this Transmitter's Qos
  stringstream id;
  id << m_def.transmitter_id;
  StringSeq params;
  params.length(1);
  params[0] = id.str().c_str();
  m_qos_query.create(ANY_SAMPLE_STATE,
		     ANY_VIEW_STATE,
		     ANY_INSTANCE_STATE,
		     "transmitter_id = %0",
		     params);

  // setup Transmitter topic
  set_topic();

  // read initial Qos
  transmitterQosSeq qoss;
  SampleInfoSeq infos;
  // REVISIT - read or take?
  ReturnCode_t retcode = qos_reader()->read_w_condition(qoss,
							infos,
							1,
							m_qos_query);
  if (retcode == RETCODE_NO_DATA)
    {
      // no Qos instance to read, so initialize and write
      m_qos.group_id = m_def.group_id;
      m_qos.transmitter_id = m_def.transmitter_id;
      m_qos.partition_id = m_def.partition_id;
      m_qos.qos.latency_budget.duration.sec = 0;
      m_qos.qos.latency_budget.duration.nanosec = 0;
      m_qos.qos.transport_priority.value = 0;

      retcode = qos_writer()->write(m_qos,
				    0);
      qos_writer().check(retcode,
			 "transmitterQosDataWriter::write");
    }
  else
    {
      qos_reader().check(retcode,
			 "transmitterQosDataReader::read_w_condition");

      assert(qoss.length() == 1);
      assert(infos.length() == 1);
      m_qos = qoss[0];
      assert(m_qos.group_id == m_def.group_id);
      assert(m_qos.transmitter_id == m_def.transmitter_id);
      assert(m_qos.partition_id == m_def.partition_id);
    }
  qos_reader()->return_loan(qoss,
			    infos);

  set_qos();

  // start writer thread
  m_active = true;
  m_writer_thread.create(&Transmitter::writer_thread);
}