/[hegemonie]/hegemonie/Network/NetServer.m
ViewVC logotype

Diff of /hegemonie/Network/NetServer.m

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by nicov, Tue Jul 22 10:09:31 2003 UTC revision 1.10 by nicov, Wed Aug 13 12:35:08 2003 UTC
# Line 29  Line 29 
29  #include <Foundation/NSData.h>  #include <Foundation/NSData.h>
30  #include <Foundation/NSURL.h>  #include <Foundation/NSURL.h>
31  #include <Foundation/NSHost.h>  #include <Foundation/NSHost.h>
32    #include <Foundation/NSProcessInfo.h>
33    
34  #include "Network/NetServer.h"  #include "Network/NetServer.h"
35  #include "Network/NetParty.h"  #include "Network/NetParty.h"
# Line 42  Line 43 
43    
44    
45  /* FIXE ME (enlever address dans la requete) */  /* FIXE ME (enlever address dans la requete) */
46  NSString * const _updateServerListURL = @"http://meta.hegemonie.org/proc_update_server?address=%@&game_name=%@&num_players=%hu&max_num_players=%hu&master=%@&map_name=%@";  NSString * const _updateServerListURL = @"http://meta.hegemonie.org/proc_update_server?address=%@&game_name=%@&num_players=%hu&max_num_players=%hu&&map_name=%@&master=%@&operating_system=%@";
47    
48    
49  /**  /**
# Line 94  _convertForURL (NSString * s) Line 95  _convertForURL (NSString * s)
95  /**  /**
96   * Update the meta server data with party's informations.   * Update the meta server data with party's informations.
97   */   */
98  + (BOOL) updateServerListWithParty : (NetParty *)party  - (BOOL) updateServerListWithParty: (NetParty *)party
99  {  {
100    NSParameterAssert (party);    NSParameterAssert (party);
101        
# Line 107  _convertForURL (NSString * s) Line 108  _convertForURL (NSString * s)
108                               _convertForURL([party gameName]),                               _convertForURL([party gameName]),
109                               [party numPlayers],                               [party numPlayers],
110                               [party maxNumPlayers],                               [party maxNumPlayers],
111                                 _convertForURL([party mapName]),
112                               _convertForURL([party master]),                               _convertForURL([party master]),
113                               _convertForURL([party mapName])];                              [[NSProcessInfo processInfo] operatingSystemName]];
114    url = [NSURL URLWithString: addressRequest];    url = [NSURL URLWithString: addressRequest];
115    data = [NSData dataWithContentsOfURL: url];    data = [NSData dataWithContentsOfURL: url];
116    
117    puts ([addressRequest cString]);    //  puts ([addressRequest cString]);
118    
119    if ([data length] != 0)    if ([data length] != 0)
120      {      {
       puts ((char *)[data bytes]);  
121        return YES;        return YES;
122      }      }
123    else    else
# Line 164  _convertForURL (NSString * s) Line 165  _convertForURL (NSString * s)
165    NetConnection  *connexion;    NetConnection  *connexion;
166    NSPort         *port;    NSPort         *port;
167    
   puts ("Entre dans addParty");  
     
168    NSException *myException = [NSException    NSException *myException = [NSException
169                                 exceptionWithName:@"partyNameException"                                 exceptionWithName:@"partyNameException"
170                                 reason:@"partyName already exists"                                 reason:@"partyName already exists"
# Line 184  _convertForURL (NSString * s) Line 183  _convertForURL (NSString * s)
183        
184    [connexion registerName: [party gameName]];    [connexion registerName: [party gameName]];
185    
186      if ([self updateServerListWithParty: party] == YES)
187    puts("Party enregistrée");      puts ("Meta server is updated");
     
   
   if ([NetServer updateServerListWithParty: party] == YES)  
     puts ("OK");  
188    else    else
189      puts ("Pas Ok");      puts ("Error -> meta server is not updated");
190  }  }
191    
192    

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26