2 * Copyright (C) 1998 Peter Zelezny.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 #include <sys/types.h>
33 #include "util.h" /* token_foreach */
45 int loginmode
; /* default authentication type */
48 static const struct defaultserver def
[] =
54 {0, "irc.7-indonesia.org"},
57 {0, "irc.accessirc.net"},
58 {0, "eu.accessirc.net"},
61 {0, "irc.afternet.org"},
62 {0, "us.afternet.org"},
63 {0, "eu.afternet.org"},
68 {0, "irc6.ktu.lt/+7668"},
70 {0, "irc6.ktu.lt/7666"},
73 {0, "irc.data.lt/+6668"},
74 {0, "irc-ssl.omnitel.net/+6668"},
75 {0, "irc-ssl.le.lt/+9999"},
78 {0, "irc.omnitel.net"},
86 {0, "irc.amiganet.org"},
87 {0, "us.amiganet.org"},
88 {0, "uk.amiganet.org"},
89 /* {0, "no.amiganet.org"},
90 {0, "au.amiganet.org"},*/
93 {0, "se1.arcnet.vapor.com"},
94 {0, "us1.arcnet.vapor.com"},
95 {0, "us2.arcnet.vapor.com"},
96 {0, "us3.arcnet.vapor.com"},
97 {0, "ca1.arcnet.vapor.com"},
98 {0, "de1.arcnet.vapor.com"},
99 {0, "de3.arcnet.vapor.com"},
100 {0, "ch1.arcnet.vapor.com"},
101 {0, "be1.arcnet.vapor.com"},
102 {0, "nl3.arcnet.vapor.com"},
103 {0, "uk1.arcnet.vapor.com"},
104 {0, "uk2.arcnet.vapor.com"},
105 /* {0, "uk3.arcnet.vapor.com"},*/
106 {0, "fr1.arcnet.vapor.com"},
109 {0, "irc.astrolink.org"},
112 {0, "au.austnet.org"},
113 {0, "us.austnet.org"},
114 {0, "ca.austnet.org"},
117 {0, "irc.axenet.org"},
118 {0, "angel.axenet.org"},
119 {0, "energy.axenet.org"},
120 {0, "python.axenet.org"},*/
123 {0, "irc.azzurra.org"},
124 {0, "crypto.azzurra.org"},
127 {0, "irc.beirut.com"},
130 {0, "irc.chattingaway.com"},
132 {"ChatJunkies", 0, "#xchat"},
133 {0, "irc.chatjunkies.org"},
134 {0, "nl.chatjunkies.org"},
137 {0, "US.ChatNet.Org"},
138 {0, "EU.ChatNet.Org"},
141 {0, "us.chatsociety.net"},
142 {0, "eu.chatsociety.net"},
145 {0, "irc.chatspike.net"},
148 {0, "irc.coolchat.net"},
149 /* {0, "unix.coolchat.net"},
150 {0, "toronto.coolchat.net"},*/
153 {0, "irc.criten.net"},
154 {0, "irc.eu.criten.net"},
158 {0, "irc.eu.dal.net"},
161 {0, "irc.d-t-net.de"},
162 {0, "bw.d-t-net.de"},
163 {0, "nc.d-t-net.de"},
164 {0, "wakka.d-t-net.de"},
167 {0, "irc.darkmyst.org"},
170 {0, "irc.deepirc.net"},
173 {0, "irc.deltaanime.net"},
176 {0, "irc.blackened.com"},
177 {0, "irc.Prison.NET"},
178 {0, "irc.Qeast.net"},
180 {0, "efnet.demon.co.uk"},
181 /* {0, "irc.lagged.org"},*/
182 {0, "irc.lightning.net"},
183 {0, "irc.mindspring.com"},
184 {0, "irc.easynews.com"},
185 {0, "irc.servercentral.net"},
188 {0, "IRC.EnterTheGame.Com"},
191 {0, "irc.euirc.net"},
192 {0, "irc.ham.de.euirc.net"},
193 {0, "irc.ber.de.euirc.net"},
194 {0, "irc.ffm.de.euirc.net"},
195 {0, "irc.bre.de.euirc.net"},
196 {0, "irc.hes.de.euirc.net"},
197 {0, "irc.vie.at.euirc.net"},
198 {0, "irc.inn.at.euirc.net"},
199 {0, "irc.bas.ch.euirc.net"},
202 {0, "irc.europnet.org"},
205 {0, "irc.eu-irc.net"},
208 {0, "irc.fdfnet.net"},
209 {0, "irc.eu.fdfnet.net"},
214 {0, "irc.vendetta.com"},
216 {"freenode", 0, "#xchat", 0, LOGIN_SASL
},
217 {0, "irc.freenode.net"},
220 {0, "kabel.freeworld.nu"},
221 {0, "irc.freeworld.nu"},*/
224 {0, "irc.galaxynet.org"},
225 /* {0, "sprynet.us.galaxynet.org"},
226 {0, "atlanta.ga.us.galaxynet.org"},*/
229 {0, "irc.gamesnet.net"},
230 /* {0, "irc.us.gamesnet.net"},
231 {0, "east.us.gamesnet.net"},
232 {0, "west.us.gamesnet.net"},*/
233 {0, "irc.ca.gamesnet.net"},
234 {0, "irc.eu.gamesnet.net"},
237 {0, "irc.geekshed.net"},
240 {0, "dominion.german-elite.net"},
241 {0, "komatu.german-elite.net"},
242 /* {0, "liberty.german-elite.net"},*/
246 /* {0, "irc.au.gimp.org"},*/
247 {0, "irc.us.gimp.org"},
250 {0, "irc.habber.net"},
253 {0, "irc.hashmark.net"},
256 {0, "irc.idlemonkeys.net"},
258 /* {"Infinity-IRC", 0},
259 {0, "Atlanta.GA.US.Infinity-IRC.Org"},
260 {0, "Babylon.NY.US.Infinity-IRC.Org"},
261 {0, "Sunshine.Ca.US.Infinity-IRC.Org"},
262 {0, "IRC.Infinity-IRC.Org"},*/
265 {0, "irc.iZ-smart.net/6666"},
266 {0, "irc.iZ-smart.net/6667"},
267 {0, "irc.iZ-smart.net/6668"},
270 {0, "irc.irclink.net"},
271 {0, "Alesund.no.eu.irclink.net"},
272 {0, "Oslo.no.eu.irclink.net"},
273 {0, "frogn.no.eu.irclink.net"},
274 {0, "tonsberg.no.eu.irclink.net"},
277 {0, "irc.ircnet.com"},
278 {0, "irc.stealth.net/6668"},
279 {0, "ircnet.demon.co.uk"},
280 /* {0, "ircnet.hinet.hr"},*/
281 {0, "irc.datacomm.ch"},
282 /* {0, "ircnet.kaptech.fr"},
283 {0, "ircnet.easynet.co.uk"},*/
284 {0, "random.ircd.de"},
285 {0, "ircnet.netvision.net.il"},
286 /* {0, "irc.seed.net.tw"},*/
287 {0, "irc.cs.hut.fi"},
290 {0, "irc.irctoo.net"},
293 {0, "irc.krstarica.com"},
296 {0, "irc.librenet.net"},
297 {0, "ielf.fr.librenet.net"},
300 {0, "irc.link-net.org"},
301 {0, "irc.no.link-net.org"},
302 /* {0, "irc.gamesden.net.au"},*/
303 {0, "irc.bahnhof.se"},
304 /* {0, "irc.kinexuseurope.co.uk"},
305 {0, "irc.gamiix.com"},*/
308 {0, "irc.magicstar.net"},
311 {0, "irc.majistic.net"},
314 {0, "irc.mindforge.org"},
317 {0, "irc.mintirc.net"},
320 {0, "irc.mixxnet.net"},
323 {0, "irc.nevernet.net"},
324 {0, "imagine.nevernet.net"},
325 {0, "dimension.nevernet.net"},
326 {0, "universe.nevernet.net"},
327 {0, "wayland.nevernet.net"},
328 {0, "forte.nevernet.net"},
331 {0, "irc.nixhelp.org"},
332 {0, "us.nixhelp.org"},
333 {0, "uk.nixhelp.org"},
334 {0, "uk2.nixhelp.org"},
335 {0, "uk3.nixhelp.org"},
336 {0, "nl.nixhelp.org"},
337 {0, "ca.ld.nixhelp.org"},
338 {0, "us.co.nixhelp.org"},
339 {0, "us.ca.nixhelp.org"},
340 {0, "us.pa.nixhelp.org"},
343 {0, "irc.nullus.net"},
346 {0, "irc.oceanius.com"},
352 {0, "irc.othernet.org"},
361 {0, "irc.PTlink.net"},
362 {0, "aaia.PTlink.net"},
365 {0, "irc.PTNet.org"},
366 {0, "world.PTnet.org"},
367 {0, "netvisao.PTnet.org"},
368 {0, "uevora.PTnet.org"},
369 {0, "vianetworks.PTnet.org"},
371 {0, "nfsi.ptnet.org"},
373 {"QuakeNet", 0, 0, 0, LOGIN_CHALLENGEAUTH
},
374 {0, "irc.quakenet.org"},
375 {0, "irc.se.quakenet.org"},
376 {0, "irc.dk.quakenet.org"},
377 {0, "irc.no.quakenet.org"},
378 {0, "irc.fi.quakenet.org"},
379 {0, "irc.be.quakenet.org"},
380 {0, "irc.uk.quakenet.org"},
381 {0, "irc.de.quakenet.org"},
382 {0, "irc.it.quakenet.org"},
385 {0, "irc.rebelchat.org"},
387 /* {"Recycled-IRC", 0},
388 {0, "irc.recycled-irc.org"},
389 {0, "vermin.recycled-irc.org"},
390 {0, "waste.recycled-irc.org"},
391 {0, "lumber.recycled-irc.org"},
392 {0, "trash.recycled-irc.org"},
393 {0, "unwashed.recycled-irc.org"},
394 {0, "garbage.recycled-irc.org"},
395 {0, "dustbin.recycled-irc.org"},*/
398 {0, "irc.rizenet.org"},
399 {0, "omega.rizenet.org"},
400 {0, "evelance.rizenet.org"},
401 {0, "lisa.rizenet.org"},
402 {0, "scott.rizenet.org"},
405 {0, "irc.rizon.net"},
407 {"RusNet", 0, 0, "KOI8-R (Cyrillic)"},
408 {0, "irc.tomsk.net"},
412 {0, "irc.lucky.net"},
415 {0, "irc.scene.org"},
416 {0, "irc.eu.scene.org"},
417 {0, "irc.us.scene.org"},
420 {0, "irc.seilen.de"},
423 {0, "irc.slashnet.org"},
424 {0, "area51.slashnet.org"},
425 {0, "moo.slashnet.org"},
426 {0, "radon.slashnet.org"},
429 {0, "irc.sohbet.net"},
432 {0, "irc.solidirc.com"},
435 {0, "irc.sorcery.net/9000"},
436 {0, "irc.us.sorcery.net/9000"},
437 {0, "irc.eu.sorcery.net/9000"},
440 {0, "us.spidernet.org"},
441 {0, "eu.spidernet.org"},
442 {0, "irc.spidernet.org"},
445 {0, "irc.starchat.net"},
446 {0, "gainesville.starchat.net"},
447 {0, "freebsd.starchat.net"},
448 {0, "sunset.starchat.net"},
449 {0, "revenge.starchat.net"},
450 {0, "tahoma.starchat.net"},
451 {0, "neo.starchat.net"},
457 {0, "irc.turli.net"},
459 {0, "irc.gavnos.ru"},
462 {0, "us.undernet.org"},
463 {0, "eu.undernet.org"},
465 {"UniBG", 0, 0, 0, LOGIN_MSG_NS
},
466 {0, "irc.lirex.com"},
467 {0, "irc.naturella.com"},
468 {0, "irc.spnet.net"},
469 {0, "irc.techno-link.com"},
470 {0, "irc.telecoms.bg"},
471 {0, "irc.tu-varna.edu"},
474 {0, "irc.whiffle.org"},
477 {0, "irc.worldnet.net"},
478 {0, "irc.fr.worldnet.net"},
481 {0, "irc.xentonix.net"},
484 {0, "Buffalo.NY.US.XWorld.org"},
485 {0, "Minneapolis.MN.US.Xworld.Org"},
486 {0, "Rochester.NY.US.XWorld.org"},
487 {0, "Bayern.DE.EU.XWorld.Org"},
488 {0, "Chicago.IL.US.XWorld.Org"},
493 GSList
*network_list
= 0;
497 servlist_connect (session
*sess
, ircnet
*net
, gboolean join
)
505 sess
= new_ircwindow (NULL
, NULL
, SESS_SERVER
, TRUE
);
509 /* connect to the currently selected Server-row */
510 list
= g_slist_nth (net
->servlist
, net
->selected
);
512 list
= net
->servlist
;
515 ircserv
= list
->data
;
517 /* incase a protocol switch is added to the servlist gui */
518 server_fill_her_up (sess
->server
);
522 sess
->willjoinchannel
[0] = 0;
527 free (serv
->autojoin
);
528 serv
->autojoin
= strdup (net
->autojoin
);
534 serv
->loginmethod
= net
->logintype
;
538 serv
->loginmethod
= LOGIN_DEFAULT_REAL
;
541 serv
->password
[0] = 0;
544 safe_strcpy (serv
->password
, net
->pass
, sizeof (serv
->password
));
546 if (net
->flags
& FLAG_USE_GLOBAL
)
548 strcpy (serv
->nick
, prefs
.nick1
);
552 strcpy (serv
->nick
, net
->nick
);
556 serv
->dont_use_proxy
= (net
->flags
& FLAG_USE_PROXY
) ? FALSE
: TRUE
;
559 serv
->use_ssl
= (net
->flags
& FLAG_USE_SSL
) ? TRUE
: FALSE
;
560 serv
->accept_invalid_cert
=
561 (net
->flags
& FLAG_ALLOW_INVALID
) ? TRUE
: FALSE
;
566 port
= strrchr (ircserv
->hostname
, '/');
571 /* support "+port" to indicate SSL (like mIRC does) */
575 serv
->use_ssl
= TRUE
;
577 serv
->connect (serv
, ircserv
->hostname
, atoi (port
+ 2), FALSE
);
580 serv
->connect (serv
, ircserv
->hostname
, atoi (port
+ 1), FALSE
);
585 serv
->connect (serv
, ircserv
->hostname
, -1, FALSE
);
587 server_set_encoding (serv
, net
->encoding
);
591 servlist_connect_by_netname (session
*sess
, char *network
, gboolean join
)
594 GSList
*list
= network_list
;
600 if (strcasecmp (net
->name
, network
) == 0)
602 servlist_connect (sess
, net
, join
);
613 servlist_have_auto (void)
615 GSList
*list
= network_list
;
622 if (net
->flags
& FLAG_AUTO_CONNECT
)
632 servlist_auto_connect (session
*sess
)
634 GSList
*list
= network_list
;
642 if (net
->flags
& FLAG_AUTO_CONNECT
)
644 servlist_connect (sess
, net
, TRUE
);
655 servlist_cycle_cb (server
*serv
)
659 PrintTextf (serv
->server_session
,
660 _("Cycling to next server in %s...\n"), ((ircnet
*)serv
->network
)->name
);
661 servlist_connect (serv
->server_session
, serv
->network
, TRUE
);
668 servlist_cycle (server
*serv
)
676 max
= g_slist_length (net
->servlist
);
679 /* try the next server, if that option is on */
680 if (net
->flags
& FLAG_CYCLE
)
683 if (net
->selected
>= max
)
687 del
= prefs
.recon_delay
* 1000;
689 del
= 500; /* so it doesn't block the gui */
692 serv
->recondelay_tag
= fe_timeout_add (del
, servlist_cycle_cb
, serv
);
694 servlist_connect (serv
->server_session
, net
, TRUE
);
704 servlist_server_find (ircnet
*net
, char *name
, int *pos
)
706 GSList
*list
= net
->servlist
;
713 if (strcmp (serv
->hostname
, name
) == 0)
726 /* find a network (e.g. (ircnet *) to "FreeNode") from a hostname
727 (e.g. "irc.eu.freenode.net") */
730 servlist_net_find_from_server (char *server_name
)
732 GSList
*list
= network_list
;
741 slist
= net
->servlist
;
745 if (strcasecmp (serv
->hostname
, server_name
) == 0)
757 servlist_net_find (char *name
, int *pos
, int (*cmpfunc
) (const char *, const char *))
759 GSList
*list
= network_list
;
766 if (cmpfunc (net
->name
, name
) == 0)
780 servlist_server_add (ircnet
*net
, char *name
)
784 serv
= malloc (sizeof (ircserver
));
785 memset (serv
, 0, sizeof (ircserver
));
786 serv
->hostname
= strdup (name
);
788 net
->servlist
= g_slist_append (net
->servlist
, serv
);
794 servlist_server_remove (ircnet
*net
, ircserver
*serv
)
796 free (serv
->hostname
);
798 net
->servlist
= g_slist_remove (net
->servlist
, serv
);
802 servlist_server_remove_all (ircnet
*net
)
806 while (net
->servlist
)
808 serv
= net
->servlist
->data
;
809 servlist_server_remove (net
, serv
);
814 free_and_clear (char *str
)
825 /* executed on exit: Clear any password strings */
828 servlist_cleanup (void)
833 for (list
= network_list
; list
; list
= list
->next
)
836 free_and_clear (net
->pass
);
841 servlist_net_remove (ircnet
*net
)
846 servlist_server_remove_all (net
);
847 network_list
= g_slist_remove (network_list
, net
);
857 free_and_clear (net
->pass
);
859 free (net
->autojoin
);
865 free (net
->encoding
);
874 if (serv
->network
== net
)
875 serv
->network
= NULL
;
881 servlist_net_add (char *name
, char *comment
, int prepend
)
885 net
= malloc (sizeof (ircnet
));
886 memset (net
, 0, sizeof (ircnet
));
887 net
->name
= strdup (name
);
888 /* net->comment = strdup (comment);*/
889 net
->flags
= FLAG_CYCLE
| FLAG_USE_GLOBAL
| FLAG_USE_PROXY
;
892 network_list
= g_slist_prepend (network_list
, net
);
894 network_list
= g_slist_append (network_list
, net
);
900 servlist_load_defaults (void)
909 net
= servlist_net_add (def
[i
].network
, def
[i
].host
, FALSE
);
910 net
->encoding
= strdup ("UTF-8 (Unicode)");
912 net
->autojoin
= strdup (def
[i
].channel
);
915 free (net
->encoding
);
916 net
->encoding
= strdup (def
[i
].charset
);
918 if (def
[i
].loginmode
)
920 net
->logintype
= def
[i
].loginmode
;
922 if (g_str_hash (def
[i
].network
) == 0x8e1b96f7)
923 prefs
.slist_select
= j
;
927 servlist_server_add (net
, def
[i
].host
);
928 if (!def
[i
+1].host
&& !def
[i
+1].network
)
944 fp
= xchat_fopen_file ("servlist_.conf", "r", 0);
948 while (fgets (buf
, sizeof (buf
) - 2, fp
))
952 buf
[len
-1] = 0; /* remove the trailing \n */
958 net
->nick
= strdup (buf
+ 2);
961 net
->nick2
= strdup (buf
+ 2);
964 net
->user
= strdup (buf
+ 2);
967 net
->real
= strdup (buf
+ 2);
970 net
->pass
= strdup (buf
+ 2);
973 net
->autojoin
= strdup (buf
+ 2);
978 /* concat extra commands with a \n separator */
980 net
->command
= malloc (strlen (tmp
) + strlen (buf
+ 2) + 2);
981 strcpy (net
->command
, tmp
);
982 strcat (net
->command
, "\n");
983 strcat (net
->command
, buf
+ 2);
986 net
->command
= strdup (buf
+ 2);
989 net
->flags
= atoi (buf
+ 2);
992 net
->selected
= atoi (buf
+ 2);
995 net
->encoding
= strdup (buf
+ 2);
997 case 'S': /* new server/hostname for this network */
998 servlist_server_add (net
, buf
+ 2);
1001 net
->logintype
= atoi (buf
+ 2);
1006 net
= servlist_net_add (buf
+ 2, /* comment */ NULL
, FALSE
);
1014 servlist_init (void)
1017 if (!servlist_load ())
1018 servlist_load_defaults ();
1021 /* check if a charset is known by Iconv */
1023 servlist_check_encoding (char *charset
)
1028 c
= strchr (charset
, ' ');
1032 if (!strcasecmp (charset
, "IRC")) /* special case */
1039 gic
= g_iconv_open (charset
, "UTF-8");
1044 if (gic
!= (GIConv
)-1)
1046 g_iconv_close (gic
);
1054 servlist_write_ccmd (char *str
, void *fp
)
1056 return fprintf (fp
, "C=%s\n", (str
[0] == '/') ? str
+ 1 : str
);
1061 servlist_save (void)
1071 snprintf (buf
, sizeof (buf
), "%s/servlist_.conf", get_xdir_fs ());
1072 if (access (buf
, F_OK
) != 0)
1075 fp
= xchat_fopen_file ("servlist_.conf", "w", 0);
1082 fprintf (fp
, "v="PACKAGE_VERSION
"\n\n");
1084 list
= network_list
;
1089 fprintf (fp
, "N=%s\n", net
->name
);
1091 fprintf (fp
, "I=%s\n", net
->nick
);
1093 fprintf (fp
, "i=%s\n", net
->nick2
);
1095 fprintf (fp
, "U=%s\n", net
->user
);
1097 fprintf (fp
, "R=%s\n", net
->real
);
1099 fprintf (fp
, "P=%s\n", net
->pass
);
1101 fprintf (fp
, "J=%s\n", net
->autojoin
);
1103 fprintf (fp
, "L=%d\n", net
->logintype
);
1104 if (net
->encoding
&& strcasecmp (net
->encoding
, "System") &&
1105 strcasecmp (net
->encoding
, "System default"))
1107 fprintf (fp
, "E=%s\n", net
->encoding
);
1108 if (!servlist_check_encoding (net
->encoding
))
1110 snprintf (buf
, sizeof (buf
), _("Warning: \"%s\" character set is unknown. No conversion will be applied for network %s."),
1111 net
->encoding
, net
->name
);
1112 fe_message (buf
, FE_MSG_WARN
);
1117 token_foreach (net
->command
, '\n', servlist_write_ccmd
, fp
);
1119 fprintf (fp
, "F=%d\nD=%d\n", net
->flags
, net
->selected
);
1121 hlist
= net
->servlist
;
1125 fprintf (fp
, "S=%s\n", serv
->hostname
);
1126 hlist
= hlist
->next
;
1129 if (fprintf (fp
, "\n") < 1)
1143 joinlist_free1 (GSList
*list
)
1145 GSList
*head
= list
;
1147 for (; list
; list
= list
->next
)
1148 g_free (list
->data
);
1149 g_slist_free (head
);
1153 joinlist_free (GSList
*channels
, GSList
*keys
)
1155 joinlist_free1 (channels
);
1156 joinlist_free1 (keys
);
1160 joinlist_is_in_list (server
*serv
, char *channel
)
1162 GSList
*channels
, *keys
;
1165 if (!serv
->network
|| !((ircnet
*)serv
->network
)->autojoin
)
1168 joinlist_split (((ircnet
*)serv
->network
)->autojoin
, &channels
, &keys
);
1170 for (list
= channels
; list
; list
= list
->next
)
1172 if (serv
->p_cmp (list
->data
, channel
) == 0)
1176 joinlist_free (channels
, keys
);
1182 joinlist_merge (GSList
*channels
, GSList
*keys
)
1184 GString
*out
= g_string_new (NULL
);
1188 for (; channels
; channels
= channels
->next
)
1190 g_string_append (out
, channels
->data
);
1193 g_string_append_c (out
, ',');
1196 /* count number of REAL keys */
1197 for (i
= 0, list
= keys
; list
; list
= list
->next
)
1203 g_string_append_c (out
, ' ');
1205 for (j
= 0; keys
; keys
= keys
->next
)
1209 g_string_append (out
, keys
->data
);
1216 g_string_append_c (out
, ',');
1220 return g_string_free (out
, FALSE
);
1224 joinlist_split (char *autojoin
, GSList
**channels
, GSList
**keys
)
1226 char *parta
, *partb
;
1233 /* after the first space, the keys begin */
1235 partb
= strchr (autojoin
, ' ');
1246 while (parta
[0] != 0 && parta
[0] != ',' && parta
[0] != ' ')
1254 while (partb
[0] != 0 && partb
[0] != ',' && partb
[0] != ' ')
1263 *channels
= g_slist_append (*channels
, g_strndup (chan
, len
));
1266 *keys
= g_slist_append (*keys
, len
? g_strndup (key
, len
) : NULL
);
1268 if (parta
[0] == ' ' || parta
[0] == 0)
1274 if (partb
[0] == 0 || partb
[0] == ' ')
1275 partb
= NULL
; /* no more keys, but maybe more channels? */
1282 GSList
*lista
, *listb
;
1291 printf("%d. |%s| |%s|\n", i
, lista
->data
, listb
->data
);
1293 lista
= lista
->next
;
1294 listb
= listb
->next
;
1296 printf("-----\n\n");