2011-03-31 7 views
1

トピック: こんにちは、私はxmppチャットアプリケーションを開発したい、これまではxmppチャットでやりました。オンラインユーザーにメッセージを送受信します。バディ/フレンドとして別のオンラインユーザーを追加するにはどうすればよいですか?どのように私の友人のリスト(xmppを使用して)から友人を削除することができますか?そしてどのように誰かが私に(XMPP)で友達リクエストを送信したことを知ることが テクノロジー:iphoneのapplcationプログラミング 言語:Objective Ciphone sdkでxmppを使って友達を管理しますか?

答えて

1

XMPPサーバーは、あなたのバディリスト(名簿管理)を管理し、あなたが購読を送信する必要が/ XMPPサーバーへのパケットの登録を解除して、バディを追加または削除します。 XMPP RFC(rfc-3921)のセクション8.2を参照して、送信しなければならないXMPPメッセージの形式と処理する必要のあるサーバー応答を確認してください。ここで

は、XMPP RFC(セクション8.2を参照)

http://xmpp.org/rfcs/rfc3921.html

+0

しかし、どのように私はxmpp iphone sdkからこれらのことを行うことができますか?私はxmpp iphone sdkを持っています、私はバディリクエストを送信し、バディリクエストから削除できますが、リクエストの通知とリクエストを得ることができません。受け入れるか拒絶するか..... – Matrix

+0

あなたはどのSDKを使用していますか?いくつかのopensourceフレームワーク? – Tayyab

0

現在、私のために働いバディrequest.Itsを送信するためのコード下の使用へのリンクです。 username ot email idはあなたのopenfire設定に依存します。

XMPPJID * newBuddy = [XMPPJID jidWithString:@ "friendsemailid or username"];

[xmppRoster addUser:newBuddy withNickname:nil];

-1
1.You can add a new friend through this code in didReceivePresence delegate 
else if ([presenceType isEqualToString:@"subscribe"]) 
     { 
      NSXMLElement *presenceToRequest = [NSXMLElement elementWithName:@"presence"]; 
      [presenceToRequest addAttributeWithName:@"type" stringValue:@"subscribed"]; 
      [presenceToRequest addAttributeWithName:@"to" stringValue:[NSString stringWithFormat:@"%@", [presence fromStr]]]; 
      [presenceToRequest addAttributeWithName:@"from" stringValue:[NSString stringWithFormat:@"%@", [presence toStr]]]; 
      [[self xmppStream] sendElement:presenceToRequest]; 
     } 
2.You can send friend request through XMPPRoster method 
    [xmppRoster addUser:[XMPPJID jidWithString:friendJID] withNickname:friendNickName]; 
3.In didReceivePresence delegate you can your friend request either you want to accept or reject a friendrequest. 

I hope this information helps you to solve your issues.enter code here 
+0

ポイント3はかなり不明ですが、もっと説明できますか?いくつかのコードを提供できますか? –

関連する問題