diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/network-openssl.c | 142 | ||||
-rw-r--r-- | src/core/nicklist.c | 8 | ||||
-rw-r--r-- | src/core/nicklist.h | 3 | ||||
-rw-r--r-- | src/core/recode.c | 20 | ||||
-rw-r--r-- | src/core/session.c | 48 |
5 files changed, 0 insertions, 221 deletions
diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index b2b00dc9..75d66050 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -94,146 +94,6 @@ static gboolean irssi_ssl_verify(SSL *ssl, SSL_CTX *ctx, X509 *cert) return TRUE; } - -#if GLIB_MAJOR_VERSION < 2 - -static GIOError ssl_errno(gint e) -{ - switch(e) - { - case EINVAL: - return G_IO_ERROR_INVAL; - case EINTR: - case EAGAIN: - return G_IO_ERROR_AGAIN; - default: - return G_IO_ERROR_INVAL; - } - /*UNREACH*/ - return G_IO_ERROR_INVAL; -} - -static GIOError irssi_ssl_cert_step(GIOSSLChannel *chan) -{ - X509 *cert; - gint err; - switch(err = SSL_do_handshake(chan->ssl)) - { - case 1: - if(!(cert = SSL_get_peer_certificate(chan->ssl))) - { - g_warning("SSL server supplied no certificate"); - return G_IO_ERROR_INVAL; - } - if (chan->verify && ! irssi_ssl_verify(chan->ssl, chan->ctx, cert)) { - X509_free(cert); - return G_IO_ERROR_INVAL; - } - X509_free(cert); - return G_IO_ERROR_NONE; - default: - if(SSL_get_error(chan->ssl, err) == SSL_ERROR_WANT_READ) - return G_IO_ERROR_AGAIN; - return ssl_errno(errno); - } - /*UNREACH*/ - return G_IO_ERROR_INVAL; -} - -static GIOError irssi_ssl_read(GIOChannel *handle, gchar *buf, guint len, guint *ret) -{ - GIOSSLChannel *chan = (GIOSSLChannel *)handle; - gint err; - - if(! chan->got_cert) - { - gint cert_err = irssi_ssl_cert_step(chan); - if(cert_err != G_IO_ERROR_NONE) - return cert_err; - } - - err = SSL_read(chan->ssl, buf, len); - if(err < 0) - { - *ret = 0; - if(SSL_get_error(chan->ssl, err) == SSL_ERROR_WANT_READ) - return G_IO_ERROR_AGAIN; - return ssl_errno(errno); - } - else - { - *ret = err; - return G_IO_ERROR_NONE; - } - /*UNREACH*/ - return -1; -} - -static GIOError irssi_ssl_write(GIOChannel *handle, gchar *buf, guint len, guint *ret) -{ - GIOSSLChannel *chan = (GIOSSLChannel *)handle; - gint err; - - if(chan->got_cert) - { - gint cert_err = irssi_ssl_cert_step(chan); - if(cert_err != G_IO_ERROR_NONE) - return cert_err; - } - - - err = SSL_write(chan->ssl, (const char *)buf, len); - if(err < 0) - { - *ret = 0; - if(SSL_get_error(chan->ssl, err) == SSL_ERROR_WANT_READ) - return G_IO_ERROR_AGAIN; - return ssl_errno(errno); - } - else - { - *ret = err; - return G_IO_ERROR_NONE; - } - /*UNREACH*/ - return G_IO_ERROR_INVAL; -} - -static GIOError irssi_ssl_seek(GIOChannel *handle, gint offset, GSeekType type) -{ - GIOSSLChannel *chan = (GIOSSLChannel *)handle; - GIOError e; - e = g_io_channel_seek(chan->giochan, offset, type); - return (e == G_IO_ERROR_NONE) ? G_IO_ERROR_NONE : G_IO_ERROR_INVAL; -} - -static void irssi_ssl_close(GIOChannel *handle) -{ - GIOSSLChannel *chan = (GIOSSLChannel *)handle; - g_io_channel_close(chan->giochan); -} - -static guint irssi_ssl_create_watch(GIOChannel *handle, gint priority, GIOCondition cond, - GIOFunc func, gpointer data, GDestroyNotify notify) -{ - GIOSSLChannel *chan = (GIOSSLChannel *)handle; - - return chan->giochan->funcs->io_add_watch(handle, priority, cond, func, data, notify); -} - -/* ssl function pointers */ -static GIOFuncs irssi_ssl_channel_funcs = -{ - irssi_ssl_read, - irssi_ssl_write, - irssi_ssl_seek, - irssi_ssl_close, - irssi_ssl_create_watch, - irssi_ssl_free -}; - -#else /* GLIB_MAJOR_VERSION < 2 */ - static GIOStatus ssl_errno(gint e) { switch(e) @@ -383,8 +243,6 @@ static GIOFuncs irssi_ssl_channel_funcs = { irssi_ssl_get_flags }; -#endif - static gboolean irssi_ssl_init(void) { SSL_library_init(); diff --git a/src/core/nicklist.c b/src/core/nicklist.c index ced72ccb..aa42b7fa 100644 --- a/src/core/nicklist.c +++ b/src/core/nicklist.c @@ -356,14 +356,6 @@ GSList *nicklist_get_same_unique(SERVER_REC *server, void *id) return rec.list; } -#if GLIB_MAJOR_VERSION < 2 -/* glib1 doesn't have g_slist_sort_with_data, so non-standard prefixes won't be sorted correctly */ -int nicklist_compare_glib1(NICK_REC *p1, NICK_REC *p2) -{ - return nicklist_compare(p1, p2, NULL); -} -#endif - /* nick record comparision for sort functions */ int nicklist_compare(NICK_REC *p1, NICK_REC *p2, const char *nick_prefix) { diff --git a/src/core/nicklist.h b/src/core/nicklist.h index 1688fe58..7712af65 100644 --- a/src/core/nicklist.h +++ b/src/core/nicklist.h @@ -49,9 +49,6 @@ void nicklist_update_flags_unique(SERVER_REC *server, void *id, void nicklist_set_own(CHANNEL_REC *channel, NICK_REC *nick); /* Nick record comparison for sort functions */ -#if GLIB_MAJOR_VERSION < 2 -int nicklist_compare_glib1(NICK_REC *p1, NICK_REC *p2); -#endif int nicklist_compare(NICK_REC *p1, NICK_REC *p2, const char *nick_prefix); /* Check is `msg' is meant for `nick'. */ diff --git a/src/core/recode.c b/src/core/recode.c index 65cf7e08..a2ff2e26 100644 --- a/src/core/recode.c +++ b/src/core/recode.c @@ -32,11 +32,7 @@ static gboolean recode_get_charset(const char **charset) /* we use the same test as in src/fe-text/term.c:123 */ return (g_strcasecmp(*charset, "utf-8") == 0); -#ifdef HAVE_GLIB2 return g_get_charset(charset); -#else - return FALSE; -#endif } gboolean is_utf8(void) @@ -46,7 +42,6 @@ gboolean is_utf8(void) return recode_get_charset(&charset); } -#ifdef HAVE_GLIB2 static gboolean is_translit(const char *charset) { char *pos; @@ -54,11 +49,9 @@ static gboolean is_translit(const char *charset) pos = stristr(charset, "//translit"); return (pos != NULL); } -#endif gboolean is_valid_charset(const char *charset) { -#ifdef HAVE_GLIB2 const char *from="UTF-8"; const char *str="irssi"; char *recoded, *to = NULL; @@ -75,11 +68,6 @@ gboolean is_valid_charset(const char *charset) g_free(recoded); g_free(to); return valid; -#else - if (!charset || *charset =='\0') - return FALSE; - return TRUE; -#endif } static char *find_conversion(const SERVER_REC *server, const char *target) @@ -100,7 +88,6 @@ static char *find_conversion(const SERVER_REC *server, const char *target) char *recode_in(const SERVER_REC *server, const char *str, const char *target) { -#ifdef HAVE_GLIB2 const char *from = NULL; const char *to = NULL; char *translit_to = NULL; @@ -162,14 +149,10 @@ char *recode_in(const SERVER_REC *server, const char *str, const char *target) } g_free(translit_to); return recoded; -#else - return g_strdup(str); -#endif } char *recode_out(const SERVER_REC *server, const char *str, const char *target) { -#ifdef HAVE_GLIB2 char *recoded = NULL; const char *from = NULL; const char *to = NULL; @@ -205,9 +188,6 @@ char *recode_out(const SERVER_REC *server, const char *str, const char *target) recoded = g_strdup(str); return recoded; -#else - return g_strdup(str); -#endif } void recode_init(void) diff --git a/src/core/session.c b/src/core/session.c index 5e0318da..d118e8f1 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -37,54 +37,6 @@ char *irssi_binary = NULL; static char **session_args; -#ifndef HAVE_GLIB2 -static char *g_find_program_in_path(const char *path) -{ - const char *envpath; - char **paths, **tmp; - char *str; - char *result = NULL; - - if (g_path_is_absolute(path)) { - /* full path - easy */ - if(access(path, X_OK) == -1) - return NULL; - else - return g_strdup(path); - } - - if (strchr(path, G_DIR_SEPARATOR) != NULL) { - /* relative path */ - str = g_get_current_dir(); - result = g_strconcat(str, G_DIR_SEPARATOR_S, path, NULL); - g_free(str); - if (access(result, X_OK) == -1) { - g_free(result); - return NULL; - } - else - return result; - } - - /* we'll need to find it from path. */ - envpath = g_getenv("PATH"); - if (envpath == NULL) return NULL; - - paths = g_strsplit(envpath, ":", -1); - for (tmp = paths; *tmp != NULL; tmp++) { - str = g_strconcat(*tmp, G_DIR_SEPARATOR_S, path, NULL); - if (access(str, X_OK) == 0) { - result = str; - break; - } - g_free(str); - } - g_strfreev(paths); - - return result; -} -#endif - void session_set_binary(const char *path) { g_free_and_null(irssi_binary); |