示例#1
0
文件: notify.c 项目: cremno/hexchat
struct notify_per_server *
notify_find_server_entry (struct notify *notify, struct server *serv)
{
	GSList *list = notify->server_list;
	struct notify_per_server *servnot;

	while (list)
	{
		servnot = (struct notify_per_server *) list->data;
		if (servnot->server == serv)
			return servnot;
		list = list->next;
	}

	/* not found, should we add it, or is this not a network where
      we're monitoring this nick? */
	if (!notify_do_network (notify, serv))
		return NULL;

	servnot = malloc (sizeof (struct notify_per_server));
	if (servnot)
	{
		memset (servnot, 0, sizeof (struct notify_per_server));
		servnot->server = serv;
		servnot->notify = notify;
		notify->server_list = g_slist_prepend (notify->server_list, servnot);
	}
	return servnot;
}
示例#2
0
文件: notify.c 项目: cremno/hexchat
static void
notify_checklist_for_server (server *serv)
{
	char outbuf[512];
	struct notify *notify;
	GSList *list = notify_list;
	int i = 0;

	strcpy (outbuf, "ISON ");
	while (list)
	{
		notify = list->data;
		if (notify_do_network (notify, serv))
		{
			i++;
			strcat (outbuf, notify->name);
			strcat (outbuf, " ");
			if (strlen (outbuf) > 460)
			{
				/* LAME: we can't send more than 512 bytes to the server, but     *
				 * if we split it in two packets, our offline detection wouldn't  *
				 work                                                           */
				/*fprintf (stderr, _("*** XCHAT WARNING: notify list too large.\n"));*/
				break;
			}
		}
		list = list->next;
	}

	if (i)
		serv->p_raw (serv, outbuf);
}
示例#3
0
文件: notify.c 项目: Farow/hexchat
void
notify_send_watches (server * serv)
{
	struct notify *notify;
	GSList *list;
	GSList *point;
	int len;

	len = 0;
	point = list = notify_list;
	while (list)
	{
		notify = list->data;

		if (notify_do_network (notify, serv))
		{
			len += strlen (notify->name) + serv->supports_monitor ? 1 : 2; /* just , for monitor or + and space for watch */;
			if (len > 500)
			{
				notify_flush_watches (serv, point, list);
				len = strlen (notify->name) + serv->supports_monitor ? 1 : 2;
				point = list;
			}
		}

		list = list->next;
	}

	if (point)
		notify_flush_watches (serv, point, NULL);
}
示例#4
0
文件: notify.c 项目: cremno/hexchat
void
notify_send_watches (server * serv)
{
	struct notify *notify;
	GSList *list;
	GSList *point;
	int len;

	len = 0;
	point = list = notify_list;
	while (list)
	{
		notify = list->data;

		if (notify_do_network (notify, serv))
		{
			len += strlen (notify->name) + 2 /* + and space */;
			if (len > 500)
			{
				notify_flush_watches (serv, point, list);
				len = strlen (notify->name) + 2;
				point = list;
			}
		}

		list = list->next;
	}

	if (point)
		notify_flush_watches (serv, point, NULL);
}
示例#5
0
文件: notify.c 项目: Farow/hexchat
static void
notify_watch_all (struct notify *notify, int add)
{
	server *serv;
	GSList *list = serv_list;
	while (list)
	{
		serv = list->data;
		if (serv->connected && serv->end_of_motd && notify_do_network (notify, serv))
			notify_watch (serv, notify->name, add);
		list = list->next;
	}
}