• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ server_get_network函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中server_get_network函数的典型用法代码示例。如果您正苦于以下问题:C++ server_get_network函数的具体用法?C++ server_get_network怎么用?C++ server_get_network使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了server_get_network函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: log_write

static void
log_write (session *sess, char *text, time_t ts)
{
	char *temp;
	char *stamp;
	char *file;
	int len;

	if (sess->text_logging == SET_DEFAULT)
	{
		if (!prefs.hex_irc_logging)
			return;
	}
	else
	{
		if (sess->text_logging != SET_ON)
			return;
	}

	if (sess->logfd == -1)
		log_open (sess);

	/* change to a different log file? */
	file = log_create_pathname (sess->server->servername, sess->channel,
										 server_get_network (sess->server, FALSE));
	if (file)
	{
		if (g_access (file, F_OK) != 0)
		{
			close (sess->logfd);
			sess->logfd = log_open_file (sess->server->servername, sess->channel,
												  server_get_network (sess->server, FALSE));
		}
		g_free (file);
	}

	if (prefs.hex_stamp_log)
	{
		if (!ts) ts = time(0);
		len = get_stamp_str (prefs.hex_stamp_log_format, ts, &stamp);
		if (len)
		{
			write (sess->logfd, stamp, len);
			g_free (stamp);
		}
	}
	temp = strip_color (text, -1, STRIP_ALL);
	len = strlen (temp);
	write (sess->logfd, temp, len);
	/* lots of scripts/plugins print without a \n at the end */
	if (temp[len - 1] != '\n')
		write (sess->logfd, "\n", 1);	/* emulate what xtext would display */
	g_free (temp);
}
开发者ID:TheWug,项目名称:hexchat,代码行数:54,代码来源:text.c


示例2: chanopt_save

void
chanopt_save (session *sess)
{
	int i;
	guint8 vals;
	guint8 valm;
	chanopt_in_memory *co;
	char *network;

	if (sess->channel[0] == 0)
		return;

	network = server_get_network (sess->server, FALSE);
	if (!network)
		return;

	/* 2. reconcile sess with what we loaded from disk */

	co = chanopt_find (network, sess->channel, TRUE);

	i = 0;
	while (i < sizeof (chanopt) / sizeof (channel_options))
	{
		vals = G_STRUCT_MEMBER(guint8, sess, chanopt[i].offset);
		valm = G_STRUCT_MEMBER(guint8, co, chanopt[i].offset);

		if (vals != valm)
		{
			*(guint8 *)G_STRUCT_MEMBER_P(co, chanopt[i].offset) = vals;
			chanopt_changed = TRUE;
		}

		i++;
	}
}
开发者ID:94m3k1n9,项目名称:hexchat,代码行数:35,代码来源:chanopt.c


示例3: chanopt_load

void
chanopt_load (session *sess)
{
	int i;
	guint8 val;
	chanopt_in_memory *co;
	char *network;

	if (sess->channel[0] == 0)
		return;

	network = server_get_network (sess->server, FALSE);
	if (!network)
		return;

	if (!chanopt_open)
	{
		chanopt_open = TRUE;
		chanopt_load_all ();
	}

	co = chanopt_find (network, sess->channel, FALSE);
	if (!co)
		return;

	/* fill in all the sess->xxxxx fields */
	i = 0;
	while (i < sizeof (chanopt) / sizeof (channel_options))
	{
		val = G_STRUCT_MEMBER(guint8, co, chanopt[i].offset);
		*(guint8 *)G_STRUCT_MEMBER_P(sess, chanopt[i].offset) = val;
		i++;
	}
}
开发者ID:94m3k1n9,项目名称:hexchat,代码行数:34,代码来源:chanopt.c


示例4: scrollback_get_filename

static char *
scrollback_get_filename (session *sess)
{
	char *net, *chan, *buf, *ret = NULL;

	net = server_get_network (sess->server, FALSE);
	if (!net)
		return NULL;

	net = log_create_filename (net);
	buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "scrollback" G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s.txt", get_xdir (), net, "");
	mkdir_p (buf);
	g_free (buf);

	chan = log_create_filename (sess->channel);
	if (chan[0])
		buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "scrollback" G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s.txt", get_xdir (), net, chan);
	else
		buf = NULL;
	g_free (chan);
	g_free (net);

	if (buf)
	{
		ret = g_filename_from_utf8 (buf, -1, NULL, NULL, NULL);
		g_free (buf);
	}

	return ret;
}
开发者ID:Cynede,项目名称:hexchat,代码行数:30,代码来源:text.c


示例5: notify_announce_online

static void
notify_announce_online (server * serv, struct notify_per_server *servnot,
								char *nick)
{
	session *sess;

	sess = serv->front_session;

	servnot->lastseen = time (0);
	if (servnot->ison)
		return;

	servnot->ison = TRUE;
	servnot->laston = time (0);
	EMIT_SIGNAL (XP_TE_NOTIFYONLINE, sess, nick, serv->servername,
					 server_get_network (serv, TRUE), NULL, 0);
	fe_notify_update (nick);
	fe_notify_update (0);

	if (prefs.whois_on_notifyonline)
	{

	    /* Let's do whois with idle time (like in /quote WHOIS %s %s) */

	    char *wii_str = malloc (strlen (nick) * 2 + 2);
	    sprintf (wii_str, "%s %s", nick, nick);
	    serv->p_whois (serv, wii_str);
	    free (wii_str);
	}
}
开发者ID:cremno,项目名称:hexchat,代码行数:30,代码来源:notify.c


示例6: process_private

static void
process_private(gpointer *params)
{
	session *sess  = params[0];
	gchar *from    = params[1];
	gchar *message = params[2];

	const char *network = server_get_network(sess->server, FALSE);
	if (!network)
		network = sess->server->connected ? sess->server->servername : NULL;

	if (FromNick(from, prefs.irc_no_hilight))
		return;

	if (prefs.input_tray_priv)
	{
		tray_set_flash(ICON_HILIGHT);

		tray_priv_count++;
		if (tray_priv_count == 1)
			tray_set_tipf(_("GChat: Private message from: %s (%s)"),
								from, network);
		else
			tray_set_tipf(_("GChat: %u private messages, latest from: %s (%s)"),
								tray_priv_count, from, network);
	}

	if (prefs.input_balloon_priv)
		tray_set_balloonf(message, _("GChat: Private message from: %s (%s)"),
								 from, network);
}
开发者ID:arinity,项目名称:gchat2,代码行数:31,代码来源:tray.c


示例7: process_invited

static void
process_invited(gpointer *params)
{
	gchar **word  = params[1];
	gchar *from   = params[2];
	server *serv  = params[3];

	gchar *channel = word[4][0] == ':' ? word[4] + 1 : word[4];

	const char *network = server_get_network(serv, FALSE);
	if (!network)
		network = serv->connected ? serv->servername : NULL;

	if (FromNick(from, prefs.irc_no_hilight))
		return;

	if (prefs.input_tray_priv)
	{
		tray_set_flash(ICON_HILIGHT);

		tray_invite_count++;
		if (tray_invite_count == 1)
			tray_set_tipf(_("GChat: Invite from: %s (%s) to %s"),
								from, network, channel);
		else
			tray_set_tipf(_("GChat: %u private messages, latest from: %s (%s) to %s"),
								tray_priv_count, from, network, channel);
	}

	if (prefs.input_balloon_priv)
		tray_set_balloonf("", _("GChat: Invite from: %s (%s) to %s"),
								 from, network, channel);
}
开发者ID:arinity,项目名称:gchat2,代码行数:33,代码来源:tray.c


示例8: nick_command_parse

void
nick_command_parse (session *sess, char *cmd, char *nick, char *allnick)
{
	char *buf;
	char *host = _("Host unknown");
	struct User *user;
	int len;

/*	if (sess->type == SESS_DIALOG)
	{
		buf = (char *)(GTK_ENTRY (sess->gui->topic_entry)->text);
		buf = strrchr (buf, '@');
		if (buf)
			host = buf + 1;
	} else*/
	{
		user = userlist_find (sess, nick);
		if (user && user->hostname)
			host = strchr (user->hostname, '@') + 1;
	}

	/* this can't overflow, since popup->cmd is only 256 */
	len = strlen (cmd) + strlen (nick) + strlen (allnick) + 512;
	buf = malloc (len);

	auto_insert (buf, len, cmd, 0, 0, allnick, sess->channel, "",
					 server_get_network (sess->server, TRUE), host,
					 sess->server->nick, nick);

	nick_command (sess, buf);

	free (buf);
}
开发者ID:arinity,项目名称:gchat2,代码行数:33,代码来源:menu.c


示例9: process_dcc

static void
process_dcc(gpointer *params)
{
	session *sess = params[0];
	gchar *nick   = params[1];

	const char *network = server_get_network(sess->server, FALSE);
	if (!network)
		network = sess->server->connected ? sess->server->servername : NULL;

	if (prefs.input_tray_priv)
	{
		tray_set_flash(ICON_FILE);

		tray_dcc_count++;
		if (tray_dcc_count == 1)
			tray_set_tipf(_("GChat: DCC offer from: %s (%s)"),
								nick, network ? network : "unknown network");
		else
			tray_set_tipf(_("GChat: %u DCC offers, latest from: %s (%s)"),
								tray_dcc_count, nick, network ? network : "unknown network");
	}

	if (prefs.input_balloon_priv)
		tray_set_balloonf("", _("GChat: DCC offer from: %s (%s)"),
								nick, network ? network : "unknown network");
}
开发者ID:arinity,项目名称:gchat2,代码行数:27,代码来源:tray.c


示例10: xchat_find_context

xchat_context* xchat_find_context(xchat_plugin *ph, const char *servname, const char *channel)
{
	GSList *slist, *clist, *sessions = nullptr;
	server *serv;
	session *sess;
	char *netname;

	if (servname == nullptr && channel == nullptr)
		return current_sess;

	slist = serv_list;
	while (slist)
	{
		serv = (server*)slist->data;
		netname = server_get_network(serv, TRUE);

		if (servname == nullptr ||
			 rfc_casecmp(servname, serv->servername) == 0 ||
			 strcasecmp(servname, serv->hostname) == 0 ||
			 strcasecmp(servname, netname) == 0)
		{
			if (channel == nullptr)
				return serv->front_session;

			clist = sess_list;
			while (clist)
			{
				sess = (session*)clist->data;
				if (sess->server == serv)
				{
					if (rfc_casecmp(channel, sess->channel) == 0)
					{
						if (sess->server == ph->context->server)
						{
							g_slist_free(sessions);
							return sess;
						}
						else
						{
							sessions = g_slist_prepend(sessions, sess);
						}
					}
				}
				clist = clist->next;
			}
		}
		slist = slist->next;
	}

	if (sessions)
	{
		sessions = g_slist_reverse(sessions);
		sess = (session*)sessions->data;
		g_slist_free(sessions);
		return sess;
	}

	return nullptr;
}
开发者ID:wowzaman12,项目名称:libPChat,代码行数:59,代码来源:plugin.cpp


示例11: plugin_find_context

session *
plugin_find_context (const char *servname, const char *channel, server *current_server)
{
	GSList *slist, *clist, *sessions = NULL;
	server *serv;
	session *sess;
	char *netname;

	if (servname == NULL && channel == NULL)
		return current_sess;

	slist = serv_list;
	while (slist)
	{
		serv = slist->data;
		netname = server_get_network (serv, TRUE);

		if (servname == NULL ||
			 rfc_casecmp (servname, serv->servername) == 0 ||
			 g_ascii_strcasecmp (servname, serv->hostname) == 0 ||
			 g_ascii_strcasecmp (servname, netname) == 0)
		{
			if (channel == NULL)
				return serv->front_session;

			clist = sess_list;
			while (clist)
			{
				sess = clist->data;
				if (sess->server == serv)
				{
					if (rfc_casecmp (channel, sess->channel) == 0)
					{
						if (sess->server == current_server)
						{
							g_slist_free (sessions);
							return sess;
						} else
						{
							sessions = g_slist_prepend (sessions, sess);
						}
					}
				}
				clist = clist->next;
			}
		}
		slist = slist->next;
	}

	if (sessions)
	{
		sessions = g_slist_reverse (sessions);
		sess = sessions->data;
		g_slist_free (sessions);
		return sess;
	}

	return NULL;
}
开发者ID:IotaSpencer,项目名称:hexchat,代码行数:59,代码来源:plugin.c


示例12: log_open

static void
log_open (session *sess)
{
	static gboolean log_error = FALSE;

	log_close (sess);
	sess->logfd = log_open_file (sess->server->servername, sess->channel,
										  server_get_network (sess->server, FALSE));

	if (!log_error && sess->logfd == -1)
	{
		char message[512];

		snprintf (message, sizeof (message), _("* Can't open log file(s) for writing. Check the\npermissions on %s"),
			log_create_pathname (sess->server->servername, sess->channel, server_get_network (sess->server, FALSE)));

		fe_message (message, FE_MSG_WAIT | FE_MSG_ERROR);
		log_error = TRUE;
	}
}
开发者ID:sb057,项目名称:hexchat,代码行数:20,代码来源:text.c


示例13: log_open

static void
log_open (session *sess)
{
	static gboolean log_error = FALSE;

	log_close (sess);
	sess->logfd = log_open_file (sess->server->servername, sess->channel,
										  server_get_network (sess->server, FALSE));

	if (!log_error && sess->logfd == -1)
	{
		char *filename = log_create_pathname (sess->server->servername, sess->channel, server_get_network (sess->server, FALSE));
		char *message = g_strdup_printf (_("* Can't open log file(s) for writing. Check the\npermissions on %s"), filename);

		g_free (filename);

		fe_message (message, FE_MSG_WAIT | FE_MSG_ERROR);

		g_free (message);

		log_error = TRUE;
	}
}
开发者ID:Cynede,项目名称:hexchat,代码行数:23,代码来源:text.c


示例14: ctcp_reply

static void
ctcp_reply (session *sess, char *nick, char *word[], char *word_eol[],
				char *conf)
{
	char tbuf[4096];	/* can receive 2048 from IRC, so this is enough */

	conf = strdup (conf);
	/* process %C %B etc */
	check_special_chars (conf, TRUE);
	auto_insert (tbuf, sizeof (tbuf), conf, word, word_eol, "", "", word_eol[5],
					 server_get_network (sess->server, TRUE), "", "", nick);
	free (conf);
	handle_command (sess, tbuf, FALSE);
}
开发者ID:Kyuuketsuki,项目名称:xchat-aqua,代码行数:14,代码来源:ctcp.c


示例15: notify_netcmp

static int
notify_netcmp (char *str, void *serv)
{
	char *net = despacify_dup (server_get_network (serv, TRUE));

	if (rfc_casecmp (str, net) == 0)
	{
		free (net);
		return 0;	/* finish & return FALSE from token_foreach() */
	}

	free (net);
	return 1;	/* keep going... */
}
开发者ID:cremno,项目名称:hexchat,代码行数:14,代码来源:notify.c


示例16: signal_printer_notify_online

void
signal_printer_notify_online(gpointer *params)
{
	session *sess  = params[0];
	gchar *nick    = params[1];
	server *serv   = params[2];

	gchar *servername = g_strdup((gchar *)serv->servername);
	gchar *network    = g_strdup((gchar *)server_get_network(serv, TRUE));

	session_print_format(sess, "notify online", nick, servername, network);

	g_free(servername);
	g_free(network);
}
开发者ID:TingPing,项目名称:conspire,代码行数:15,代码来源:signal_printer.c


示例17: notify_announce_offline

static void
notify_announce_offline (server * serv, struct notify_per_server *servnot,
								char *nick, int quiet)
{
	session *sess;

	sess = serv->front_session;

	servnot->ison = FALSE;
	servnot->lastoff = time (0);
	if (!quiet)
		EMIT_SIGNAL (XP_TE_NOTIFYOFFLINE, sess, nick, serv->servername,
						 server_get_network (serv, TRUE), NULL, 0);
	fe_notify_update (nick);
	fe_notify_update (0);
}
开发者ID:cremno,项目名称:hexchat,代码行数:16,代码来源:notify.c


示例18: scrollback_get_filename

static char* scrollback_get_filename(session *sess, char *buf, int max)
{
	char *net, *chan;

	net = server_get_network(sess->server, FALSE);
	if (!net)
		return nullptr;

	snprintf(buf, max, "%s/scrollback/%s/%s.txt", get_xdir_fs(), net, "");
	mkdir_p(buf);

	chan = log_create_filename(sess->channel);
	snprintf(buf, max, "%s/scrollback/%s/%s.txt", get_xdir_fs(), net, chan);
	free(chan);

	return buf;
}
开发者ID:wowzaman12,项目名称:libPChat,代码行数:17,代码来源:text.cpp


示例19: scrollback_get_filename

static char *
scrollback_get_filename (session *sess)
{
	char *net, *chan, *buf;

	net = server_get_network (sess->server, FALSE);
	if (!net)
		return NULL;

	buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "scrollback" G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s.txt", get_xdir (), net, "");
	mkdir_p (buf);
	g_free (buf);

	chan = log_create_filename (sess->channel);
	buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "scrollback" G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s.txt", get_xdir (), net, chan);
	free (chan);

	return buf;
}
开发者ID:DoctorWho11,项目名称:pchat,代码行数:19,代码来源:text.c


示例20: xchat_list_str

const char* xchat_list_str(xchat_plugin *ph, xchat_list *xlist, const char *name)
{
	unsigned int hash = str_hash(name);
	void* data = ph->context;
	int type = LIST_CHANNELS;

	// a nullptr xlist is a shortcut to current "channels" context
	if (xlist)
	{
		data = xlist->pos->data;
		type = xlist->type;
	}

	switch (type)
	{
	case LIST_CHANNELS:
		switch (hash)
		{
		case 0x2c0b7d03: // channel
			return ((session*)data)->channel;
		case 0x577e0867: // chantypes
			return ((session*)data)->server->chantypes;
		case 0x38b735af: // context
			return (const char*)data;	// this is a session*
		case 0x6de15a2e: // network
			return server_get_network (((session*)data)->server, FALSE);
		case 0x8455e723: // nickprefixes
			return ((session*)data)->server->nick_prefixes;
		case 0x829689ad: // nickmodes
			return ((session*)data)->server->nick_modes;
		case 0xca022f43: // server
			return ((session*)data)->server->servername;
		}
		break;

	case LIST_DCC:
		switch (hash)
		{
		case 0x3d9ad31e:	// destfile
			return ((DCC*)data)->destfile;
		case 0x2ff57c:		// file
			return ((DCC*)data)->file;
		case 0x339763:		// nick
			return ((DCC*)data)->nick;
		}
		break;

	case LIST_IGNORE:
		switch (hash)
		{
		case 0x3306ec:	// mask
			return ((ignore*)data)->mask;
		}
		break;

	case LIST_NOTIFY:
		switch (hash)
		{
		case 0x4e49ec05:	// networks
			return ((notify*)data)->networks;
		case 0x339763:		// nick
			return ((notify*)data)->name;
		}
		break;

	case LIST_USERS:
		switch (hash)
		{
		case 0x339763: // nick
			return ((User*)data)->nick;
		case 0x30f5a8: // host
			return ((User*)data)->hostname;
		case 0xc594b292: // prefix
			return ((User*)data)->prefix;
		case 0xccc6d529: // realname
			return ((User*)data)->realname;
		}
		break;
	}

	return nullptr;
}
开发者ID:wowzaman12,项目名称:libPChat,代码行数:82,代码来源:plugin.cpp



注:本文中的server_get_network函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ server_start函数代码示例发布时间:2022-05-30
下一篇:
C++ server_connect函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap