aboutsummaryrefslogtreecommitdiffstats
path: root/irc.c
diff options
context:
space:
mode:
Diffstat (limited to 'irc.c')
-rw-r--r--irc.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/irc.c b/irc.c
index e1928497..72253595 100644
--- a/irc.c
+++ b/irc.c
@@ -658,7 +658,7 @@ void irc_names( irc_t *irc, char *channel )
strcat( namelist, " " );
}
}
- else if( ( c = chat_by_channel( channel ) ) )
+ else if( ( c = irc_chat_by_channel( irc, channel ) ) )
{
GList *l;
@@ -811,7 +811,7 @@ void irc_topic( irc_t *irc, char *channel )
}
else
{
- struct groupchat *c = chat_by_channel( channel );
+ struct groupchat *c = irc_chat_by_channel( irc, channel );
if( c )
irc_reply( irc, 332, "%s :BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!", channel, c->title );
@@ -949,7 +949,7 @@ int irc_send( irc_t *irc, char *nick, char *s, int flags )
if( *nick == '#' || *nick == '&' )
{
- if( !( c = chat_by_channel( nick ) ) )
+ if( !( c = irc_chat_by_channel( irc, nick ) ) )
{
irc_reply( irc, 403, "%s :Channel does not exist", nick );
return( 0 );
@@ -1215,3 +1215,27 @@ static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond )
return TRUE;
}
+
+struct groupchat *irc_chat_by_channel( irc_t *irc, char *channel )
+{
+ struct groupchat *c;
+ account_t *a;
+
+ /* This finds the connection which has a conversation which belongs to this channel */
+ for( a = irc->accounts; a; a = a->next )
+ {
+ if( a->ic == NULL )
+ continue;
+
+ c = a->ic->groupchats;
+ while( c )
+ {
+ if( c->channel && g_strcasecmp( c->channel, channel ) == 0 )
+ return c;
+
+ c = c->next;
+ }
+ }
+
+ return NULL;
+}