diff options
-rw-r--r-- | irc_channel.c | 22 | ||||
-rw-r--r-- | irc_commands.c | 4 | ||||
-rw-r--r-- | protocols/jabber/iq.c | 4 | ||||
-rw-r--r-- | protocols/jabber/jabber.c | 2 | ||||
-rw-r--r-- | protocols/jabber/jabber.h | 2 | ||||
-rw-r--r-- | root_commands.c | 2 |
6 files changed, 30 insertions, 6 deletions
diff --git a/irc_channel.c b/irc_channel.c index c676afe6..54e68577 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -358,6 +358,26 @@ static gboolean control_channel_privmsg( irc_channel_t *ic, const char *msg ) return TRUE; } +static gboolean control_channel_invite( irc_channel_t *ic, irc_user_t *iu ) +{ + struct irc_control_channel *icc = ic->data; + bee_user_t *bu = iu->bu; + + if( bu == NULL ) + return FALSE; + + if( icc->type != IRC_CC_TYPE_GROUP ) + { + irc_send_num( ic->irc, 482, "%s :Invitations are only possible to fill_by=group channels", ic->name ); + return FALSE; + } + + bu->ic->acc->prpl->add_buddy( bu->ic, bu->handle, + icc->group ? icc->group->name : NULL ); + + return TRUE; +} + static char *set_eval_by_account( set_t *set, char *value ); static char *set_eval_fill_by( set_t *set, char *value ); static char *set_eval_by_group( set_t *set, char *value ); @@ -455,7 +475,7 @@ static const struct irc_channel_funcs control_channel_funcs = { NULL, NULL, NULL, - NULL, + control_channel_invite, control_channel_init, control_channel_free, diff --git a/irc_commands.c b/irc_commands.c index 6c425dee..ac851adf 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -402,8 +402,10 @@ static void irc_cmd_invite( irc_t *irc, char **cmd ) return; } - if( !ic->f->invite || !ic->f->invite( ic, iu ) ) + if( !ic->f->invite ) irc_send_num( irc, 482, "%s :Can't invite people here", cmd[2] ); + else if( ic->f->invite( ic, iu ) ) + irc_send_num( irc, 341, "%s %s", iu->nick, ic->name ); } static void irc_cmd_userhost( irc_t *irc, char **cmd ) diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 5166e322..2930e75f 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -554,7 +554,7 @@ static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_no static xt_status jabber_add_to_roster_callback( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); -int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name ) +int jabber_add_to_roster( struct im_connection *ic, const char *handle, const char *name, const char *group ) { struct xt_node *node; int st; @@ -564,6 +564,8 @@ int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name ) xt_add_attr( node, "jid", handle ); if( name ) xt_add_attr( node, "name", name ); + if( group ) + xt_add_child( node, xt_new_node( "group", group, NULL ) ); /* And pack it into a roster-add packet */ node = xt_new_node( "query", NULL, node ); diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index cf491f81..d5948958 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -412,7 +412,7 @@ static void jabber_add_buddy( struct im_connection *ic, char *who, char *group ) return; } - if( jabber_add_to_roster( ic, who, NULL ) ) + if( jabber_add_to_roster( ic, who, NULL, group ) ) presence_send_request( ic, who, "subscribe" ); } diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index b3638597..45a1c5c1 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -234,7 +234,7 @@ int jabber_init_iq_auth( struct im_connection *ic ); xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); int jabber_get_roster( struct im_connection *ic ); int jabber_get_vcard( struct im_connection *ic, char *bare_jid ); -int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name ); +int jabber_add_to_roster( struct im_connection *ic, const char *handle, const char *name, const char *group ); int jabber_remove_from_roster( struct im_connection *ic, char *handle ); xt_status jabber_iq_query_features( struct im_connection *ic, char *bare_jid ); xt_status jabber_iq_query_server( struct im_connection *ic, char *jid, char *xmlns ); diff --git a/root_commands.c b/root_commands.c index ebcb6896..f6f95599 100644 --- a/root_commands.c +++ b/root_commands.c @@ -621,7 +621,7 @@ static void cmd_add( irc_t *irc, char **cmd ) } if( add_on_server ) - a->ic->acc->prpl->add_buddy( a->ic, cmd[2], NULL ); + a->prpl->add_buddy( a->ic, cmd[2], NULL ); else /* Only for add -tmp. For regular adds, this callback will be called once the IM server confirms. */ |