Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get/set the room subject in XMPPFramework? #228

Open
jifang1218 opened this issue Jul 18, 2013 · 7 comments
Open

how to get/set the room subject in XMPPFramework? #228

jifang1218 opened this issue Jul 18, 2013 · 7 comments

Comments

@jifang1218
Copy link

I've found the current implementation is empty, are we planning to support the feature in XMPPFramework?

@ObjColumnist
Copy link
Collaborator

Yes, as soon as somebody contributes it back it will be merged in.

@jonasman
Copy link

jonasman commented Mar 4, 2014

  • (void)changeRoomSubject:(NSString *)newRoomSubject
    {
    if ([newRoomSubject length] == 0) return;

    dispatch_block_t block = ^{ @autoreleasepool {

    //XMPPLogTrace();
    /*
    <message
        from='wiccarocks@shakespeare.lit/laptop'
        id='lh2bs617'
        to='coven@chat.shakespeare.lit'
        type='groupchat'>
      <subject>Fire Burn and Cauldron Bubble!</subject>
    </message>
     */
    
    NSXMLElement *subject = [NSXMLElement elementWithName:@"subject" stringValue:newRoomSubject];
    
    XMPPMessage *message = [XMPPMessage message];
    [message addAttributeWithName:@"to" stringValue:[roomJID full]];
    [message addAttributeWithName:@"type" stringValue:@"groupchat"];
    [message addAttributeWithName:@"id" stringValue:[xmppStream generateUUID]];
    
    [message addChild:subject];
    
    [xmppStream sendElement:message];
    
    
    NSXMLElement * x = [XMPPElement elementWithName:@"x" xmlns:@"jabber:x:data"];
    [x addAttributeWithName:@"type" stringValue:@"submit"];
    
    // Fields
    
    NSXMLElement * field1 = [[XMPPElement  alloc] initWithName:@"field"];
    [field1 addAttributeWithName:@"var" stringValue:@"FORM_TYPE"];
    [field1 addChild:[NSXMLElement elementWithName:@"value" stringValue:@"http://jabber.org/protocol/muc#roomconfig"]];
    [x addChild:field1];
    
    NSXMLElement * field2 = [[XMPPElement  alloc] initWithName:@"field"];
    [field2 addAttributeWithName:@"var" stringValue:@"muc#roomconfig_roomname"];
    [field2 addChild:[NSXMLElement elementWithName:@"value" stringValue:newRoomSubject]];
    [x addChild:field2];
    
    [self configureRoomUsingOptions:x];
    

    }};

    if (dispatch_get_specific(moduleQueueTag))
    block();
    else
    dispatch_async(moduleQueue, block);
    }

@jonasman
Copy link

jonasman commented Mar 4, 2014

this was my implementation. You can use it and adapt it.

@keithoys
Copy link

@jonasman Thank you, your implementation changes the room subject and it reflects on the server successfully.

@shraddha-patel-1891
Copy link

shraddha-patel-1891 commented Feb 8, 2017

Hi jonasman,
Using your code i successfully changed Room subject on server but i am not able to fetch subject of the Room.
i spent many hours to get subject of the room but not found any solution.
so if you have any code or other information related to fetch/get room subject then please help me.

@jonasman
Copy link

jonasman commented Feb 8, 2017

Im not working in xmpp anymore. So i dont know the code to do it.
Check xmpp documentation and implement it.
It might be so that you need to ask the room info

@shraddha-patel-1891
Copy link

Thank You for giving me answer.
i will check xmpp documentation .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants