Permalink
Browse files

Adding a few more convenience methods to XMPPIQ

  • Loading branch information...
robbiehanson committed May 4, 2012
1 parent 2d6a5fe commit 178e23bbad1358f5142082d6356175fd571500a5
Showing with 36 additions and 0 deletions.
  1. +6 −0 Core/XMPPIQ.h
  2. +30 −0 Core/XMPPIQ.m
View
@@ -27,6 +27,9 @@
+ (XMPPIQ *)iqWithType:(NSString *)type to:(XMPPJID *)jid;
+ (XMPPIQ *)iqWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid;
+ (XMPPIQ *)iqWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid child:(NSXMLElement *)childElement;
++ (XMPPIQ *)iqWithType:(NSString *)type elementID:(NSString *)eid;
++ (XMPPIQ *)iqWithType:(NSString *)type elementID:(NSString *)eid child:(NSXMLElement *)childElement;
++ (XMPPIQ *)iqWithType:(NSString *)type child:(NSXMLElement *)childElement;
/**
* Creates and returns a new XMPPIQ element.
@@ -37,6 +40,9 @@
- (id)initWithType:(NSString *)type to:(XMPPJID *)jid;
- (id)initWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid;
- (id)initWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid child:(NSXMLElement *)childElement;
+- (id)initWithType:(NSString *)type elementID:(NSString *)eid;
+- (id)initWithType:(NSString *)type elementID:(NSString *)eid child:(NSXMLElement *)childElement;
+- (id)initWithType:(NSString *)type child:(NSXMLElement *)childElement;
/**
* Returns the type attribute of the IQ.
View
@@ -65,6 +65,21 @@ + (XMPPIQ *)iqWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)
return [[XMPPIQ alloc] initWithType:type to:jid elementID:eid child:childElement];
}
++ (XMPPIQ *)iqWithType:(NSString *)type elementID:(NSString *)eid
+{
+ return [[XMPPIQ alloc] initWithType:type to:nil elementID:eid child:nil];
+}
+
++ (XMPPIQ *)iqWithType:(NSString *)type elementID:(NSString *)eid child:(NSXMLElement *)childElement
+{
+ return [[XMPPIQ alloc] initWithType:type to:nil elementID:eid child:childElement];
+}
+
++ (XMPPIQ *)iqWithType:(NSString *)type child:(NSXMLElement *)childElement
+{
+ return [[XMPPIQ alloc] initWithType:type to:nil elementID:nil child:childElement];
+}
+
- (id)init
{
return [self initWithType:nil to:nil elementID:nil child:nil];
@@ -104,6 +119,21 @@ - (id)initWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid
return self;
}
+- (id)initWithType:(NSString *)type elementID:(NSString *)eid
+{
+ return [self initWithType:type to:nil elementID:eid child:nil];
+}
+
+- (id)initWithType:(NSString *)type elementID:(NSString *)eid child:(NSXMLElement *)childElement
+{
+ return [self initWithType:type to:nil elementID:eid child:childElement];
+}
+
+- (id)initWithType:(NSString *)type child:(NSXMLElement *)childElement
+{
+ return [self initWithType:type to:nil elementID:nil child:childElement];
+}
+
- (NSString *)type
{
return [[self attributeStringValueForName:@"type"] lowercaseString];

0 comments on commit 178e23b

Please sign in to comment.