]> git.sesse.net Git - vlc/commitdiff
macosx: Send crashes reports without going though Mail.app but through Jones.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 14 Aug 2008 16:04:24 +0000 (18:04 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 14 Aug 2008 16:06:00 +0000 (18:06 +0200)
configure.ac
modules/gui/macosx/intf.m

index a4a9cebaf7646602678e4e2ecdc370a7203ee05a..0621980b0a77f9f07610566b2d51ecaccc79defb 100644 (file)
@@ -5003,6 +5003,8 @@ then
   VLC_ADD_LDFLAGS([macosx minimal_macosx],            [-Wl,-framework,AGL])
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,IOKit])
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,QuickTime])
+  dnl For bug report
+  VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,AddressBook])
   VLC_ADD_LDFLAGS([macosx qtcapture],                 [-Wl,-framework,QTKit])
   VLC_ADD_LDFLAGS([qtcapture],                        [-Wl,-framework,CoreAudio])
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,WebKit])
index 43d985a337d227609ff515521e0d7ce01439b25d..81d1d4cf0e6426c63c78f957a0c5bdc7c0b6bc72 100644 (file)
@@ -57,6 +57,7 @@
 
 #import <vlc_input.h>
 #import <vlc_interface.h>
+#import <AddressBook/AddressBook.h>
 
 /*****************************************************************************
  * Local prototypes.
@@ -2097,6 +2098,7 @@ end:
 }
 
 #pragma mark Crash Log
+<<<<<<< HEAD:modules/gui/macosx/intf.m
 - (void)mailCrashLog:(NSString *)crashLog withUserComment:(NSString *)userComment
 {
     static char mail[] =
@@ -2123,10 +2125,48 @@ end:
         NSRunAlertPanel(_NS("Error when generating crash report mail."), _NS("Can't prepare crash log mail"), _NS("OK"), nil, nil, nil );
         return;
     }
+=======
+- (void)sendCrashLog:(NSString *)crashLog withUserComment:(NSString *)userComment
+{
+    NSString *urlStr = @"http://jones.videolan.org/crashlog/sendcrashreport.php";
+
+    NSURL *url = [NSURL URLWithString:urlStr];
+    NSString *requestMethod = @"POST";
+
+    NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
+    [req setHTTPMethod:requestMethod];
+
+    ABPerson * contact = [[ABAddressBook sharedAddressBook] me];
+
+    ABMultiValue *emails = [contact valueForProperty:kABEmailProperty];
+    NSString * email = [emails valueAtIndex:[emails indexForIdentifier:
+                [emails primaryIdentifier]]];
+
+    NSString *postBody;
+    postBody = [NSString stringWithFormat:@"CrashLog=%@&Comment=Nothing&Email=%@\r\n",
+            [crashLog stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
+            [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
+>>>>>>> macosx: Send crashes reports without going though Mail.app but through Jones.:modules/gui/macosx/intf.m
+
+    [req setHTTPBody:[postBody dataUsingEncoding:NSUTF8StringEncoding]];
 
-    [[NSWorkspace sharedWorkspace] openFile:mailPath];
+    NSHTTPURLResponse *res = nil;
+    NSError *err = nil;
+
+    /* Released from delegate */
+    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:req delegate:self];
+}
+
+- (void)connectionDidFinishLoading:(NSURLConnection *)connection
+{
+    [connection release];
 }
 
+- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
+{
+    NSRunCriticalAlertPanel(_NS("Error when sending the Crash Report"), [error localizedDescription], @"OK", nil, nil);
+    [connection release];
+}
 
 - (NSString *)latestCrashLogPathPreviouslySeen:(BOOL)previouslySeen
 {
@@ -2205,7 +2245,7 @@ end:
                 _NS("Send"), _NS("Don't Send"), nil, nil);
     if( ret == NSAlertDefaultReturn )
     {
-        [self mailCrashLog:[NSString stringWithContentsOfFile:crashLogPath] withUserComment:_NS("<Explain here what you were doing when VLC crashed, with possibly a link to the failing video>")];
+        [self sendCrashLog:[NSString stringWithContentsOfFile:crashLogPath] withUserComment:_NS("<Explain here what you were doing when VLC crashed, with possibly a link to the failing video>")];
     }
 }