小编Kei*_*OYS的帖子

XMPPFramework - 实施群聊(MUC)

我正在使用iOS聊天客户端.有人可以帮我多用户聊天吗?

我已经实现了Robbiehanson的XMPPFramework.

谁能告诉我如何获取组列表并使用此框架在服务器中创建组?

提前致谢.

xmpp objective-c ios xmppframework

19
推荐指数
1
解决办法
2万
查看次数

XMPPFramework - 如何创建MUC会议室并邀请用户?

我正在使用Robbiehanson的iOS XMPPFramework.我正在尝试创建一个MUC房间并邀请用户进入群聊室,但它无法正常工作.

我使用以下代码:

XMPPRoom *room = [[XMPPRoom alloc] initWithRoomName:@"user101@conference.jabber.org/room" nickName:@"room"];
[room createOrJoinRoom];
[room sendInstantRoomConfig];
[room setInvitedUser:@"ABC@jabber.org"];
[room activate:[self xmppStream]];    
[room inviteUser:jid1 withMessage:@"hello please join."];
[room sendMessage:@"HELLO"];
Run Code Online (Sandbox Code Playgroud)

用户ABC@jabber.org应该收到邀请消息但没有发生任何事情.

任何帮助将不胜感激.:)

xmpp objective-c ios xmppframework

18
推荐指数
1
解决办法
1万
查看次数

XMPPFramework - 从Openfire Server检索存档的消息

我正在使用XMPP和openfire服务器为iPhone开发聊天应用程序,OpenFire服务器存储用户之间的所有聊天记录但是当我尝试检索特定用户的聊天记录时,我只得到聊天消息的日期和数量但不是实际的短信

我已经在openfire上安装了用于邮件存档的开放存档插件

这是我传递给Openfire Server的节

    <iq type='get' id='pk1'>
    <list xmlns='urn:xmpp:archive'
    with='piyush@openfire'>
    <set xmlns='http://jabber.org/protocol/rsm'>
    <max>30</max>
    </set>
    </list>
    </iq>
Run Code Online (Sandbox Code Playgroud)

这是我从服务器收到的结果

  <iq type="result" id="pk1" to="vivek@openfire/iphone">
  <list xmlns="urn:xmpp:archive">
  <chat with="piyush@openfire" start="2012-07-04T13:16:12.291Z"/>
  <chat with="piyush@openfire" start="2012-07-05T08:25:31.555Z"/>
  <chat with="piyush@openfire" start="2012-07-05T12:38:24.098Z"/>
  <set xmlns="http://jabber.org/protocol/rsm">
  <first index="0">15</first>
  <last>25</last>
  <count>3</count>
  </set>
  </list>
  </iq>
Run Code Online (Sandbox Code Playgroud)

这是我想要的结果和我期望的结果

 <iq type='result' to='vivek@openfire/iphone' id='page1'>
 <chat xmlns='urn:xmpp:archive'
    with='piyush@openfire'
    start='2012-07-04T13:16:12.291Z'
    subject='She speaks!'
    version='4'>
<from secs='0'><body>Art thou not Romeo, and a Montague?</body></from>
<to secs='11'><body>Neither, fair saint, if either thee dislike.</body></to>
.
[98 more messages]
.
<from secs='9'><body>How cam'st thou hither, tell …
Run Code Online (Sandbox Code Playgroud)

xmpp openfire ios xmppframework

12
推荐指数
2
解决办法
1万
查看次数

XMPP4r - 无法检索脱机消息

我正在尝试使用带有openfire服务器的ruby xmpp4r库获取openfire多用户组聊天记录.我能够构建请求,但我没有得到服务器回复.以下是发现请求

iqr = Iq.new(:get,"example.com")
iqr.add_namespace("http://jabber.org/protocol/disco#info")
client.send(iqr)
Run Code Online (Sandbox Code Playgroud)

这是框架的请求

<iq to='example.com' type='get' xmlns='http://jabber.org/protocol/disco#info'/>
Run Code Online (Sandbox Code Playgroud)

但我没有收到服务器回复.我跟着XEP-0160和XEP-0013.

我在这里错过了什么?


openfire是否提供聊天记录?那有api吗?

非常感谢任何帮助.而且我不太了解openfire,因此非常感谢任何关于它的信息.

ruby xmpp ruby-on-rails openfire xmpp4r

8
推荐指数
1
解决办法
720
查看次数

Java - 如何解决这个2D阵列小时玻璃?

我正在研究一个问题,我要在数组中的所有沙漏中打印最大的总和.你可以在这里找到有关问题的详细信息-

我尝试了什么:

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int arr[][] = new int[6][6];
        for (int arr_i = 0; arr_i < 6; arr_i++) {
            for (int arr_j = 0; arr_j < 6; arr_j++) {
                arr[arr_i][arr_j] = in.nextInt();
            }
        }

        int sum = 0;
        int tmp_sum = 0;
        for (int arr_i = 0; arr_i < 4; arr_i++) {
            for (int arr_j = 0; arr_j < 4; arr_j++) {
                if (arr[arr_i][arr_j] > 0) …
Run Code Online (Sandbox Code Playgroud)

java arrays multidimensional-array hourglass

6
推荐指数
1
解决办法
2万
查看次数

如何在android中动态设置相对布局的高度

这在模拟器上工作正常但在设备上没有,因为我已经将高度硬编码为365.任何人都可以在这方面帮助我吗?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<TabHost android:id="@+id/tab_host"
    android:layout_width="fill_parent" android:layout_height="fill_parent">
    <TabWidget android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:id="@android:id/tabs"
        android:layout_gravity="bottom"/>
        <FrameLayout android:id="@android:id/tabcontent"
            android:layout_width="fill_parent" android:layout_height="fill_parent">
            <RelativeLayout android:id="@+id/first_tab"
                android:orientation="vertical" android:layout_width="fill_parent"
                android:layout_height="365px">
                <WebView xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/webview"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"/>
                    <ImageView
                        android:id="@+id/widget31"
                        android:layout_width="fill_parent"
                        android:layout_height="49px"
                        android:layout_x="0px"
                        android:layout_y="0px"
                        android:background="#39000000"
                        android:layout_alignParentBottom="true">
                    </ImageView>
                    <ImageButton
                        android:id="@+id/btnFB"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/fb"
                        android:background="#00000000"
                        android:layout_alignRight="@+id/widget31"
                        android:layout_alignParentBottom="true">
                    </ImageButton>
                    <TextView   
                        android:id="@+id/myTextView1"   
                        android:layout_height="wrap_content"   
                        android:layout_width="wrap_content"   
                        android:text="Share"
                        android:textColor="#111111"
                        android:textSize="14pt"
                        android:paddingBottom="5px"
                        android:layout_alignLeft="@+id/widget31"
                        android:layout_alignParentBottom="true"/> 
                        <ImageButton
                            android:id="@+id/btnTwitter"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:src="@drawable/twitter"
                            android:visibility="invisible"
                            android:background="#00000000"
                            android:layout_alignRight="@+id/widget31"
                            android:layout_alignParentBottom="true">
                        </ImageButton>
            <!-- Replace TextView with your layout content for this tab …
Run Code Online (Sandbox Code Playgroud)

layout android css-position

5
推荐指数
2
解决办法
2万
查看次数

MUC如何使用XMPPFramework

我正在开发一个使用Robbie Hanson的XMPPFramework的iOS XMPP聊天应用程序.

已经实现了最重要的功能 - 发送和接收消息.基本上,我已经构建了一个基本的功能聊天应用程序,当然还有点眼睛.

现在,我遇到的问题是关于MUC.我从其他网站看到的代码表明,有一种方法initWithRoomNameXMPPRoom.但是,我克隆的git repo中没有这种方法.那么,替代方案是什么呢?或者,如果没有,我如何使用XMPPFramework创建房间?

谢谢.

xmpp objective-c ios xmppframework

5
推荐指数
1
解决办法
1万
查看次数

XMPPFramework - 如果尚未创建vCard,则不会更新昵称

当新用户向XMPP注册时出现问题.我无法在vCard上设置昵称,但是如果用户的vCard已经存在,那么同一段代码可以正常工作.

dispatch_queue_t queue = dispatch_queue_create("queue", DISPATCH_QUEUE_PRIORITY_DEFAULT);
dispatch_async(queue, ^{

    XMPPvCardCoreDataStorage *xmppvCardStorage = [XMPPvCardCoreDataStorage sharedInstance];
    XMPPvCardTempModule *xmppvCardTempModule = [[XMPPvCardTempModule alloc] initWithvCardStorage:xmppvCardStorage];
    [xmppvCardTempModule  activate:[self xmppStream]];

    XMPPvCardTemp *myVcardTemp = [xmppvCardTempModule myvCardTemp];

    if (myVcardTemp == nil) {
       // I am stuck here, unable to create empty VCard for new User
    }
    else {
        [myVcardTemp setNickname:@"iphone"];
        [xmppvCardTempModule updateMyvCardTemp:myVcardTemp];
    }

});
Run Code Online (Sandbox Code Playgroud)

在xmpp中第一次创建vcard的任何线索?

xmpp ios xmppframework

5
推荐指数
1
解决办法
2206
查看次数

XMPPFramework - 在Openfire上通过SSL连接

我正在尝试通过SSL将我的用户从我的iOS XMPP聊天客户端连接到Openfire服务器.

在我的iOS客户端中:

- (void)setupStream 
{
    ...
    // BOOL values for security settings
    customCertEvaluation = NO;
    allowSelfSignedCertificates = YES;
    allowSSLHostNameMismatch = NO;
}
Run Code Online (Sandbox Code Playgroud)

在我的Openfire服务器的安全设置 > 客户端连接安全性中,我设置了:

Required - Clients can only connect to the server using secured connections.

因此,将调用以下委托方法:

- (void)xmppStream:(XMPPStream *)sender willSecureWithSettings:(NSMutableDictionary *)settings 
{
    NSString *expectedCertName = [xmppStream.myJID domain];

    if (customCertEvaluation)
        [settings setObject:@(YES) forKey:GCDAsyncSocketManuallyEvaluateTrust];

    if (allowSelfSignedCertificates)
        [settings setObject:[NSNumber numberWithBool:YES] forKey:(NSString *)kCFStreamSSLAllowsAnyRoot];

    if (allowSSLHostNameMismatch)
        [settings setObject:[NSNull null] forKey:(NSString *)kCFStreamSSLPeerName];

    else
        if (expectedCertName) …
Run Code Online (Sandbox Code Playgroud)

ssl xmpp openfire ios xmppframework

5
推荐指数
1
解决办法
6824
查看次数

XMPPFramework - 上传个人资料或头像图片

我正在使用我使用xmpp框架的聊天应用程序.我可以通过xmpp发送或接收消息.但是,当我尝试使用以下代码上传用户个人资料或头像图像时,没有获得成功.

NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:stringPath]];
UIImage *tmpImage = [[UIImage alloc] initWithData:data];
UIImageView *thumbimage;
thumbimage.image = tmpImage;

NSData *imageData1 = UIImageJPEGRepresentation(thumbimage.image,0.5);
NSXMLElement *vCardXML = [NSXMLElement elementWithName:@"vCard" xmlns:@"vcard-temp"];
NSXMLElement *photoXML = [NSXMLElement elementWithName:@"PHOTO"];
NSXMLElement *typeXML = [NSXMLElement elementWithName:@"TYPE" stringValue:@"image/jpeg"];
NSXMLElement *binvalXML = [NSXMLElement elementWithName:@"BINVAL" stringValue:[[NSString alloc] initWithData:imageData1 encoding:NSUTF8StringEncoding]];

[photoXML addChild:typeXML];
[photoXML addChild:binvalXML];
[vCardXML addChild:photoXML];

XMPPvCardTemp *myvCardTemp = [[[self appDelegate] xmppvCardTempModule] myvCardTemp];

if (myvCardTemp) {
    [myvCardTemp setPhoto:imageData1];
    [[[self appDelegate] xmppvCardTempModule] updateMyvCardTemp:myvCardTemp];
}
Run Code Online (Sandbox Code Playgroud)

请帮我实现上传图像概念到XMPP或纠正我如果我在代码中做错了什么.

提前致谢.

xmpp objective-c ios xmppframework

5
推荐指数
2
解决办法
2574
查看次数