Changeset bf02a67 for storage_text.c
- Timestamp:
- 2005-12-15T11:55:27Z (18 years ago)
- Branches:
- master
- Children:
- 15832cc, bd69a21
- Parents:
- 11e090b (diff), 547f937 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
storage_text.c
r11e090b rbf02a67 27 27 #include "bitlbee.h" 28 28 #include "crypting.h" 29 30 /* DO NOT USE THIS FUNCTION IN NEW CODE. This 31 * function is here merely because the save/load code still uses 32 * ids rather than names */ 33 static struct prpl *find_protocol_by_id(int id) 34 { 35 switch (id) { 36 case 1: return find_protocol("oscar"); 37 case 4: return find_protocol("msn"); 38 case 2: return find_protocol("yahoo"); 39 case 8: return find_protocol("jabber"); 40 default: break; 41 } 42 return NULL; 43 } 44 45 static int find_protocol_id(const char *name) 46 { 47 if (!strcmp(name, "oscar")) return 1; 48 if (!strcmp(name, "msn")) return 4; 49 if (!strcmp(name, "yahoo")) return 2; 50 if (!strcmp(name, "jabber")) return 8; 51 52 return -1; 53 } 54 29 55 30 56 static void text_init (void) … … 79 105 while( fscanf( fp, "%s %d %s", s, &proto, nick ) > 0 ) 80 106 { 107 struct prpl *prpl; 108 109 prpl = find_protocol_by_id(proto); 110 111 if (!prpl) 112 continue; 113 81 114 http_decode( s ); 82 nick_set( irc, s, pr oto, nick );115 nick_set( irc, s, prpl, nick ); 83 116 } 84 117 fclose( fp ); … … 145 178 s[169] = 0; /* Prevent any overflow (169 ~ 512 / 3) */ 146 179 http_encode( s ); 147 g_snprintf( s + strlen( s ), 510 - strlen( s ), " %d %s", n->proto, n->nick );180 g_snprintf( s + strlen( s ), 510 - strlen( s ), " %d %s", find_protocol_id(n->proto->name), n->nick ); 148 181 if( fprintf( fp, "%s\n", s ) != strlen( s ) + 1 ) 149 182 { … … 187 220 for( a = irc->accounts; a; a = a->next ) 188 221 { 189 if( a->protocol == PROTO_OSCAR || a->protocol == PROTO_ICQ || a->protocol == PROTO_TOC)222 if( !strcmp(a->prpl->name, "oscar") ) 190 223 g_snprintf( s, sizeof( s ), "account add oscar \"%s\" \"%s\" %s", a->user, a->pass, a->server ); 191 224 else 192 225 g_snprintf( s, sizeof( s ), "account add %s \"%s\" \"%s\" \"%s\"", 193 proto_name[a->protocol], a->user, a->pass, a->server ? a->server : "" );226 a->prpl->name, a->user, a->pass, a->server ? a->server : "" ); 194 227 195 228 line = obfucrypt( s, irc->password );
Note: See TracChangeset
for help on using the changeset viewer.