Changeset 568aaf7
- Timestamp:
- 2005-12-13T21:39:18Z (19 years ago)
- Branches:
- master
- Children:
- 703f0f7
- Parents:
- 019c031
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
r019c031 r568aaf7 247 247 * function is here merely because the save/load code still uses 248 248 * ids rather then names */ 249 st ruct prpl *find_protocol_by_id(int id)249 static struct prpl *find_protocol_by_id(int id) 250 250 { 251 251 switch (id) { … … 259 259 } 260 260 261 static int find_protocol_id(const char *name) 262 { 263 if (!strcmp(name, "oscar")) return 1; 264 if (!strcmp(name, "msn")) return 4; 265 if (!strcmp(name, "yahoo")) return 2; 266 if (!strcmp(name, "jabber")) return 8; 267 268 return -1; 269 } 270 261 271 int bitlbee_load( irc_t *irc, char* password ) 262 272 { 263 273 char s[512]; 264 274 char *line; 265 char proto[20];275 int proto; 266 276 char nick[MAX_NICK_LENGTH+1]; 267 277 FILE *fp; … … 298 308 fp = fopen( s, "r" ); 299 309 if( !fp ) return( 0 ); 300 while( fscanf( fp, "%s % s %s", s,proto, nick ) > 0 )310 while( fscanf( fp, "%s %d %s", s, &proto, nick ) > 0 ) 301 311 { 302 312 struct prpl *prpl; 303 313 304 prpl = find_protocol(proto); 305 306 /* Older files saved the protocol number rather then the protocol name */ 307 if (!prpl && atoi(proto)) { 308 prpl = find_protocol_by_id(atoi(proto)); 309 } 314 prpl = find_protocol_by_id(proto); 310 315 311 316 if (!prpl) … … 368 373 s[169] = 0; /* Prevent any overflow (169 ~ 512 / 3) */ 369 374 http_encode( s ); 370 g_snprintf( s + strlen( s ), 510 - strlen( s ), " % s %s", n->proto->name, n->nick );375 g_snprintf( s + strlen( s ), 510 - strlen( s ), " %d %s", find_protocol_id(n->proto->name), n->nick ); 371 376 if( fprintf( fp, "%s\n", s ) != strlen( s ) + 1 ) 372 377 {
Note: See TracChangeset
for help on using the changeset viewer.