diff options
| -rw-r--r-- | protocols/jabber/conference.c | 9 | ||||
| -rw-r--r-- | protocols/jabber/jabber.h | 14 | 
2 files changed, 16 insertions, 7 deletions
| diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c index 515194fc..f206e084 100644 --- a/protocols/jabber/conference.c +++ b/protocols/jabber/conference.c @@ -122,6 +122,8 @@ int jabber_chat_msg( struct groupchat *c, char *message, int flags )  	struct jabber_chat *jc = c->data;  	struct xt_node *node; +	jc->flags |= JCFLAG_MESSAGE_SENT; +	  	node = xt_new_node( "body", message, NULL );  	node = jabber_make_packet( "message", "groupchat", jc->name, node ); @@ -294,10 +296,11 @@ void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud  {  	struct xt_node *subject = xt_find_node( node->children, "subject" );  	struct xt_node *body = xt_find_node( node->children, "body" ); -	struct groupchat *chat = NULL; +	struct groupchat *chat = bud ? jabber_chat_by_jid( ic, bud->bare_jid ) : NULL; +	struct jabber_chat *jc = chat ? chat->data : NULL;  	char *s; -	if( bud == NULL ) +	if( bud == NULL || ( jc && ~jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me ) )  	{  		char *nick; @@ -345,7 +348,7 @@ void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud  		return;  	} -	else if( ( chat = jabber_chat_by_jid( ic, bud->bare_jid ) ) == NULL ) +	else if( chat == NULL )  	{  		/* How could this happen?? We could do kill( self, 11 )  		   now or just wait for the OS to do it. :-) */ diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index 44655409..1ff0e8dd 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -48,16 +48,22 @@ typedef enum  typedef enum  { -	JBFLAG_PROBED_XEP85 = 1,	/* Set this when we sent our probe packet to make +	JBFLAG_PROBED_XEP85 = 1,        /* Set this when we sent our probe packet to make  	                                   sure it gets sent only once. */ -	JBFLAG_DOES_XEP85 = 2,		/* Set this when the resource seems to support +	JBFLAG_DOES_XEP85 = 2,          /* Set this when the resource seems to support  	                                   XEP85 (typing notification shite). */ -	JBFLAG_IS_CHATROOM = 4,		/* It's convenient to use this JID thingy for +	JBFLAG_IS_CHATROOM = 4,         /* It's convenient to use this JID thingy for  	                                   groupchat state info too. */ -	JBFLAG_IS_ANONYMOUS = 8,	/* For anonymous chatrooms, when we don't have +	JBFLAG_IS_ANONYMOUS = 8,        /* For anonymous chatrooms, when we don't have  	                                   have a real JID. */  } jabber_buddy_flags_t; +typedef enum +{ +	JCFLAG_MESSAGE_SENT = 1,        /* Set this after sending the first message, so +	                                   we can detect echoes/backlogs. */ +} jabber_chat_flags_t; +  struct jabber_data  {  	struct im_connection *ic; | 
