Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of git://github.com/alexrepty/MGTwitterEngine

Conflicts:
	MGTwitterEngine.h
	MGTwitterEngine.m
	MGTwitterEngineGlobalHeader.h
  • Loading branch information...
commit 67dd79ea98ce68a8edb96ae556c584818c1c9559 2 parents 2d5e471 + a4462b9
@catsby catsby authored
View
4 MGTwitterEngine.h
@@ -97,7 +97,11 @@
- (NSString *)getUpdate:(MGTwitterEngineID)updateID; // statuses/show
- (NSString *)sendUpdate:(NSString *)status; // statuses/update
+
+- (NSString *)sendUpdate:(NSString *)status withLatitude:(MGTwitterEngineLocationDegrees)latitude longitude:(MGTwitterEngineLocationDegrees)longitude; // statuses/update
- (NSString *)sendUpdate:(NSString *)status inReplyTo:(MGTwitterEngineID)updateID; // statuses/update
+- (NSString *)sendUpdate:(NSString *)status inReplyTo:(MGTwitterEngineID)updateID withLatitude:(MGTwitterEngineLocationDegrees)latitude longitude:(MGTwitterEngineLocationDegrees)longitude; // statuses/update
+
- (NSString *)getRepliesStartingAtPage:(int)pageNum; // statuses/mentions
- (NSString *)getRepliesSinceID:(MGTwitterEngineID)sinceID startingAtPage:(int)pageNum count:(int)count; // statuses/mentions
View
16 MGTwitterEngine.m
@@ -91,6 +91,7 @@ - (NSMutableURLRequest *)_baseRequestWithMethod:(NSString *)method
requestType:(MGTwitterRequestType)requestType
queryParameters:(NSDictionary *)params;
+
// Parsing methods
- (void)_parseDataForConnection:(MGTwitterHTTPURLConnection *)connection;
@@ -1125,9 +1126,18 @@ - (NSString *)sendUpdate:(NSString *)status
return [self sendUpdate:status inReplyTo:0];
}
+- (NSString *)sendUpdate:(NSString *)status withLatitude:(MGTwitterEngineLocationDegrees)latitude longitude:(MGTwitterEngineLocationDegrees)longitude
+{
+ return [self sendUpdate:status inReplyTo:0 withLatitude:latitude longitude:longitude];
+}
- (NSString *)sendUpdate:(NSString *)status inReplyTo:(MGTwitterEngineID)updateID
{
+ return [self sendUpdate:status inReplyTo:updateID withLatitude:DBL_MAX longitude:DBL_MAX]; // DBL_MAX denotes invalid/unused location
+}
+
+- (NSString *)sendUpdate:(NSString *)status inReplyTo:(MGTwitterEngineID)updateID withLatitude:(MGTwitterEngineLocationDegrees)latitude longitude:(MGTwitterEngineLocationDegrees)longitude
+{
if (!status) {
return nil;
}
@@ -1144,6 +1154,12 @@ - (NSString *)sendUpdate:(NSString *)status inReplyTo:(MGTwitterEngineID)updateI
if (updateID > 0) {
[params setObject:[NSString stringWithFormat:@"%llu", updateID] forKey:@"in_reply_to_status_id"];
}
+ if (latitude >= -90.0 && latitude <= 90.0 &&
+ longitude >= -180.0 && longitude <= 180.0) {
+ [params setObject:[NSString stringWithFormat:@"%.8f", latitude] forKey:@"lat"];
+ [params setObject:[NSString stringWithFormat:@"%.8f", longitude] forKey:@"long"];
+ }
+
NSString *body = [self _queryStringWithBase:nil parameters:params prefixed:NO];
return [self _sendRequestWithMethod:HTTP_POST_METHOD path:path
View
8 MGTwitterEngineGlobalHeader.h
@@ -73,4 +73,10 @@
#ifndef __MGTWITTERENGINEID__
#define __MGTWITTERENGINEID__
typedef unsigned long long MGTwitterEngineID;
-#endif
+
+#endif
+
+#ifndef __MGTWITTERENGINELOCATIONDEGREES__
+#define __MGTWITTERENGINELOCATIONDEGREES__
+typedef double MGTwitterEngineLocationDegrees;
+#endif
Please sign in to comment.
Something went wrong with that request. Please try again.