Example #1
0
hexchat_list *
hexchat_list_get (hexchat_plugin *ph, const char *name)
{
	hexchat_list *list;

	list = malloc (sizeof (hexchat_list));
	list->pos = NULL;

	switch (str_hash (name))
	{
	case 0x556423d0: /* channels */
		list->type = LIST_CHANNELS;
		list->next = sess_list;
		break;

	case 0x183c4:	/* dcc */
		list->type = LIST_DCC;
		list->next = dcc_list;
		break;

	case 0xb90bfdd2:	/* ignore */
		list->type = LIST_IGNORE;
		list->next = ignore_list;
		break;

	case 0xc2079749:	/* notify */
		list->type = LIST_NOTIFY;
		list->next = notify_list;
		list->head = (void *)ph->context;	/* reuse this pointer */
		break;

	case 0x6a68e08: /* users */
		if (is_session (ph->context))
		{
			list->type = LIST_USERS;
			list->head = list->next = userlist_flat_list (ph->context);
			fe_userlist_set_selected (ph->context);
			break;
		}	/* fall through */

	default:
		free (list);
		return NULL;
	}

	return list;
}
Example #2
0
xchat_list* xchat_list_get(xchat_plugin *ph, const char *name)
{
	xchat_list *list;

	list = (xchat_list*)malloc(sizeof(xchat_list));
	list->pos = nullptr;

	switch (str_hash(name))
	{
	case 0x556423d0: // channels
		list->type = LIST_CHANNELS;
		list->next = sess_list;
		break;

	case 0x183c4:	// dcc
		list->type = LIST_DCC;
		list->next = dcc_list;
		break;

	case 0xb90bfdd2:	// ignore
		list->type = LIST_IGNORE;
		list->next = ignore_list;
		break;

	case 0xc2079749:	// notify
		list->type = LIST_NOTIFY;
		list->next = notify_list;
		list->head = (GSList*)ph->context;	// reuse this pointer
		break;

	case 0x6a68e08: // users
		if (is_session(ph->context))
		{
			list->type = LIST_USERS;
			list->head = list->next = userlist_flat_list(ph->context);
			fe_userlist_set_selected(ph->context);
			break;
		}	// fall through

	default:
		free(list);
		return nullptr;
	}

	return list;
}