示例#1
0
文件: notify.c 项目: cremno/hexchat
static gboolean
notify_do_network (struct notify *notify, server *serv)
{
	if (!notify->networks)	/* ALL networks for this nick */
		return TRUE;

	if (token_foreach (notify->networks, ',', notify_netcmp, serv))
		return FALSE;	/* network list doesn't contain this one */

	return TRUE;
}
示例#2
0
文件: inbound.c 项目: arinity/gchat
void
inbound_login_end (session * sess, char *text)
{
    server *serv = sess->server;

    if (!serv->end_of_motd)
    {
        if (prefs.ip_from_server && serv->use_who)
        {
            serv->skip_next_userhost = TRUE;
            serv->p_get_ip_uh (serv, serv->nick);   /* sends USERHOST mynick */
        }
        set_default_modes (serv);

        if (serv->network)
        {
            /* there may be more than 1, separated by \n */
            if (((ircnet *) serv->network)->command)
                token_foreach (((ircnet *) serv->network)->command, '\n',
                               inbound_exec_eom_cmd, sess);

            /* send nickserv password */
            if (((ircnet *) serv->network)->nickserv)
                serv->p_ns_identify (serv,
                                     ((ircnet *) serv->network)->
                                     nickserv);
        }

        /* send JOIN now or wait? */
        if (serv->network && ((ircnet *) serv->network)->nickserv &&
                prefs.irc_join_delay)
            serv->joindelay_tag =
                fe_timeout_add (prefs.irc_join_delay * 1000,
                                check_autojoin_channels, serv);
        else
            check_autojoin_channels (serv);
        if (serv->supports_watch)
            notify_send_watches (serv);
        serv->end_of_motd = TRUE;
    }
    if (prefs.skipmotd && !serv->motd_skipped)
    {
        serv->motd_skipped = TRUE;
        EMIT_SIGNAL (XP_TE_MOTDSKIP, serv->server_session, NULL, NULL,
                     NULL, NULL, 0);
        return;
    }
    EMIT_SIGNAL (XP_TE_MOTD, serv->server_session, text, NULL, NULL, NULL, 0);
}
示例#3
0
文件: servlist.c 项目: PChat/PChat
int
servlist_save (void)
{
	FILE *fp;
	char buf[256];
	ircnet *net;
	ircserver *serv;
	GSList *list;
	GSList *hlist;
#ifndef WIN32
	int first = FALSE;

	snprintf (buf, sizeof (buf), "%s/servlist_.conf", get_xdir_fs ());
	if (access (buf, F_OK) != 0)
		first = TRUE;
#endif

	fp = xchat_fopen_file ("servlist_.conf", "w", 0);
	if (!fp)
		return FALSE;

#ifndef WIN32
	if (first)
		chmod (buf, 0600);
#endif
	fprintf (fp, "v="PACKAGE_VERSION"\n\n");

	list = network_list;
	while (list)
	{
		net = list->data;

		fprintf (fp, "N=%s\n", net->name);
		if (net->nick)
			fprintf (fp, "I=%s\n", net->nick);
		if (net->nick2)
			fprintf (fp, "i=%s\n", net->nick2);
		if (net->user)
			fprintf (fp, "U=%s\n", net->user);
		if (net->real)
			fprintf (fp, "R=%s\n", net->real);
		if (net->pass)
			fprintf (fp, "P=%s\n", net->pass);
		if (net->autojoin)
			fprintf (fp, "J=%s\n", net->autojoin);
		if (net->nickserv)
			fprintf (fp, "B=%s\n", net->nickserv);
		if (net->encoding && g_ascii_strcasecmp (net->encoding, "System") &&
			 g_ascii_strcasecmp (net->encoding, "System default"))
		{
			fprintf (fp, "E=%s\n", net->encoding);
			if (!servlist_check_encoding (net->encoding))
			{
				snprintf (buf, sizeof (buf), _("Warning: \"%s\" character set is unknown. No conversion will be applied for network %s."),
							 net->encoding, net->name);
				fe_message (buf, FE_MSG_WARN);
			}
		}

		if (net->command)
			token_foreach (net->command, '\n', servlist_write_ccmd, fp);

		fprintf (fp, "F=%d\nD=%d\n", net->flags, net->selected);

		hlist = net->servlist;
		while (hlist)
		{
			serv = hlist->data;
			fprintf (fp, "S=%s\n", serv->hostname);
			hlist = hlist->next;
		}

		if (fprintf (fp, "\n") < 1)
		{
			fclose (fp);
			return FALSE;
		}

		list = list->next;
	}

	fclose (fp);
	return TRUE;
}