Add xml:lang support.
This commit is contained in:
parent
1b9c63195a
commit
6ddf416e50
4 changed files with 53 additions and 4 deletions
|
@ -52,6 +52,8 @@
|
|||
#import "XMPPXMLElementBuilder.h"
|
||||
#import "namespaces.h"
|
||||
|
||||
#import <ObjFW/macros.h>
|
||||
|
||||
@implementation XMPPConnection
|
||||
+ connection
|
||||
{
|
||||
|
@ -528,6 +530,8 @@
|
|||
|
||||
- (void)XMPP_startStream
|
||||
{
|
||||
OFString *langString = @"";
|
||||
|
||||
/* Make sure we don't get any old events */
|
||||
[parser setDelegate: nil];
|
||||
[elementBuilder setDelegate: nil];
|
||||
|
@ -545,11 +549,16 @@
|
|||
elementBuilder = [[XMPPXMLElementBuilder alloc] init];
|
||||
[elementBuilder setDelegate: self];
|
||||
|
||||
if (language != nil)
|
||||
langString = [OFString stringWithFormat: @"xml:lang='%@' ",
|
||||
language];
|
||||
|
||||
[sock writeFormat: @"<?xml version='1.0'?>\n"
|
||||
@"<stream:stream to='%@' "
|
||||
@"xmlns='" XMPP_NS_CLIENT @"' "
|
||||
@"xmlns:stream='" XMPP_NS_STREAM @"' "
|
||||
@"version='1.0'>", domain];
|
||||
@"xmlns:stream='" XMPP_NS_STREAM @"' %@"
|
||||
@"version='1.0'>", domain, langString];
|
||||
|
||||
streamOpen = YES;
|
||||
}
|
||||
|
||||
|
@ -1042,6 +1051,16 @@
|
|||
return port;
|
||||
}
|
||||
|
||||
- (void)setLanguage: (OFString*)language_
|
||||
{
|
||||
OF_SETTER(language, language_, YES, YES)
|
||||
}
|
||||
|
||||
- (OFString*)language
|
||||
{
|
||||
OF_GETTER(language, YES)
|
||||
}
|
||||
|
||||
- (void)addDelegate: (id <XMPPConnectionDelegate>)delegate
|
||||
{
|
||||
[delegates addDelegate: delegate];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue