summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-12-10 23:32:46 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-12-10 23:32:46 +0000
commit020861c698967b156c52473a91b2f61d2e965ee1 (patch)
tree6d91a40a66b41be6a9a4e6bcf8fb2df6fe4f94dd
parent3b8622f1aaa83f082286af6e4efbd648042fcfcb (diff)
downloadirssi-020861c698967b156c52473a91b2f61d2e965ee1.zip
Netsplit saved the NICK_REC, but didn't save the dynamically allocated strings
which were part of it. Removed it now and replaced it with saving only op/halfop/voice status. Might have caused some crashes? (hopefully did :) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2234 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-common/irc/fe-netsplit.c6
-rw-r--r--src/irc/bot/bot-events.c3
-rw-r--r--src/irc/core/netsplit.c11
-rw-r--r--src/irc/core/netsplit.h6
-rw-r--r--src/perl/irc/Irc.xs4
-rw-r--r--src/perl/irc/Netsplit.xs2
6 files changed, 20 insertions, 12 deletions
diff --git a/src/fe-common/irc/fe-netsplit.c b/src/fe-common/irc/fe-netsplit.c
index 300d3e43..821f2ea8 100644
--- a/src/fe-common/irc/fe-netsplit.c
+++ b/src/fe-common/irc/fe-netsplit.c
@@ -130,7 +130,7 @@ static void get_server_splits(void *key, NETSPLIT_REC *split,
chanrec->nick_count++;
if (netsplit_nicks_hide_threshold <= 0 ||
chanrec->nick_count <= netsplit_nicks_hide_threshold) {
- if (splitchan->nick.op)
+ if (splitchan->op)
g_string_append_c(chanrec->nicks, '@');
g_string_sprintfa(chanrec->nicks, "%s ", split->nick);
@@ -306,8 +306,8 @@ static void split_print(NETSPLIT_REC *rec)
chan = rec->channels->data;
chanstr = chan == NULL ? "" :
- g_strconcat(chan->nick.op ? "@" :
- (chan->nick.voice ? "+" : ""), chan->name, NULL);
+ g_strconcat(chan->op ? "@" :
+ (chan->voice ? "+" : ""), chan->name, NULL);
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETSPLITS_LINE,
rec->nick, chanstr, rec->server->server,
diff --git a/src/irc/bot/bot-events.c b/src/irc/bot/bot-events.c
index f00fc5f8..a03f2f21 100644
--- a/src/irc/bot/bot-events.c
+++ b/src/irc/bot/bot-events.c
@@ -89,7 +89,8 @@ static void event_massjoin(IRC_CHANNEL_REC *channel, GSList *users)
static void parse_channel_mode(IRC_CHANNEL_REC *channel, const char *mode,
const char *nick, const char *address)
{
- NICK_REC *nickrec, *splitnick;
+ NETSPLIT_CHAN_REC *splitnick;
+ NICK_REC *nickrec;
USER_REC *user;
GString *str;
char *ptr, *curmode, type, *dup, *modestr;
diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c
index 594f5f8e..397c10ba 100644
--- a/src/irc/core/netsplit.c
+++ b/src/irc/core/netsplit.c
@@ -132,7 +132,9 @@ static NETSPLIT_REC *netsplit_add(IRC_SERVER_REC *server, const char *nick,
splitchan = g_new0(NETSPLIT_CHAN_REC, 1);
splitchan->name = g_strdup(channel->name);
- memcpy(&splitchan->nick, nickrec, sizeof(NICK_REC));
+ splitchan->op = nickrec->op;
+ splitchan->halfop = nickrec->halfop;
+ splitchan->voice = nickrec->voice;
rec->channels = g_slist_append(rec->channels, splitchan);
}
@@ -190,8 +192,9 @@ NETSPLIT_REC *netsplit_find(IRC_SERVER_REC *server, const char *nick,
g_strcasecmp(rec->address, address) == 0) ? rec : NULL;
}
-NICK_REC *netsplit_find_channel(IRC_SERVER_REC *server, const char *nick,
- const char *address, const char *channel)
+NETSPLIT_CHAN_REC *netsplit_find_channel(IRC_SERVER_REC *server,
+ const char *nick, const char *address,
+ const char *channel)
{
NETSPLIT_REC *rec;
GSList *tmp;
@@ -207,7 +210,7 @@ NICK_REC *netsplit_find_channel(IRC_SERVER_REC *server, const char *nick,
NETSPLIT_CHAN_REC *rec = tmp->data;
if (g_strcasecmp(rec->name, channel) == 0)
- return &rec->nick;
+ return rec;
}
return NULL;
diff --git a/src/irc/core/netsplit.h b/src/irc/core/netsplit.h
index cce52e2a..9b28c9c6 100644
--- a/src/irc/core/netsplit.h
+++ b/src/irc/core/netsplit.h
@@ -25,14 +25,16 @@ typedef struct {
typedef struct {
char *name;
- NICK_REC nick;
+ unsigned int op:1;
+ unsigned int halfop:1;
+ unsigned int voice:1;
} NETSPLIT_CHAN_REC;
void netsplit_init(void);
void netsplit_deinit(void);
NETSPLIT_REC *netsplit_find(IRC_SERVER_REC *server, const char *nick, const char *address);
-NICK_REC *netsplit_find_channel(IRC_SERVER_REC *server, const char *nick, const char *address, const char *channel);
+NETSPLIT_CHAN_REC *netsplit_find_channel(IRC_SERVER_REC *server, const char *nick, const char *address, const char *channel);
/* check if quit message is a netsplit message */
int quitmsg_is_split(const char *msg);
diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs
index 554065bc..b0588cec 100644
--- a/src/perl/irc/Irc.xs
+++ b/src/perl/irc/Irc.xs
@@ -119,7 +119,9 @@ static void perl_netsplit_server_fill_hash(HV *hv, NETSPLIT_SERVER_REC *rec)
static void perl_netsplit_channel_fill_hash(HV *hv, NETSPLIT_CHAN_REC *rec)
{
hv_store(hv, "name", 4, new_pv(rec->name), 0);
- hv_store(hv, "nick", 4, iobject_bless(&rec->nick), 0);
+ hv_store(hv, "op", 2, newSViv(rec->op), 0);
+ hv_store(hv, "halfop", 6, newSViv(rec->halfop), 0);
+ hv_store(hv, "voice", 5, newSViv(rec->voice), 0);
}
static void perl_notifylist_fill_hash(HV *hv, NOTIFYLIST_REC *notify)
diff --git a/src/perl/irc/Netsplit.xs b/src/perl/irc/Netsplit.xs
index e4ef85e4..b0b1e523 100644
--- a/src/perl/irc/Netsplit.xs
+++ b/src/perl/irc/Netsplit.xs
@@ -9,7 +9,7 @@ netsplit_find(server, nick, address)
char *nick
char *address
-Irssi::Irc::Nick
+Irssi::Irc::Netsplitchannel
netsplit_find_channel(server, nick, address, channel)
Irssi::Irc::Server server
char *nick