Exemplo n.º 1
0
/* CTCP ping */
static void ctcp_ping(const char *data, IRC_SERVER_REC *server, const char *nick)
{
	char *str;

	g_return_if_fail(data != NULL);
	g_return_if_fail(server != NULL);
	g_return_if_fail(nick != NULL);

	str = g_strdup_printf("NOTICE %s :\001PING %s\001", nick, data);
	ctcp_send_reply(server, str);
	g_free(str);
}
Exemplo n.º 2
0
/* CTCP version */
static void ctcp_version(const char *data, IRC_SERVER_REC *server, const char *nick)
{
	char *str, *reply;

	g_return_if_fail(server != NULL);
	g_return_if_fail(nick != NULL);

	reply = parse_special_string(settings_get_str("ctcp_version_reply"), server, NULL, "", NULL);
	str = g_strdup_printf("NOTICE %s :\001VERSION %s\001", nick, reply);
	ctcp_send_reply(server, str);
	g_free(str);
	g_free(reply);
}
Exemplo n.º 3
0
/* CTCP version */
static void ctcp_time(IRC_SERVER_REC *server, const char *data,
		      const char *nick)
{
	char *str, *reply;

	g_return_if_fail(server != NULL);
	g_return_if_fail(nick != NULL);

        reply = my_asctime(time(NULL));
	str = g_strdup_printf("NOTICE %s :\001TIME %s\001", nick, reply);
	ctcp_send_reply(server, str);
	g_free(str);
	g_free(reply);
}
Exemplo n.º 4
0
static PyObject *PyIrcServer_ctcp_send_reply(PyIrcServer *self, PyObject *args, PyObject *kwds)
{
    static char *kwlist[] = {"data", NULL};
    char *data;

    RET_NULL_IF_INVALID(self->data);
    
    if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &data))
        return NULL;

    ctcp_send_reply(self->data, data);
    
    Py_RETURN_NONE;
}
Exemplo n.º 5
0
/* CTCP version */
static void ctcp_time(const char *data, IRC_SERVER_REC *server, const char *nick)
{
	char *str, *reply;
	struct tm *tm;
	time_t t;

	g_return_if_fail(server != NULL);
	g_return_if_fail(nick != NULL);

        t = time(NULL);
	tm = localtime(&t);
	reply = g_strdup(asctime(tm));
	if (reply[strlen(reply)-1] == '\n') reply[strlen(reply)-1] = '\0';

	str = g_strdup_printf("NOTICE %s :\001TIME %s\001", nick, reply);
	ctcp_send_reply(server, str);
	g_free(str);
	g_free(reply);
}