Changeset aef4828 for protocols/nogaim.c
- Timestamp:
- 2007-04-06T05:20:31Z (17 years ago)
- Branches:
- master
- Children:
- 552e641
- Parents:
- 0da65d5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
r0da65d5 raef4828 145 145 /* multi.c */ 146 146 147 struct im_connection * new_gaim_conn( account_t *acc )147 struct im_connection *imc_new( account_t *acc ) 148 148 { 149 149 struct im_connection *ic; … … 164 164 } 165 165 166 void destroy_gaim_conn( struct im_connection *ic )166 void imc_free( struct im_connection *ic ) 167 167 { 168 168 account_t *a; … … 180 180 } 181 181 182 void set_login_progress( struct im_connection *ic, int step, char *msg ) 183 { 184 serv_got_crap( ic, "Logging in: %s", msg ); 185 } 186 187 /* Errors *while* logging in */ 188 void hide_login_progress( struct im_connection *ic, char *msg ) 189 { 190 serv_got_crap( ic, "Login error: %s", msg ); 191 } 192 193 /* Errors *after* logging in */ 194 void hide_login_progress_error( struct im_connection *ic, char *msg ) 195 { 196 serv_got_crap( ic, "Logged out: %s", msg ); 197 } 198 199 void serv_got_crap( struct im_connection *ic, char *format, ... ) 182 static void serv_got_crap( struct im_connection *ic, char *format, ... ) 200 183 { 201 184 va_list params; … … 225 208 } 226 209 210 void imc_log( struct im_connection *ic, char *format, ... ) 211 { 212 va_list params; 213 char *text; 214 215 va_start( params, format ); 216 text = g_strdup_vprintf( format, params ); 217 va_end( params ); 218 219 if( ic->flags & OPT_LOGGED_IN ) 220 serv_got_crap( ic, "%s", text ); 221 else 222 serv_got_crap( ic, "Logging in: %s", text ); 223 224 g_free( text ); 225 } 226 227 void imc_error( struct im_connection *ic, char *format, ... ) 228 { 229 va_list params; 230 char *text; 231 232 va_start( params, format ); 233 text = g_strdup_vprintf( format, params ); 234 va_end( params ); 235 236 if( ic->flags & OPT_LOGGED_IN ) 237 serv_got_crap( ic, "Error: %s", text ); 238 else 239 serv_got_crap( ic, "Couldn't log in: %s", text ); 240 241 g_free( text ); 242 } 243 227 244 static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond ) 228 245 { … … 235 252 } 236 253 237 void account_online( struct im_connection *ic )254 void imc_connected( struct im_connection *ic ) 238 255 { 239 256 user_t *u; … … 247 264 u = user_find( ic->irc, ic->irc->nick ); 248 265 249 serv_got_crap( ic, "Logged in" );266 imc_log( ic, "Logged in" ); 250 267 251 268 ic->keepalive = b_timeout_add( 60000, send_keepalive, ic ); … … 274 291 } 275 292 276 void signoff( struct im_connection *ic )293 void imc_logout( struct im_connection *ic ) 277 294 { 278 295 irc_t *irc = ic->irc; … … 287 304 ic->flags |= OPT_LOGGING_OUT; 288 305 289 serv_got_crap( ic, "Signing off.." );306 imc_log( ic, "Signing off.." ); 290 307 291 308 b_event_remove( ic->keepalive ); … … 321 338 int delay = set_getint( &irc->set, "auto_reconnect_delay" ); 322 339 323 serv_got_crap( ic, "Reconnecting in %d seconds..", delay );340 imc_log( ic, "Reconnecting in %d seconds..", delay ); 324 341 a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a ); 325 342 } 326 343 327 destroy_gaim_conn( ic );344 imc_free( ic ); 328 345 } 329 346 330 347 331 348 /* dialogs.c */ 332 333 void do_error_dialog( struct im_connection *ic, char *msg, char *title )334 {335 if( msg && title )336 serv_got_crap( ic, "Error: %s: %s", title, msg );337 else if( msg )338 serv_got_crap( ic, "Error: %s", msg );339 else if( title )340 serv_got_crap( ic, "Error: %s", title );341 else342 serv_got_crap( ic, "Error" );343 }344 349 345 350 void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont ) … … 359 364 360 365 if( set_getbool( &irc->set, "debug" ) && 0 ) /* This message is too useless */ 361 serv_got_crap( ic, "Receiving user add from handle: %s", handle );366 imc_log( ic, "Receiving user add from handle: %s", handle ); 362 367 363 368 if( user_findhandle( ic, handle ) ) 364 369 { 365 370 if( set_getbool( &irc->set, "debug" ) ) 366 serv_got_crap( ic, "User already exists, ignoring add request: %s", handle );371 imc_log( ic, "User already exists, ignoring add request: %s", handle ); 367 372 368 373 return; … … 452 457 453 458 if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) ) 454 serv_got_crap( ic, "User `%s' changed name to `%s'", u->nick, u->realname );459 imc_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname ); 455 460 } 456 461 } … … 516 521 if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 ) 517 522 { 518 serv_got_crap( ic, "serv_got_update() for handle %s:", handle );519 serv_got_crap( ic, "loggedin = %d, type = %d", loggedin, type );523 imc_log( ic, "serv_got_update() for handle %s:", handle ); 524 imc_log( ic, "loggedin = %d, type = %d", loggedin, type ); 520 525 } 521 526 … … 597 602 { 598 603 if( set_getbool( &irc->set, "debug" ) ) 599 serv_got_crap( ic, "Ignoring message from unknown handle %s", handle );604 imc_log( ic, "Ignoring message from unknown handle %s", handle ); 600 605 601 606 return; … … 619 624 else 620 625 { 621 serv_got_crap( ic, "Message from unknown handle %s:", handle );626 imc_log( ic, "Message from unknown handle %s:", handle ); 622 627 u = user_find( irc, irc->mynick ); 623 628 } … … 689 694 690 695 if( set_getbool( &ic->irc->set, "debug" ) ) 691 serv_got_crap( ic, "You were removed from conversation 0x%x", (int) c );696 imc_log( ic, "You were removed from conversation 0x%x", (int) c ); 692 697 693 698 if( c ) … … 737 742 irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", msg ); 738 743 else 739 serv_got_crap( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg );744 imc_log( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg ); 740 745 } 741 746 … … 759 764 760 765 if( set_getbool( &ic->irc->set, "debug" ) ) 761 serv_got_crap( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );766 imc_log( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle ); 762 767 763 768 return c; … … 773 778 774 779 if( set_getbool( &b->ic->irc->set, "debug" ) ) 775 serv_got_crap( b->ic, "User %s added to conversation 0x%x", handle, (int) b );780 imc_log( b->ic, "User %s added to conversation 0x%x", handle, (int) b ); 776 781 777 782 /* It might be yourself! */ … … 807 812 808 813 if( set_getbool( &b->ic->irc->set, "debug" ) ) 809 serv_got_crap( b->ic, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" );814 imc_log( b->ic, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" ); 810 815 811 816 /* It might be yourself! */ … … 1005 1010 ic->acc->prpl->set_away( ic, s, away ); 1006 1011 if( set_getbool( &ic->irc->set, "debug" ) ) 1007 serv_got_crap( ic, "Setting away state to %s", s );1012 imc_log( ic, "Setting away state to %s", s ); 1008 1013 } 1009 1014 else
Note: See TracChangeset
for help on using the changeset viewer.