powered by Jive Software

Multichat: how to get the members?

while i in a multichat room ,execute the code like this:

try {
                              Collection<Affiliate> affil = muc.getMembers();
                              for (Affiliate affiliate : affil) {
                              }
                    } catch (XMPPException e1) {
                              // TODO Auto-generated catch block
                              e1.printStackTrace();
                    }

but i got an XMPPException

05-07 09:01:35.828: W/System.err(1324): not-authorized(401)
05-07 09:01:35.837: W/System.err(1324):           at org.jivesoftware.smackx.muc.MultiUserChat.getAffiliatesByAdmin(MultiUserChat.java:1743)
05-07 09:01:35.847: W/System.err(1324):           at org.jivesoftware.smackx.muc.MultiUserChat.getMembers(MultiUserChat.java:1657)
05-07 09:01:35.856: W/System.err(1324):           at cc.slook.ChatRoomActivity.onCreate(ChatRoomActivity.java:168)
05-07 09:01:35.867: W/System.err(1324):           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-07 09:01:35.867: W/System.err(1324):           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
05-07 09:01:35.867: W/System.err(1324):           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-07 09:01:35.867: W/System.err(1324):           at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-07 09:01:35.867: W/System.err(1324):           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-07 09:01:35.867: W/System.err(1324):           at android.os.Handler.dispatchMessage(Handler.java:99)
05-07 09:01:35.867: W/System.err(1324):           at android.os.Looper.loop(Looper.java:123)
05-07 09:01:35.877: W/System.err(1324):           at android.app.ActivityThread.main(ActivityThread.java:3683)
05-07 09:01:35.877: W/System.err(1324):           at java.lang.reflect.Method.invokeNative(Native Method)
05-07 09:01:35.877: W/System.err(1324):           at java.lang.reflect.Method.invoke(Method.java:507)
05-07 09:01:35.877: W/System.err(1324):           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-07 09:01:35.877: W/System.err(1324):           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-07 09:01:35.887: W/System.err(1324):           at dalvik.system.NativeStart.main(Native Method)

how shuld i fix it ?

Did you join the room prior calling getMembers() ?

yeah , i am sure . but there is still an error .

i saw many guys who still question about getOccupants() not work .i 'm ensure my code is correct , but the documents say “if an error occured while performing the request to the server or you don’t have enough privileges to get this information.” i got a question about it , the owner who i am , i stil not have a privileges to access?