Changeset 6bbb939
- Timestamp:
- 2007-04-16T04:01:13Z (18 years ago)
- Branches:
- master
- Children:
- cfc8d58
- Parents:
- 84b045d
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_commands.c
r84b045d r6bbb939 263 263 irc->is_private = 1; 264 264 } 265 irc_send( irc, cmd[1], cmd[2], ( g_strcasecmp( cmd[0], "NOTICE" ) == 0 ) ? IM_FLAG_AWAY : 0 );265 irc_send( irc, cmd[1], cmd[2], ( g_strcasecmp( cmd[0], "NOTICE" ) == 0 ) ? OPT_AWAY : 0 ); 266 266 } 267 267 } -
protocols/jabber/iq.c
r84b045d r6bbb939 388 388 just try to handle this as well as we can. */ 389 389 jabber_buddy_remove_bare( ic, jid ); 390 serv_got_update( ic, jid, 0, 0, 0, 0, 0, 0);390 imcb_buddy_status( ic, jid, 0, NULL, NULL ); 391 391 /* FIXME! */ 392 392 } -
protocols/jabber/presence.c
r84b045d r6bbb939 38 38 if( type == NULL ) 39 39 { 40 int is_away = 0; 41 40 42 if( !( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) ) 41 43 { … … 52 54 53 55 if( ( c = xt_find_node( node->children, "show" ) ) && c->text_len > 0 ) 56 { 54 57 bud->away_state = (void*) jabber_away_state_by_code( c->text ); 58 if( strcmp( c->text, "chat" ) != 0 ) 59 is_away = OPT_AWAY; 60 } 55 61 else 56 62 { … … 66 72 bud->priority = 0; 67 73 68 serv_got_update( ic, bud->bare_jid, 1, 0, 0, 0, 69 bud->away_state ? UC_UNAVAILABLE : 0, 0 ); 74 /* FIXME: What to send if there are other resources??? */ 75 imcb_buddy_status( ic, bud->bare_jid, OPT_LOGGED_IN | is_away, 76 bud->away_state->full_name, bud->away_message ); 70 77 } 71 78 else if( strcmp( type, "unavailable" ) == 0 ) … … 87 94 available anymore. */ 88 95 if( jabber_buddy_by_jid( ic, from, 0 ) == NULL ) 89 serv_got_update( ic, from, 0, 0, 0, 0, 0, 0);96 imcb_buddy_status( ic, from, 0, NULL, NULL ); 90 97 91 98 *s = '/'; … … 93 100 else 94 101 { 95 serv_got_update( ic, from, 0, 0, 0, 0, 0, 0);102 imcb_buddy_status( ic, from, 0, NULL, NULL ); 96 103 } 97 104 } -
protocols/msn/msn.c
r84b045d r6bbb939 192 192 } 193 193 194 static char *msn_get_status_string( struct im_connection *ic, int number )195 {196 const struct msn_away_state *st = msn_away_state_by_number( number );197 198 if( st )199 return( (char*) st->name );200 else201 return( "" );202 }203 204 194 static void msn_set_away( struct im_connection *ic, char *state, char *message ) 205 195 { … … 399 389 ret->send_im = msn_send_im; 400 390 ret->away_states = msn_away_states; 401 ret->get_status_string = msn_get_status_string;402 391 ret->set_away = msn_set_away; 403 392 ret->get_info = msn_get_info; -
protocols/msn/ns.c
r84b045d r6bbb939 400 400 } 401 401 402 serv_got_update( ic, cmd[3], 1, 0, 0, 0, st->number, 0 ); 402 imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN | 403 ( st->number ? OPT_AWAY : 0 ), st->name, NULL ); 403 404 } 404 405 else if( strcmp( cmd[0], "FLN" ) == 0 ) 405 406 { 406 407 if( cmd[1] ) 407 serv_got_update( ic, cmd[1], 0, 0, 0, 0, 0, 0);408 imcb_buddy_status( ic, cmd[1], 0, NULL, NULL ); 408 409 } 409 410 else if( strcmp( cmd[0], "NLN" ) == 0 ) … … 428 429 } 429 430 430 serv_got_update( ic, cmd[2], 1, 0, 0, 0, st->number, 0 ); 431 imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN | 432 ( st->number ? OPT_AWAY : 0 ), st->name, NULL ); 431 433 } 432 434 else if( strcmp( cmd[0], "RNG" ) == 0 ) -
protocols/nogaim.c
r84b045d r6bbb939 187 187 188 188 if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) || 189 ( ( ic->flags & OPT_ CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )189 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) ) 190 190 strip_html( text ); 191 191 … … 494 494 /* server.c */ 495 495 496 void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps)496 void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message ) 497 497 { 498 498 user_t *u; 499 499 int oa, oo; 500 500 501 u = user_findhandle( ic, handle );501 u = user_findhandle( ic, (char*) handle ); 502 502 503 503 if( !u ) … … 505 505 if( g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "add" ) == 0 ) 506 506 { 507 add_buddy( ic, NULL, handle, NULL );508 u = user_findhandle( ic, handle );507 add_buddy( ic, NULL, (char*) handle, NULL ); 508 u = user_findhandle( ic, (char*) handle ); 509 509 } 510 510 else … … 512 512 if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 ) 513 513 { 514 imcb_log( ic, "serv_got_update() for handle %s:", handle ); 515 imcb_log( ic, "loggedin = %d, type = %d", loggedin, type ); 514 imcb_log( ic, "imcb_buddy_status() for unknown handle %s:", handle ); 515 imcb_log( ic, "flags = %d, state = %s, message = %s", flags, 516 state ? state : "NULL", message ? message : "NULL" ); 516 517 } 517 518 518 519 return; 519 520 } 520 /* Why did we have this here....521 return; */522 521 } 523 522 … … 531 530 } 532 531 533 if( loggedin&& !u->online )532 if( ( flags & OPT_LOGGED_IN ) && !u->online ) 534 533 { 535 534 irc_spawn( ic->irc, u ); 536 535 u->online = 1; 537 536 } 538 else if( ! loggedin&& u->online )537 else if( !( flags & OPT_LOGGED_IN ) && u->online ) 539 538 { 540 539 struct groupchat *c; … … 545 544 /* Remove him/her from the conversations to prevent PART messages after he/she QUIT already */ 546 545 for( c = ic->conversations; c; c = c->next ) 547 remove_chat_buddy_silent( c, handle ); 548 } 549 550 if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "oscar" ) == 0 || strcmp( ic->acc->prpl->name, "icq" ) == 0 ) ) 551 { 552 u->away = g_strdup( "Away" ); 553 } 554 else if( ( type & UC_UNAVAILABLE ) && ic->acc->prpl->get_status_string ) 555 { 556 u->away = g_strdup( ic->acc->prpl->get_status_string( ic, type ) ); 557 } 558 else 559 u->away = NULL; 546 remove_chat_buddy_silent( c, (char*) handle ); 547 } 548 549 if( flags & OPT_AWAY ) 550 { 551 if( state && message ) 552 { 553 u->away = g_strdup_printf( "%s (%s)", state, message ); 554 } 555 else if( state ) 556 { 557 u->away = g_strdup( state ); 558 } 559 else if( message ) 560 { 561 u->away = g_strdup( message ); 562 } 563 else 564 { 565 u->away = g_strdup( "Away" ); 566 } 567 } 568 /* else waste_any_state_information_for_now(); */ 560 569 561 570 /* LISPy... */ … … 612 621 613 622 if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) || 614 ( ( ic->flags & OPT_ CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )623 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) ) 615 624 strip_html( msg ); 616 625 … … 718 727 719 728 if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) || 720 ( ( ic->flags & OPT_ CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )729 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) ) 721 730 strip_html( msg ); 722 731 … … 925 934 int st; 926 935 927 if( ( ic->flags & OPT_ CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )936 if( ( ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) 928 937 { 929 938 buf = escape_html( msg ); … … 941 950 char *buf = NULL; 942 951 943 if( ( c->ic->flags & OPT_ CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )952 if( ( c->ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) 944 953 { 945 954 buf = escape_html( msg ); -
protocols/nogaim.h
r84b045d r6bbb939 6 6 7 7 /* 8 * nogaim 8 * nogaim, soon to be known as im_api. Not a separate product (unless 9 * someone would be interested in such a thing), just a new name. 9 10 * 10 11 * Gaim without gaim - for BitlBee … … 15 16 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> 16 17 * (and possibly other members of the Gaim team) 17 * Copyright 2002-200 4Wilmer van der Gaast <wilmer@gaast.net>18 * Copyright 2002-2007 Wilmer van der Gaast <wilmer@gaast.net> 18 19 */ 19 20 … … 44 45 #include "sha.h" 45 46 46 47 47 #define BUF_LEN MSG_LEN 48 48 #define BUF_LONG ( BUF_LEN * 2 ) … … 54 54 55 55 #define WEBSITE "http://www.bitlbee.org/" 56 #define IM_FLAG_AWAY 0x002057 56 #define GAIM_AWAY_CUSTOM "Custom" 58 57 59 #define OPT_CONN_HTML 0x00000001 60 #define OPT_LOGGED_IN 0x00010000 61 #define OPT_LOGGING_OUT 0x00020000 58 /* Sharing flags between buddies and connections. Or planning to, at least... */ 59 #define OPT_LOGGED_IN 0x00000001 60 #define OPT_LOGGING_OUT 0x00000002 61 #define OPT_AWAY 0x00000004 62 #define OPT_DOES_HTML 0x00000010 62 63 63 64 /* ok. now the fun begins. first we create a connection structure */ … … 65 66 { 66 67 account_t *acc; 67 guint32flags;68 u_int32_t flags; 68 69 69 70 /* each connection then can have its own protocol-specific data */ … … 164 165 (* chat_join) (struct im_connection *, char *chat, char *nick, char *password); 165 166 166 /* DIE! */167 char *(* get_status_string) (struct im_connection *ic, int stat);168 169 167 GList *(* away_states)(struct im_connection *ic); 170 168 … … 201 199 G_MODULE_EXPORT void serv_got_chat_left( struct groupchat *c ); 202 200 struct groupchat *chat_by_channel( char *channel ); 203 struct groupchat *chat_by_id( int id );204 201 205 202 /* Buddy management */ … … 209 206 210 207 /* Buddy activity */ 211 G_MODULE_EXPORT void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps ); 208 G_MODULE_EXPORT void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message ); 209 /* Not implemented yet! */ G_MODULE_EXPORT void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle ); 212 210 G_MODULE_EXPORT void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 flags, time_t mtime, gint len ); 213 211 G_MODULE_EXPORT void serv_got_typing( struct im_connection *ic, char *handle, int timeout, int type ); -
protocols/oscar/oscar.c
r84b045d r6bbb939 365 365 Let's hope nothing will break. ;-) */ 366 366 } else { 367 ic->flags |= OPT_ CONN_HTML;367 ic->flags |= OPT_DOES_HTML; 368 368 } 369 369 … … 968 968 aim_userinfo_t *info; 969 969 time_t time_idle = 0, signon = 0; 970 int type = 0; 971 int caps = 0; 972 char *tmp; 970 int flags = OPT_LOGGED_IN; 971 char *tmp, *state_string = NULL; 973 972 974 973 va_list ap; … … 977 976 va_end(ap); 978 977 979 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)980 caps = info->capabilities;981 if (info->flags & AIM_FLAG_ACTIVEBUDDY)982 type |= UC_AB;983 984 978 if ((!od->icq) && (info->present & AIM_USERINFO_PRESENT_FLAGS)) { 985 if (info->flags & AIM_FLAG_UNCONFIRMED)986 type |= UC_UNCONFIRMED;987 if (info->flags & AIM_FLAG_ADMINISTRATOR)988 type |= UC_ADMIN;989 if (info->flags & AIM_FLAG_AOL)990 type |= UC_AOL;991 if (info->flags & AIM_FLAG_FREE)992 type |= UC_NORMAL;993 979 if (info->flags & AIM_FLAG_AWAY) 994 type |= UC_UNAVAILABLE; 995 if (info->flags & AIM_FLAG_WIRELESS) 996 type |= UC_WIRELESS; 997 } 980 flags |= OPT_AWAY; 981 } 982 998 983 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { 999 type = (info->icqinfo.status << 7);1000 984 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && 1001 985 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { 1002 type |= UC_UNAVAILABLE;986 flags |= OPT_AWAY; 1003 987 } 1004 } 1005 1006 if (caps & AIM_CAPS_ICQ) 1007 caps ^= AIM_CAPS_ICQ; 988 989 if( info->icqinfo.status & AIM_ICQ_STATE_DND ) 990 state_string = "Do Not Disturb"; 991 else if( info->icqinfo.status & AIM_ICQ_STATE_OUT ) 992 state_string = "Not Available"; 993 else if( info->icqinfo.status & AIM_ICQ_STATE_BUSY ) 994 state_string = "Occupied"; 995 else if( info->icqinfo.status & AIM_ICQ_STATE_INVISIBLE ) 996 state_string = "Invisible"; 997 } 1008 998 1009 999 if (info->present & AIM_USERINFO_PRESENT_IDLE) { … … 1020 1010 g_free(tmp); 1021 1011 1022 serv_got_update(ic, info->sn, 1, info->warnlevel/10, signon,1023 time_idle, type, caps);1012 imcb_buddy_status(ic, info->sn, flags, state_string, NULL); 1013 /* imcb_buddy_times(ic, info->sn, signon, time_idle); */ 1024 1014 1025 1015 return 1; … … 1035 1025 va_end(ap); 1036 1026 1037 serv_got_update(ic, info->sn, 0, 0, 0, 0, 0, 0);1027 imcb_buddy_status(ic, info->sn, 0, NULL, NULL ); 1038 1028 1039 1029 return 1; … … 1046 1036 1047 1037 if (args->icbmflags & AIM_IMFLAGS_AWAY) 1048 flags |= IM_FLAG_AWAY;1038 flags |= OPT_AWAY; 1049 1039 1050 1040 if ((args->icbmflags & AIM_IMFLAGS_UNICODE) || (args->icbmflags & AIM_IMFLAGS_ISO_8859_1)) { … … 1821 1811 struct oscar_data *odata = (struct oscar_data *)ic->proto_data; 1822 1812 int ret = 0, len = strlen(message); 1823 if (imflags & IM_FLAG_AWAY) {1813 if (imflags & OPT_AWAY) { 1824 1814 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message); 1825 1815 } else { … … 2445 2435 } 2446 2436 2447 static char *oscar_get_status_string( struct im_connection *ic, int number )2448 {2449 struct oscar_data *od = ic->proto_data;2450 2451 if( ! number & UC_UNAVAILABLE )2452 {2453 return( NULL );2454 }2455 else if( od->icq )2456 {2457 number >>= 7;2458 if( number & AIM_ICQ_STATE_DND )2459 return( "Do Not Disturb" );2460 else if( number & AIM_ICQ_STATE_OUT )2461 return( "Not Available" );2462 else if( number & AIM_ICQ_STATE_BUSY )2463 return( "Occupied" );2464 else if( number & AIM_ICQ_STATE_INVISIBLE )2465 return( "Invisible" );2466 else2467 return( "Away" );2468 }2469 else2470 {2471 return( "Away" );2472 }2473 }2474 2475 2437 int oscar_send_typing(struct im_connection *ic, char * who, int typing) 2476 2438 { … … 2633 2595 ret->rem_deny = oscar_rem_deny; 2634 2596 ret->set_permit_deny = oscar_set_permit_deny; 2635 ret->get_status_string = oscar_get_status_string;2636 2597 ret->send_typing = oscar_send_typing; 2637 2598 -
protocols/yahoo/yahoo.c
r84b045d r6bbb939 293 293 } 294 294 295 static char *byahoo_get_status_string( struct im_connection *ic, int stat )296 {297 enum yahoo_status a = stat >> 1;298 299 switch (a)300 {301 case YAHOO_STATUS_BRB:302 return "Be Right Back";303 case YAHOO_STATUS_BUSY:304 return "Busy";305 case YAHOO_STATUS_NOTATHOME:306 return "Not At Home";307 case YAHOO_STATUS_NOTATDESK:308 return "Not At Desk";309 case YAHOO_STATUS_NOTINOFFICE:310 return "Not In Office";311 case YAHOO_STATUS_ONPHONE:312 return "On Phone";313 case YAHOO_STATUS_ONVACATION:314 return "On Vacation";315 case YAHOO_STATUS_OUTTOLUNCH:316 return "Out To Lunch";317 case YAHOO_STATUS_STEPPEDOUT:318 return "Stepped Out";319 case YAHOO_STATUS_INVISIBLE:320 return "Invisible";321 case YAHOO_STATUS_CUSTOM:322 return "Away";323 case YAHOO_STATUS_IDLE:324 return "Idle";325 case YAHOO_STATUS_OFFLINE:326 return "Offline";327 case YAHOO_STATUS_NOTIFY:328 return "Notify";329 default:330 return "Away";331 }332 }333 334 295 static void byahoo_chat_send( struct groupchat *c, char *message, int flags ) 335 296 { … … 393 354 ret->add_buddy = byahoo_add_buddy; 394 355 ret->remove_buddy = byahoo_remove_buddy; 395 ret->get_status_string = byahoo_get_status_string;396 356 ret->send_typing = byahoo_send_typing; 397 357 … … 586 546 { 587 547 struct im_connection *ic = byahoo_get_ic_by_id( id ); 588 589 serv_got_update( ic, who, stat != YAHOO_STATUS_OFFLINE, 0, 0, 590 ( stat == YAHOO_STATUS_IDLE ) ? away : 0, 591 ( stat != YAHOO_STATUS_AVAILABLE ) | ( stat << 1 ), 0 ); 548 char *state_string = NULL; 549 int flags = OPT_LOGGED_IN; 550 551 if( away ) 552 flags |= OPT_AWAY; 553 554 switch (stat) 555 { 556 case YAHOO_STATUS_BRB: 557 state_string = "Be Right Back"; 558 break; 559 case YAHOO_STATUS_BUSY: 560 state_string = "Busy"; 561 break; 562 case YAHOO_STATUS_NOTATHOME: 563 state_string = "Not At Home"; 564 break; 565 case YAHOO_STATUS_NOTATDESK: 566 state_string = "Not At Desk"; 567 break; 568 case YAHOO_STATUS_NOTINOFFICE: 569 state_string = "Not In Office"; 570 break; 571 case YAHOO_STATUS_ONPHONE: 572 state_string = "On Phone"; 573 break; 574 case YAHOO_STATUS_ONVACATION: 575 state_string = "On Vacation"; 576 break; 577 case YAHOO_STATUS_OUTTOLUNCH: 578 state_string = "Out To Lunch"; 579 break; 580 case YAHOO_STATUS_STEPPEDOUT: 581 state_string = "Stepped Out"; 582 break; 583 case YAHOO_STATUS_INVISIBLE: 584 state_string = "Invisible"; 585 break; 586 case YAHOO_STATUS_CUSTOM: 587 state_string = "Away"; 588 break; 589 case YAHOO_STATUS_IDLE: 590 state_string = "Idle"; 591 break; 592 case YAHOO_STATUS_OFFLINE: 593 state_string = "Offline"; 594 flags = 0; 595 break; 596 case YAHOO_STATUS_NOTIFY: 597 state_string = "Notify"; 598 break; 599 } 600 601 imcb_buddy_status( ic, who, flags, state_string, msg ); 602 603 /* Not implemented yet... 604 if( stat == YAHOO_STATUS_IDLE ) 605 imcb_buddy_times( ic, who, 0, away ); 606 */ 592 607 } 593 608
Note: See TracChangeset
for help on using the changeset viewer.