Use one file per class.
This commit is contained in:
parent
2fa82b833c
commit
fa59d3ce32
11 changed files with 361 additions and 355 deletions
148
src/XMPPStanza.m
148
src/XMPPStanza.m
|
@ -152,151 +152,3 @@
|
|||
stringValue: ID];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation XMPPIQ
|
||||
+ IQWithType: (OFString*)type_
|
||||
ID: (OFString*)ID_
|
||||
{
|
||||
return [[[self alloc] initWithType: type_
|
||||
ID: ID_] autorelease];
|
||||
}
|
||||
|
||||
- initWithType: (OFString*)type_
|
||||
ID: (OFString*)ID_
|
||||
{
|
||||
if (!([type_ isEqual: @"get"] ||
|
||||
[type_ isEqual: @"set"] ||
|
||||
[type_ isEqual: @"result"] ||
|
||||
[type_ isEqual: @"error"]))
|
||||
of_log(@"Invalid IQ type!");
|
||||
|
||||
return [super initWithName: @"iq"
|
||||
type: type_
|
||||
ID: ID_];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation XMPPMessage
|
||||
+ message
|
||||
{
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
+ messageWithID: (OFString*)ID_
|
||||
{
|
||||
return [[[self alloc] initWithID: ID_] autorelease];
|
||||
}
|
||||
|
||||
+ messageWithType: (OFString*)type_
|
||||
{
|
||||
return [[[self alloc] initWithType: type_] autorelease];
|
||||
}
|
||||
|
||||
+ messageWithType: (OFString*)type_
|
||||
ID: (OFString*)ID_
|
||||
{
|
||||
return [[[self alloc] initWithType: type_
|
||||
ID: ID_] autorelease];
|
||||
}
|
||||
|
||||
- init
|
||||
{
|
||||
return [self initWithType: nil
|
||||
ID: nil];
|
||||
}
|
||||
|
||||
- initWithID: (OFString*)ID_
|
||||
{
|
||||
return [self initWithType: nil
|
||||
ID: ID_];
|
||||
}
|
||||
|
||||
- initWithType: (OFString*)type_
|
||||
{
|
||||
return [self initWithType: type_
|
||||
ID: nil];
|
||||
}
|
||||
|
||||
- initWithType: (OFString*)type_
|
||||
ID: (OFString*)ID_
|
||||
{
|
||||
return [super initWithName: @"message"
|
||||
type: type_
|
||||
ID: ID_];
|
||||
}
|
||||
|
||||
- (void)addBody: (OFString*)body
|
||||
{
|
||||
[self addChild: [OFXMLElement elementWithName: @"body"
|
||||
stringValue: body]];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation XMPPPresence
|
||||
+ presence
|
||||
{
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
+ presenceWithID: (OFString*)ID_
|
||||
{
|
||||
return [[[self alloc] initWithID: ID_] autorelease];
|
||||
}
|
||||
|
||||
+ presenceWithType: (OFString*)type_
|
||||
{
|
||||
return [[[self alloc] initWithType: type_] autorelease];
|
||||
}
|
||||
|
||||
+ presenceWithType: (OFString*)type_
|
||||
ID: (OFString*)ID_
|
||||
{
|
||||
return [[[self alloc] initWithType: type_
|
||||
ID: ID_] autorelease];
|
||||
}
|
||||
|
||||
- init
|
||||
{
|
||||
return [self initWithType: nil
|
||||
ID: nil];
|
||||
}
|
||||
|
||||
- initWithID: (OFString*)ID_
|
||||
{
|
||||
return [self initWithType: nil
|
||||
ID: ID_];
|
||||
}
|
||||
|
||||
- initWithType: (OFString*)type_
|
||||
{
|
||||
return [self initWithType: type_
|
||||
ID: nil];
|
||||
}
|
||||
|
||||
- initWithType: (OFString*)type_
|
||||
ID: (OFString*)ID_
|
||||
{
|
||||
return [super initWithName: @"presence"
|
||||
type: type_
|
||||
ID: ID_];
|
||||
}
|
||||
|
||||
- (void)addShow: (OFString*)show
|
||||
{
|
||||
[self addChild: [OFXMLElement elementWithName: @"show"
|
||||
stringValue: show]];
|
||||
}
|
||||
|
||||
- (void)addStatus: (OFString*)status
|
||||
{
|
||||
[self addChild: [OFXMLElement elementWithName: @"status"
|
||||
stringValue: status]];
|
||||
}
|
||||
|
||||
- (void)addPriority: (int8_t)priority
|
||||
{
|
||||
OFString* prio = [OFString stringWithFormat: @"%" @PRId8, priority];
|
||||
[self addChild: [OFXMLElement elementWithName: @"priority"
|
||||
stringValue: prio]];
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue