static void test_server_destroy_flood(ServerDestroyFloodData *fixture, const void *data) { SERVER_REC *server; /* = g_new0(IRC_SERVER_REC, 1); */ CHAT_PROTOCOL_REC *proto; SERVER_CONNECT_REC *conn; GLogLevelFlags loglev; g_test_bug("796"); /* for the purpose of this exercise, we are ignoring the errors of g_hash_table_lookup failure */ loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK); proto = chat_protocol_find("IRC"); conn = server_create_conn(proto->id, "localhost", 0, "", "", "user"); server = proto->server_init_connect(conn); server->session_reconnect = TRUE; server->tag = g_strdup("testserver"); g_test_message("created server: %p", server); /* we skip some initialisations that would try to send data */ /* irc_servers_deinit(); */ irc_session_deinit(); irc_irc_deinit(); server_connect_finished(server); /* make up for the skipped session init */ irc_server_init_bare_minimum(IRC_SERVER(server)); irc_irc_init(); irc_session_init(); /* irc_servers_init(); */ /* simulate failing irc_server_send_data() */ server->connection_lost = TRUE; /* chat_completion_deinit(); fe_messages_deinit(); irc_notifylist_deinit(); */ server_ref(server); signal_emit("event privmsg", 4, server, "#someroom :test message", "nick", "user@host"); server_unref(server); g_log_set_always_fatal(loglev); }
void irc_core_init(void) { CHAT_PROTOCOL_REC *rec; rec = g_new0(CHAT_PROTOCOL_REC, 1); rec->name = "IRC"; rec->fullname = "Internet Relay Chat"; rec->chatnet = "ircnet"; rec->case_insensitive = TRUE; rec->create_chatnet = create_chatnet; rec->create_server_setup = create_server_setup; rec->create_channel_setup = create_channel_setup; rec->create_server_connect = create_server_connect; rec->destroy_server_connect = destroy_server_connect; rec->server_init_connect = irc_server_init_connect; rec->server_connect = irc_server_connect; rec->channel_create = (CHANNEL_REC *(*) (SERVER_REC *, const char *, const char *, int)) irc_channel_create; rec->query_create = (QUERY_REC *(*) (const char *, const char *, int)) irc_query_create; chat_protocol_register(rec); g_free(rec); irc_session_init(); irc_chatnets_init(); irc_servers_init(); irc_channels_init(); irc_queries_init(); ctcp_init(); irc_commands_init(); irc_irc_init(); lag_init(); netsplit_init(); irc_expandos_init(); settings_check(); module_register("core", "irc"); }