Changeset 1aa74f55
- Timestamp:
- 2010-08-23T10:34:36Z (14 years ago)
- Branches:
- master
- Children:
- bd599b9
- Parents:
- 241f9f6
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.h
r241f9f6 r1aa74f55 282 282 void irc_send_channel_user_mode_diff( irc_channel_t *ic, irc_user_t *iu, 283 283 irc_channel_user_flags_t old, irc_channel_user_flags_t new ); 284 void irc_send_invite( irc_user_t *iu, irc_channel_t *ic ); 284 285 285 286 /* irc_user.c */ -
irc_im.c
r241f9f6 r1aa74f55 613 613 } 614 614 615 static gboolean bee_irc_chat_invite( bee_t *bee, bee_user_t *bu, const char *name, const char *msg ) 616 { 617 char *channel, *s; 618 irc_t *irc = bee->ui_data; 619 irc_user_t *iu = bu->ui_data; 620 irc_channel_t *chan; 621 622 if( strchr( CTYPES, name[0] ) ) 623 channel = g_strdup( name ); 624 else 625 channel = g_strdup_printf( "#%s", name ); 626 627 if( ( s = strchr( channel, '@' ) ) ) 628 *s = '\0'; 629 630 if( strlen( channel ) > MAX_NICK_LENGTH ) 631 { 632 /* If the channel name is very long (like those insane GTalk 633 UUID names), try if we can use the inviter's nick. */ 634 s = g_strdup_printf( "#%s", iu->nick ); 635 if( irc_channel_by_name( irc, s ) == NULL ) 636 { 637 g_free( channel ); 638 channel = s; 639 } 640 } 641 642 if( ( chan = irc_channel_new( irc, channel ) ) && 643 set_setstr( &chan->set, "type", "chat" ) && 644 set_setstr( &chan->set, "chat_type", "room" ) && 645 set_setstr( &chan->set, "account", bu->ic->acc->tag ) && 646 set_setstr( &chan->set, "room", (char*) name ) ) 647 { 648 /* I'm assuming that if the user didn't "chat add" the room 649 himself but got invited, it's temporary, so make this a 650 temporary mapping that is removed as soon as we /PART. */ 651 chan->flags |= IRC_CHANNEL_TEMP; 652 } 653 else 654 { 655 irc_channel_free( chan ); 656 chan = NULL; 657 } 658 g_free( channel ); 659 660 irc_send_msg_f( iu, "PRIVMSG", irc->user->nick, "<< \002BitlBee\002 - Invitation to chatroom %s >>", name ); 661 if( msg ) 662 irc_send_msg( iu, "PRIVMSG", irc->user->nick, msg, NULL ); 663 if( chan ) 664 { 665 irc_send_msg_f( iu, "PRIVMSG", irc->user->nick, "To join the room, just /join %s", chan->name ); 666 irc_send_invite( iu, chan ); 667 } 668 669 return TRUE; 670 } 671 615 672 /* IRC->IM */ 616 673 static gboolean bee_irc_channel_chat_privmsg_cb( gpointer data, gint fd, b_input_condition cond ); … … 909 966 bee_irc_chat_topic, 910 967 bee_irc_chat_name_hint, 968 bee_irc_chat_invite, 911 969 912 970 bee_irc_ft_in_start, -
irc_send.c
r241f9f6 r1aa74f55 398 398 irc_write( ic->irc, ":%s MODE %s %s", from, ic->name, changes ); 399 399 } 400 401 void irc_send_invite( irc_user_t *iu, irc_channel_t *ic ) 402 { 403 irc_t *irc = iu->irc; 404 405 irc_write( iu->irc, ":%s!%s@%s INVITE %s :%s", 406 iu->nick, iu->user, iu->host, irc->user->nick, ic->name ); 407 } -
protocols/bee.h
r241f9f6 r1aa74f55 123 123 gboolean (*chat_topic)( bee_t *bee, struct groupchat *c, const char *new, bee_user_t *bu ); 124 124 gboolean (*chat_name_hint)( bee_t *bee, struct groupchat *c, const char *name ); 125 gboolean (*chat_invite)( bee_t *bee, bee_user_t *bu, const char *name, const char *msg ); 125 126 126 127 struct file_transfer* (*ft_in_start)( bee_t *bee, bee_user_t *bu, const char *file_name, size_t file_size ); … … 175 176 G_MODULE_EXPORT int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags ); 176 177 G_MODULE_EXPORT struct groupchat *bee_chat_by_title( bee_t *bee, struct im_connection *ic, const char *title ); 178 G_MODULE_EXPORT void imcb_chat_invite( struct im_connection *ic, const char *name, const char *who, const char *msg ); 177 179 178 180 #endif /* __BEE_H__ */ -
protocols/bee_chat.c
r241f9f6 r1aa74f55 233 233 return NULL; 234 234 } 235 236 void imcb_chat_invite( struct im_connection *ic, const char *name, const char *who, const char *msg ) 237 { 238 bee_user_t *bu = bee_user_by_handle( ic->bee, ic, who ); 239 240 if( bu && ic->bee->ui->chat_invite ) 241 ic->bee->ui->chat_invite( ic->bee, bu, name, msg ); 242 } -
protocols/jabber/message.c
r241f9f6 r1aa74f55 31 31 struct xt_node *body = xt_find_node( node->children, "body" ), *c; 32 32 struct jabber_buddy *bud = NULL; 33 char *s ;33 char *s, *room = NULL, *reason = NULL; 34 34 35 35 if( !from ) … … 52 52 for( c = node->children; ( c = xt_find_node( c, "x" ) ); c = c->next ) 53 53 { 54 char *ns = xt_find_attr( c, "xmlns" ) , *room;55 struct xt_node *inv , *reason;54 char *ns = xt_find_attr( c, "xmlns" ); 55 struct xt_node *inv; 56 56 57 57 if( ns && strcmp( ns, XMLNS_MUC_USER ) == 0 && 58 58 ( inv = xt_find_node( c->children, "invite" ) ) ) 59 59 { 60 /* This is an invitation. Set some vars which 61 will be passed to imcb_chat_invite() below. */ 60 62 room = from; 61 63 if( ( from = xt_find_attr( inv, "from" ) ) == NULL ) 62 64 from = room; 63 64 g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Invitation to chatroom %s >>\n", room ); 65 if( ( reason = xt_find_node( inv->children, "reason" ) ) && reason->text_len > 0 ) 66 g_string_append( fullmsg, reason->text ); 65 if( ( inv = xt_find_node( inv->children, "reason" ) ) && inv->text_len > 0 ) 66 reason = inv->text; 67 67 } 68 68 } … … 104 104 imcb_buddy_msg( ic, from, fullmsg->str, 105 105 0, jabber_get_timestamp( node ) ); 106 if( room ) 107 imcb_chat_invite( ic, room, from, reason ); 106 108 107 109 g_string_free( fullmsg, TRUE );
Note: See TracChangeset
for help on using the changeset viewer.