static void msg_join(IRC_SERVER_REC *server, const char *channel, const char *nick, const char *address) { NETSPLIT_REC *split; NETJOIN_REC *netjoin; if (!IS_IRC_SERVER(server)) return; if (ignore_check(SERVER(server), nick, address, channel, NULL, MSGLEVEL_JOINS)) return; split = netsplit_find(server, nick, address); netjoin = netjoin_find(server, nick); if (split == NULL && netjoin == NULL) return; if (join_tag == -1) { join_tag = g_timeout_add(1000, (GSourceFunc) sig_check_netjoins, NULL); signal_add("print starting", (SIGNAL_FUNC) sig_print_starting); } if (netjoin == NULL) netjoin = netjoin_add(server, nick, split->channels); netjoin->now_channels = g_slist_append(netjoin->now_channels, g_strdup(channel)); signal_stop(); }
static void msg_join(IRC_SERVER_REC *server, const char *channel, const char *nick, const char *address) { NETSPLIT_REC *split; NETJOIN_REC *netjoin; GSList *channels; int rejoin = 1; if (!IS_IRC_SERVER(server)) return; if (ignore_check(SERVER(server), nick, address, channel, NULL, MSGLEVEL_JOINS)) return; split = netsplit_find(server, nick, address); netjoin = netjoin_find(server, nick); if (split == NULL && netjoin == NULL) return; /* if this was not a channel they split from, treat it normally */ if (netjoin != NULL) { if (!gslist_find_icase_string(netjoin->old_channels, channel)) return; } else { channels = split->channels; while (channels != NULL) { NETSPLIT_CHAN_REC *schannel = channels->data; if (!strcasecmp(schannel->name, channel)) break; channels = channels->next; } /* we still need to create a NETJOIN_REC now as the * NETSPLIT_REC will be destroyed */ if (channels == NULL) rejoin = 0; } if (join_tag == -1) { join_tag = g_timeout_add(1000, (GSourceFunc) sig_check_netjoins, NULL); signal_add("print starting", (SIGNAL_FUNC) sig_print_starting); } if (netjoin == NULL) netjoin = netjoin_add(server, nick, split->channels); if (rejoin) { netjoin->now_channels = g_slist_append(netjoin->now_channels, g_strconcat(" ", channel, NULL)); signal_stop(); } }
static void msg_mode(IRC_SERVER_REC *server, const char *channel, const char *sender, const char *addr, const char *data) { NETJOIN_REC *rec; char *params, *mode, *nicks; char **nicklist, **nick, type, modechr; int show; g_return_if_fail(data != NULL); if (!ischannel(*channel) || addr != NULL) return; params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &mode, &nicks); /* parse server mode changes - hide operator status changes and show them in the netjoin message instead as @ before the nick */ nick = nicklist = g_strsplit(nicks, " ", -1); type = '+'; show = FALSE; for (; *mode != '\0'; mode++) { if (*mode == '+' || *mode == '-') { type = *mode; continue; } if (*nick != NULL && isnickmode(*mode)) { /* give/remove ops */ rec = netjoin_find(server, *nick); modechr = nickmodechar(*mode); if (rec == NULL || type != '+' || modechr == '\0' || !netjoin_set_nickmode(rec, channel, modechr)) show = TRUE; nick++; } else { if (HAS_MODE_ARG(type, *mode) && *nick != NULL) nick++; show = TRUE; } } if (!show) signal_stop(); g_strfreev(nicklist); g_free(params); }