1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-23 06:35:36 +00:00

Compare commits

..

11 Commits

Author SHA1 Message Date
Gunter Labes
d3bb968311
Merge b19d6a31b2 into 5c15937554 2024-04-17 23:10:00 +02:00
ailin-nemui
5c15937554
Merge pull request #1525 from ailin-nemui/bans
fix /ban command
2024-04-12 21:18:39 +00:00
Ailin Nemui
19e7d3f6b8 up abi 2024-04-12 23:00:52 +02:00
Ailin Nemui
822fd50132 fix /ban command 2024-04-12 22:55:20 +02:00
ailin-nemui
4b48cdce65
Merge pull request #1523 from irssi/from-codeberg
From codeberg
2024-04-02 06:29:49 +00:00
ailin-nemui
c906b769fd
Merge pull request #1522 from dwfreed/fix-missing-nl
Ensure all text files have newlines at the end
2024-04-02 06:27:24 +00:00
Doug Freed
9d0787fc10 Ensure all files have newlines at the end 2024-04-02 05:23:10 +00:00
ailin-nemui
89f3e1acf5
Merge pull request #1519 from ailin-nemui/openssl3
deprecated openssl3 function
2024-04-01 20:36:00 +00:00
Ailin Nemui
455dcb18ec deprecated openssl3 function 2024-04-01 22:31:53 +02:00
ailin-nemui
215be29035 Merge pull request 'Fix github issue #1504 - irssi switches to af_unix if network name contains /' (!6) from ticho/irssi:gh1504 into master
Reviewed-on: https://codeberg.org/irssi/irssi/pulls/6
2024-04-01 08:42:17 +00:00
Andrej Kacian
e295caa866 Fix github issue #1504 - irssi switches to af_unix if network name contains /
In addition to looking for a /, we also check if the network name is
known.
2024-04-01 08:42:17 +00:00
12 changed files with 82 additions and 71 deletions

View File

@ -26,4 +26,4 @@ jobs:
if: failure() if: failure()
with: with:
name: git-clang-format.diff name: git-clang-format.diff
path: git-clang-format.diff path: git-clang-format.diff

View File

@ -17,4 +17,4 @@ jobs:
repo: 'irssi.github.io', repo: 'irssi.github.io',
workflow_id: 'pages.yml', workflow_id: 'pages.yml',
ref: 'main' ref: 'main'
}) })

View File

@ -162,4 +162,4 @@ server reconnections and irc network splits</li>
<li>placing channels and queries in windows</li> <li>placing channels and queries in windows</li>
<li>nick completion</li> <li>nick completion</li>
<li>printing infomation of some events</li> <li>printing infomation of some events</li>
</ul> </ul>

View File

@ -78,4 +78,4 @@
<h3 id="q-how-to-pronounce-irssi">Q: How to pronounce Irssi?</h3> <h3 id="q-how-to-pronounce-irssi">Q: How to pronounce Irssi?</h3>
<p>A: Check <a href="/assets/irssi.wav">here</a></p> <p>A: Check <a href="/assets/irssi.wav">here</a></p>

View File

@ -6,7 +6,7 @@
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
#define IRSSI_ABI_VERSION 53 #define IRSSI_ABI_VERSION 54
#define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_PORT 6667
#define DEFAULT_SERVER_ADD_TLS_PORT 6697 #define DEFAULT_SERVER_ADD_TLS_PORT 6697

View File

@ -30,6 +30,7 @@
#include <irssi/src/core/servers-setup.h> #include <irssi/src/core/servers-setup.h>
#include <irssi/src/core/servers-reconnect.h> #include <irssi/src/core/servers-reconnect.h>
#include <irssi/src/core/channels.h> #include <irssi/src/core/channels.h>
#include <irssi/src/core/chatnets.h>
#include <irssi/src/core/queries.h> #include <irssi/src/core/queries.h>
#include <irssi/src/core/window-item-def.h> #include <irssi/src/core/window-item-def.h>
#include <irssi/src/core/rawlog.h> #include <irssi/src/core/rawlog.h>
@ -91,7 +92,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
return NULL; return NULL;
} }
if (strchr(addr, '/') != NULL) if (strchr(addr, '/') != NULL && chatnet_find(addr) == NULL)
conn->unix_socket = TRUE; conn->unix_socket = TRUE;
/* TLS options are handled in server_create_conn_opt ... -> server_setup_fill_optlist */ /* TLS options are handled in server_create_conn_opt ... -> server_setup_fill_optlist */

View File

@ -28,6 +28,7 @@
#include <irssi/src/core/tls.h> #include <irssi/src/core/tls.h>
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include <openssl/objects.h>
#include <openssl/x509.h> #include <openssl/x509.h>
#include <openssl/x509v3.h> #include <openssl/x509v3.h>
#include <openssl/pem.h> #include <openssl/pem.h>
@ -751,44 +752,49 @@ static void set_server_temporary_key_info(TLS_REC *tls, SSL *ssl)
#ifdef SSL_get_server_tmp_key #ifdef SSL_get_server_tmp_key
/* Show ephemeral key information. */ /* Show ephemeral key information. */
EVP_PKEY *ephemeral_key = NULL; EVP_PKEY *ephemeral_key = NULL;
/* OPENSSL_NO_EC is for solaris 11.3 (2016), github ticket #598 */
#ifndef OPENSSL_NO_EC
EC_KEY *ec_key = NULL;
#endif
char *ephemeral_key_algorithm = NULL; char *ephemeral_key_algorithm = NULL;
char *cname = NULL;
int nid;
g_return_if_fail(tls != NULL); g_return_if_fail(tls != NULL);
g_return_if_fail(ssl != NULL); g_return_if_fail(ssl != NULL);
if (SSL_get_server_tmp_key(ssl, &ephemeral_key)) { if (SSL_get_server_tmp_key(ssl, &ephemeral_key)) {
switch (EVP_PKEY_id(ephemeral_key)) { int keytype = EVP_PKEY_id(ephemeral_key);
case EVP_PKEY_DH: switch (keytype) {
tls_rec_set_ephemeral_key_algorithm(tls, "DH"); case EVP_PKEY_DH:
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key)); tls_rec_set_ephemeral_key_algorithm(tls, "DH");
break; tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
break;
/* OPENSSL_NO_EC is for solaris 11.3 (2016), github ticket #598 */
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
case EVP_PKEY_EC: case EVP_PKEY_EC: {
ec_key = EVP_PKEY_get1_EC_KEY(ephemeral_key); #if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key)); char cname[50];
EC_KEY_free(ec_key); EVP_PKEY_get_group_name(ephemeral_key, cname, sizeof(cname), NULL);
cname = (char *)OBJ_nid2sn(nid); #else
ephemeral_key_algorithm = g_strdup_printf("ECDH: %s", cname); EC_KEY *ec_key = NULL;
char *cname = NULL;
int nid;
tls_rec_set_ephemeral_key_algorithm(tls, ephemeral_key_algorithm); ec_key = EVP_PKEY_get1_EC_KEY(ephemeral_key);
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key)); nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key));
EC_KEY_free(ec_key);
cname = (char *) OBJ_nid2sn(nid);
#endif
ephemeral_key_algorithm = g_strdup_printf("ECDH: %s", cname);
g_free_and_null(ephemeral_key_algorithm); tls_rec_set_ephemeral_key_algorithm(tls, ephemeral_key_algorithm);
break; tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
g_free_and_null(ephemeral_key_algorithm);
break;
}
#endif #endif
default: default:
tls_rec_set_ephemeral_key_algorithm(tls, "Unknown"); tls_rec_set_ephemeral_key_algorithm(tls, OBJ_nid2ln(keytype));
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key)); tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
break; break;
} }
EVP_PKEY_free(ephemeral_key); EVP_PKEY_free(ephemeral_key);

View File

@ -35,6 +35,7 @@
#include <irssi/src/fe-common/core/printtext.h> #include <irssi/src/fe-common/core/printtext.h>
#include <irssi/src/fe-common/core/fe-channels.h> #include <irssi/src/fe-common/core/fe-channels.h>
#include <irssi/src/fe-common/irc/fe-irc-server.h> #include <irssi/src/fe-common/irc/fe-irc-server.h>
#include <irssi/src/fe-common/irc/fe-irc-channels.h>
static void print_event_received(IRC_SERVER_REC *server, const char *data, static void print_event_received(IRC_SERVER_REC *server, const char *data,
const char *nick, int target_param); const char *nick, int target_param);
@ -138,38 +139,6 @@ static void event_end_of_who(IRC_SERVER_REC *server, const char *data)
g_free(params); g_free(params);
} }
/* Get time elapsed since an event */
static char *time_ago(time_t seconds)
{
static char ret[128];
long unsigned years, weeks, days, hours, minutes;
seconds = time(NULL) - seconds;
years = seconds / (86400 * 365);
seconds %= (86400 * 365);
weeks = seconds / 604800;
days = (seconds / 86400) % 7;
hours = (seconds / 3600) % 24;
minutes = (seconds / 60) % 60;
seconds %= 60;
if (years)
snprintf(ret, sizeof(ret), "%luy %luw %lud", years, weeks, days);
else if (weeks)
snprintf(ret, sizeof(ret), "%luw %lud %luh", weeks, days, hours);
else if (days)
snprintf(ret, sizeof(ret), "%lud %luh %lum", days, hours, minutes);
else if (hours)
snprintf(ret, sizeof(ret), "%luh %lum", hours, minutes);
else if (minutes)
snprintf(ret, sizeof(ret), "%lum %lus", minutes, (long unsigned) seconds);
else
snprintf(ret, sizeof(ret), "%lus", (long unsigned) seconds);
return ret;
}
static void event_ban_list(IRC_SERVER_REC *server, const char *data) static void event_ban_list(IRC_SERVER_REC *server, const char *data)
{ {
IRC_CHANNEL_REC *chanrec; IRC_CHANNEL_REC *chanrec;

View File

@ -73,6 +73,38 @@ const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target)
return target; return target;
} }
/* Get time elapsed since an event */
char *time_ago(time_t seconds)
{
static char ret[128];
long unsigned years, weeks, days, hours, minutes;
seconds = time(NULL) - seconds;
years = seconds / (86400 * 365);
seconds %= (86400 * 365);
weeks = seconds / 604800;
days = (seconds / 86400) % 7;
hours = (seconds / 3600) % 24;
minutes = (seconds / 60) % 60;
seconds %= 60;
if (years)
snprintf(ret, sizeof(ret), "%luy %luw %lud", years, weeks, days);
else if (weeks)
snprintf(ret, sizeof(ret), "%luw %lud %luh", weeks, days, hours);
else if (days)
snprintf(ret, sizeof(ret), "%lud %luh %lum", days, hours, minutes);
else if (hours)
snprintf(ret, sizeof(ret), "%luh %lum", hours, minutes);
else if (minutes)
snprintf(ret, sizeof(ret), "%lum %lus", minutes, (long unsigned) seconds);
else
snprintf(ret, sizeof(ret), "%lus", (long unsigned) seconds);
return ret;
}
static void sig_channel_rejoin(SERVER_REC *server, REJOIN_REC *rec) static void sig_channel_rejoin(SERVER_REC *server, REJOIN_REC *rec)
{ {
g_return_if_fail(rec != NULL); g_return_if_fail(rec != NULL);

View File

@ -3,6 +3,7 @@
int fe_channel_is_opchannel(IRC_SERVER_REC *server, const char *target); int fe_channel_is_opchannel(IRC_SERVER_REC *server, const char *target);
const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target); const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target);
char *time_ago(time_t seconds);
void fe_irc_channels_init(void); void fe_irc_channels_init(void);
void fe_irc_channels_deinit(void); void fe_irc_channels_deinit(void);

View File

@ -39,6 +39,7 @@
#include <irssi/src/fe-common/core/window-items.h> #include <irssi/src/fe-common/core/window-items.h>
#include <irssi/src/fe-common/core/printtext.h> #include <irssi/src/fe-common/core/printtext.h>
#include <irssi/src/fe-common/core/keyboard.h> #include <irssi/src/fe-common/core/keyboard.h>
#include <irssi/src/fe-common/irc/fe-irc-channels.h>
/* SYNTAX: ME <message> */ /* SYNTAX: ME <message> */
static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
@ -224,15 +225,16 @@ static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server)
/* show bans.. */ /* show bans.. */
counter = 1; counter = 1;
for (tmp = channel->banlist; tmp != NULL; tmp = tmp->next) { for (tmp = channel->banlist; tmp != NULL; tmp = tmp->next) {
char *timestr, *ago;
BAN_REC *rec = tmp->data; BAN_REC *rec = tmp->data;
timestr = my_asctime(rec->time);
ago = time_ago(rec->time);
printformat(server, channel->visible_name, MSGLEVEL_CRAP, printformat(server, channel->visible_name, MSGLEVEL_CRAP,
(rec->setby == NULL || *rec->setby == '\0') ? (rec->setby == NULL || *rec->setby == '\0') ? IRCTXT_BANLIST :
IRCTXT_BANLIST : IRCTXT_BANLIST_LONG, IRCTXT_BANLIST_LONG,
counter, channel->visible_name, counter, channel->visible_name, rec->ban, rec->setby, ago, timestr);
rec->ban, rec->setby, counter++;
(int) (time(NULL)-rec->time));
counter++;
} }
} }

View File

@ -24,4 +24,4 @@ void scram_session_free(SCRAM_SESSION_REC *session);
scram_status scram_process(SCRAM_SESSION_REC *session, const char *input, char **output, scram_status scram_process(SCRAM_SESSION_REC *session, const char *input, char **output,
size_t *output_len); size_t *output_len);
#endif #endif