Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • last online status using xmpp and ios sdk

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 1.65k
    Comment on it

    If you are using xmpp server for live chat messaging and want to know how to get the last online status of your friend. Then use the following method and you will get the dictionary in xmpp delegates method.

        -(void)getlasttimeActivity:(NSString*)userId
        {
        XMPPJID *touse= [XMPPJID jidWithString:userId];
        XMPPIQ *iq = [XMPPIQ iqWithType:@"get" to:touse];
        [iq addAttributeWithName:@"id" stringValue:@"last"];
        //[iq addAttributeWithName:@"from" stringValue:@"sumeet@app.kinkey.com.au"];
        [iq addAttributeWithName:@"from" stringValue:[xmppStream myJID].full];
        NSXMLElement *query = [NSXMLElement elementWithName:@"query"];
        [query addAttributeWithName:@"xmlns" stringValue:@"jabber:iq:last"];
        [iq addChild:query];
        NSLog(@"checking IQ==%@",iq);
        [xmppStream sendElement:iq];
        }
    

    Here you will get the last seen Dictionary

    -(BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq
    {
     NSDictionary *LastseenDict=@{@"userId":[iq from].user,@"lastSeenSec":[[iq childElement] attributeStringValueForName:@"seconds"]};
    }
    

 1 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: