[vlc-devel] commit: macosx: Send crashes reports without going though Mail. app but through Jones. (Pierre d'Herbemont )

git version control git at videolan.org
Thu Aug 14 18:03:05 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Thu Aug 14 18:04:24 2008 +0200| [63c2fc55d188aa50298069681285ebf2853455d0] | committer: Pierre d'Herbemont 

macosx: Send crashes reports without going though Mail.app but through Jones.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=63c2fc55d188aa50298069681285ebf2853455d0
---

 configure.ac              |    2 ++
 modules/gui/macosx/intf.m |   44 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index a4a9ceb..0621980 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 43d985a..81d1d4c 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -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>")];
     }
 }
 




More information about the vlc-devel mailing list