?

Log in

No account? Create an account

Previous Entry | Next Entry

Fix for "no port number" bug

I found that if no port number is specified in the lj server settings, login fails. Most people don't even know what a port number is, or if they do, perhaps they don't know what the default LJ port numer is. So if no value is specified, this patch uses the default value of "80".

Next on my todo list is fixing the hard-coded livejournal.com URLs used when you select the "Recent Entries" menu item. :-)

I hope this is the right place to submit patch diffs. I'll put the code after an lj cut..

Here's the diff, inside a <pre> block..

? port-fix-diff.txt
? LiveJournal.pbproj/rae.pbxuser
Index: LiveJournalController.m
===================================================================
RCS file: /cvsroot/ljosx/LiveJournal/LiveJournalController.m,v
retrieving revision 1.108
diff -u -r1.108 LiveJournalController.m
--- LiveJournalController.m	14 Apr 2002 03:06:13 -0000	1.108
+++ LiveJournalController.m	16 Apr 2002 17:47:42 -0000
@@ -843,6 +843,7 @@
 
     NSHost *host = [NSHost hostWithName:@"www.livejournal.com"];
     u_short port = 80;
+	u_short enteredPort = 0;
     int sock;
     struct sockaddr_in sin;
     NSEnumerator *addressEnm;
@@ -857,7 +858,11 @@
     // check for server setting
     if ([serverCheckBox state]) {
         host = [NSHost hostWithName: [ljServer stringValue]];
-        port = [ljPort intValue];
+        enteredPort = [ljPort intValue];
+		// make sure the port number is valid -- user may have left field empty
+		if(enteredPort != 0) {
+		    port = enteredPort;
+		}
         //NSLog(@"Different Server Selected: %@ port: %d", [ljServer stringValue], [ljPort intValue]);
     }
 
@@ -865,6 +870,11 @@
     if ([proxyCheckBox state]) {
         host = [NSHost hostWithName: [proxyServer stringValue]];
         port = [proxyPort intValue];
+        enteredPort = [proxyPort intValue];
+		// make sure the port number is valid -- user may have left field empty
+		if(enteredPort != 0) {
+		    port = enteredPort;
+		}
         //NSLog(@"Proxy Selected: %@ port: %d", [proxyServer stringValue], [proxyPort intValue]);
     }
 
@@ -2876,9 +2886,13 @@
 - (NSString *) journalServerURI
 {
     if ([serverCheckBox state]) {
-        return [NSString stringWithFormat: @"%@:%@", [ljServer stringValue], [ljPort stringValue]];
+	if([ljPort intValue]) {
+            return [NSString stringWithFormat: @"%@:%@", [ljServer stringValue], [ljPort stringValue]];
+        } else {
+            return [NSString stringWithFormat: @"%@:80", [ljServer stringValue]];
+        }
     } else {
         return @"www.livejournal.com";
     }
 }
-@end
\ No newline at end of file
+@end

Comments

( 3 comments — Leave a comment )
koliver
Apr. 16th, 2002 11:31 am (UTC)
cool. this is seems like a good thing. i might rework it a bit and apply the patch tonite if i get a chance.

as for posting patches, i think the dev mailing list is a better place: ljosx-developers@lists.sourceforge.net.

thanks for the help.
clith
Apr. 16th, 2002 01:23 pm (UTC)
Okay, I'm subscribing *right* *now*. :-)
koliver
Apr. 16th, 2002 09:33 pm (UTC)
ran the patch. don't have any accounts or a proxy to test this on, but it doesn't look like any badness could come from the changes.
thanks clith.
( 3 comments — Leave a comment )

Profile

ijournal
iJournal: Official LiveJournal Client for Mac OS X
iJournal Home

Latest Month

January 2012
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031    
Powered by LiveJournal.com
Designed by Lilia Ahner