]> Git — Sourcephile - julm/julm-nix.git/blob - nixpkgs/overlays/irssi/irssi-connection-set-key.patch
hardware: add T480
[julm/julm-nix.git] / nixpkgs / overlays / irssi / irssi-connection-set-key.patch
1 diff --git a/src/core/servers.c b/src/core/servers.c
2 index 30fc684..83733d0 100644
3 --- a/src/core/servers.c
4 +++ b/src/core/servers.c
5 @@ -783,3 +783,53 @@ void servers_deinit(void)
6 module_uniq_destroy("SERVER");
7 module_uniq_destroy("SERVER CONNECT");
8 }
9 +
10 +int server_connection_set_key(SERVER_REC *server, char *key, char *value)
11 +{
12 + if (strcmp(key, "password") == 0) {
13 + g_free_not_null(server->connrec->password);
14 + server->connrec->password = g_strdup(value);
15 + }
16 + if (strcmp(key, "nick") == 0) {
17 + g_free_not_null(server->connrec->nick);
18 + server->connrec->nick = g_strdup(value);
19 + }
20 + else if (strcmp(key, "username") == 0) {
21 + g_free_not_null(server->connrec->username);
22 + server->connrec->username = g_strdup(value);
23 + }
24 + else if (strcmp(key, "realname") == 0) {
25 + g_free_not_null(server->connrec->realname);
26 + server->connrec->realname = g_strdup(value);
27 + }
28 + else if (strcmp(key, "tls_cert") == 0) {
29 + g_free_not_null(server->connrec->tls_cert);
30 + server->connrec->tls_cert = g_strdup(value);
31 + }
32 + else if (strcmp(key, "tls_pkey") == 0) {
33 + g_free_not_null(server->connrec->tls_pkey);
34 + server->connrec->tls_pkey = g_strdup(value);
35 + }
36 + else if (strcmp(key, "tls_cafile") == 0) {
37 + g_free_not_null(server->connrec->tls_cafile);
38 + server->connrec->tls_cafile = g_strdup(value);
39 + }
40 + else if (strcmp(key, "tls_capath") == 0) {
41 + g_free_not_null(server->connrec->tls_capath);
42 + server->connrec->tls_capath = g_strdup(value);
43 + }
44 + else if (strcmp(key, "use_tls") == 0) {
45 + server->connrec->use_tls = (strcmp(value, "no") != 0);
46 + }
47 + else if (strcmp(key, "tls_verify") == 0) {
48 + server->connrec->tls_verify = (strcmp(value, "no") != 0);
49 + }
50 + else if (strcmp(key, "resolve_prefer_ipv6") == 0) {
51 + server->connrec->family = (strcmp(value, "no") != 0);
52 + }
53 + else {
54 + return FALSE;
55 + }
56 + return TRUE;
57 +}
58 +
59 diff --git a/src/perl/common/Server.xs b/src/perl/common/Server.xs
60 index 60878a6..1b6d6d1 100644
61 --- a/src/perl/common/Server.xs
62 +++ b/src/perl/common/Server.xs
63 @@ -103,6 +103,12 @@ send_message(server, target, msg, target_type)
64 CODE:
65 server->send_message(server, target, msg, target_type);
66
67 +int
68 +server_connection_set_key(server, key, value)
69 + Irssi::Server server
70 + char *key
71 + char *value
72 +
73 void
74 server_meta_stash(server, meta_key, meta_value)
75 Irssi::Server server