简体   繁体   中英

typing indication in xmpp chat in iphone

I am developing chat application using XMPP. Here my problem is, I want to send chat notifications .I tried the fallowing way but not getting correctly.

- (void)sendMessage:(id)sender
{   


    NSString *messageStr =messageField.text;
    if([messageStr length] > 0)
    {

         NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
         NSXMLElement *chatStatus=[NSXMLElement elementWithName:@"composing" xmlns:xmlns_chatstates];

        [body setStringValue:messageStr];
         NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
        [message addAttributeWithName:@"type" stringValue:@"chat"];
        [message addAttributeWithName:@"to" stringValue:jidString];

        [message addChild:chatStatus];
        [message addChild:body];


        [[self xmppStream] sendElement:message];
    }
}

I am using above method for sending a message.But it always shows typing notification even i am not typing .can any one help to me. thanks in advance

根据XEP-0085:聊天状态通知 ,您应该发送另一个通知,说明您已停止输入,例如<active/><paused/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM