- Timestamp:
- 2007-03-28T05:53:11Z (18 years ago)
- Branches:
- master
- Children:
- 0da65d5
- Parents:
- 723e611
- Location:
- protocols
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
r723e611 rfa29d093 241 241 } 242 242 243 static int msn_chat_send( struct gaim_connection *gc, int id, char *message )244 { 245 struct msn_switchboard *sb = msn_sb_by_ id( gc, id);243 static int msn_chat_send( struct conversation *c, char *message ) 244 { 245 struct msn_switchboard *sb = msn_sb_by_chat( c ); 246 246 247 247 if( sb ) … … 251 251 } 252 252 253 static void msn_chat_invite( struct gaim_connection *gc, int id, char *msg, char *who )254 { 255 struct msn_switchboard *sb = msn_sb_by_ id( gc, id);253 static void msn_chat_invite( struct conversation *c, char *msg, char *who ) 254 { 255 struct msn_switchboard *sb = msn_sb_by_chat( c ); 256 256 char buf[1024]; 257 257 … … 263 263 } 264 264 265 static void msn_chat_leave( struct gaim_connection *gc, int id)266 { 267 struct msn_switchboard *sb = msn_sb_by_ id( gc, id);265 static void msn_chat_leave( struct conversation *c ) 266 { 267 struct msn_switchboard *sb = msn_sb_by_chat( c ); 268 268 269 269 if( sb ) … … 271 271 } 272 272 273 static intmsn_chat_open( struct gaim_connection *gc, char *who )273 static struct conversation *msn_chat_open( struct gaim_connection *gc, char *who ) 274 274 { 275 275 struct msn_switchboard *sb; … … 280 280 { 281 281 debug( "Converting existing switchboard to %s to a groupchat", who ); 282 msn_sb_to_chat( sb ); 283 return( 1 ); 282 return msn_sb_to_chat( sb ); 284 283 } 285 284 else … … 292 291 g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, who ); 293 292 if( msn_sb_write( sb, buf, strlen( buf ) ) ) 294 { 295 msn_sb_to_chat( sb ); 296 return( 1 ); 297 } 293 return msn_sb_to_chat( sb ); 298 294 } 299 295 … … 314 310 md->msgq = g_slist_append( md->msgq, m ); 315 311 316 return( 1 ); 317 } 318 319 return( 0 ); 312 /* FIXME: Can I try to return something here already? */ 313 return NULL; 314 } 315 316 return NULL; 320 317 } 321 318 -
protocols/msn/msn.h
r723e611 rfa29d093 169 169 struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, int port, char *key, int session ); 170 170 struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *handle ); 171 struct msn_switchboard *msn_sb_by_ id( struct gaim_connection *gc, int id);171 struct msn_switchboard *msn_sb_by_chat( struct conversation *c ); 172 172 struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc ); 173 173 int msn_sb_sendmessage( struct msn_switchboard *sb, char *text ); 174 voidmsn_sb_to_chat( struct msn_switchboard *sb );174 struct conversation *msn_sb_to_chat( struct msn_switchboard *sb ); 175 175 void msn_sb_destroy( struct msn_switchboard *sb ); 176 176 gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ); -
protocols/msn/sb.c
r723e611 rfa29d093 86 86 } 87 87 88 struct msn_switchboard *msn_sb_by_ id( struct gaim_connection *gc, int id)89 { 90 struct msn_data *md = gc->proto_data;88 struct msn_switchboard *msn_sb_by_chat( struct conversation *c ) 89 { 90 struct msn_data *md = c->gc->proto_data; 91 91 struct msn_switchboard *sb; 92 92 GSList *l; … … 95 95 { 96 96 sb = l->data; 97 if( sb->chat && sb->chat->id == id)97 if( sb->chat == c ) 98 98 return( sb ); 99 99 } … … 177 177 } 178 178 179 voidmsn_sb_to_chat( struct msn_switchboard *sb )179 struct conversation *msn_sb_to_chat( struct msn_switchboard *sb ) 180 180 { 181 181 struct gaim_connection *gc = sb->gc; … … 184 184 /* Create the groupchat structure. */ 185 185 g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session ); 186 sb->chat = serv_got_joined_chat( gc, ++msn_chat_id,buf );186 sb->chat = serv_got_joined_chat( gc, buf ); 187 187 188 188 /* Populate the channel. */ … … 196 196 sb->who = NULL; 197 197 } 198 199 return sb->chat; 198 200 } 199 201 … … 230 232 if( sb->chat ) 231 233 { 232 serv_got_chat_left( gc, sb->chat->id);234 serv_got_chat_left( sb->chat ); 233 235 } 234 236 … … 372 374 { 373 375 g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session ); 374 sb->chat = serv_got_joined_chat( gc, ++msn_chat_id,buf );376 sb->chat = serv_got_joined_chat( gc, buf ); 375 377 376 378 g_free( sb->who ); … … 610 612 else if( sb->chat ) 611 613 { 612 serv_got_chat_in( gc, sb->chat->id, cmd[1], 0, body, 0 );614 serv_got_chat_in( sb->chat, cmd[1], 0, body, 0 ); 613 615 } 614 616 else … … 669 671 else if( sb->chat ) 670 672 { 671 serv_got_chat_in( gc, sb->chat->id, cmd[1], 0, buf, 0 );673 serv_got_chat_in( sb->chat, cmd[1], 0, buf, 0 ); 672 674 } 673 675 else -
protocols/nogaim.c
r723e611 rfa29d093 682 682 } 683 683 684 void serv_got_chat_left( struct gaim_connection *gc, int id ) 685 { 686 struct conversation *c, *l = NULL; 684 void serv_got_chat_left( struct conversation *c ) 685 { 686 struct gaim_connection *gc = c->gc; 687 struct conversation *l = NULL; 687 688 GList *ir; 688 689 689 690 if( set_getbool( &gc->irc->set, "debug" ) ) 690 serv_got_crap( gc, "You were removed from conversation %d", (int) id ); 691 692 for( c = gc->conversations; c && c->id != id; c = (l=c)->next ); 691 serv_got_crap( gc, "You were removed from conversation 0x%x", (int) c ); 693 692 694 693 if( c ) … … 720 719 } 721 720 722 void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime )723 { 724 struct conversation *c;721 void serv_got_chat_in( struct conversation *c, char *who, int whisper, char *msg, time_t mtime ) 722 { 723 struct gaim_connection *gc = c->gc; 725 724 user_t *u; 726 725 … … 730 729 731 730 u = user_findhandle( gc, who ); 732 for( c = gc->conversations; c && c->id != id; c = c->next );733 731 734 732 if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) || … … 739 737 irc_privmsg( gc->irc, u, "PRIVMSG", c->channel, "", msg ); 740 738 else 741 serv_got_crap( gc, "Message from/to conversation %s@ %d (unknown conv/user): %s", who, id, msg );742 } 743 744 struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id,char *handle )739 serv_got_crap( gc, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg ); 740 } 741 742 struct conversation *serv_got_joined_chat( struct gaim_connection *gc, char *handle ) 745 743 { 746 744 struct conversation *c; 747 char *s;748 745 749 746 /* This one just creates the conversation structure, user won't see anything yet */ … … 755 752 } 756 753 else 757 gc->conversations = c = g_new0( struct conversation, 1); 758 759 c->id = id; 754 gc->conversations = c = g_new0( struct conversation, 1 ); 755 760 756 c->gc = gc; 761 757 c->title = g_strdup( handle ); 762 763 s = g_new( char, 16 ); 764 sprintf( s, "&chat_%03d", gc->irc->c_id++ ); 765 c->channel = g_strdup( s ); 766 g_free( s ); 758 c->channel = g_strdup_printf( "&chat_%03d", gc->irc->c_id++ ); 767 759 768 760 if( set_getbool( &gc->irc->set, "debug" ) ) 769 serv_got_crap( gc, "Creating new conversation: (id= %d,handle=%s)", id, handle );770 771 return ( c );761 serv_got_crap( gc, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle ); 762 763 return c; 772 764 } 773 765 … … 781 773 782 774 if( set_getbool( &b->gc->irc->set, "debug" ) ) 783 serv_got_crap( b->gc, "User %s added to conversation %d", handle, b->id);775 serv_got_crap( b->gc, "User %s added to conversation 0x%x", handle, (int) b ); 784 776 785 777 /* It might be yourself! */ … … 815 807 816 808 if( set_getbool( &b->gc->irc->set, "debug" ) ) 817 serv_got_crap( b->gc, "User %s removed from conversation %d (%s)", handle, b->id, reason ? reason : "" );809 serv_got_crap( b->gc, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" ); 818 810 819 811 /* It might be yourself! */ … … 858 850 /* Misc. BitlBee stuff which shouldn't really be here */ 859 851 860 struct conversation *c onv_findchannel( char *channel )852 struct conversation *chat_by_channel( char *channel ) 861 853 { 862 854 struct gaim_connection *gc; … … 870 862 for( c = gc->conversations; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next ); 871 863 if( c ) 872 return ( c );873 } 874 875 return ( NULL );864 return c; 865 } 866 867 return NULL; 876 868 } 877 869 … … 958 950 } 959 951 960 int bim_chat_msg( struct gaim_connection *gc, int id, char *msg )952 int bim_chat_msg( struct conversation *c, char *msg ) 961 953 { 962 954 char *buf = NULL; 963 955 int st; 964 956 965 if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )957 if( ( c->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) 966 958 { 967 959 buf = escape_html( msg ); … … 969 961 } 970 962 971 st = gc->acc->prpl->chat_send( gc, id, msg );963 st = c->gc->acc->prpl->chat_send( c, msg ); 972 964 g_free( buf ); 973 965 -
protocols/nogaim.h
r723e611 rfa29d093 100 100 101 101 /* stuff used just for chat */ 102 GList *in_room; 103 GList *ignored; 104 int id; 105 106 /* BitlBee */ 107 struct conversation *next; 108 char *channel; 109 char *title; 110 char joined; 111 void *data; 102 GList *in_room; 103 GList *ignored; 104 105 /* BitlBee */ 106 struct conversation *next; 107 char *channel; 108 char *title; 109 char joined; 110 void *data; 112 111 }; 113 112 … … 115 114 char name[80]; 116 115 char show[BUDDY_ALIAS_MAXLEN]; 117 116 int present; 118 117 int evil; 119 118 time_t signon; 120 119 time_t idle; 121 120 int uc; 122 121 guint caps; /* woohoo! */ 123 122 void *proto_data; /* what a hack */ … … 153 152 154 153 /* Group chat stuff. */ 155 void (* join_chat) (struct gaim_connection *, GList *data); 156 void (* chat_invite) (struct gaim_connection *, int id, char *who, char *message); 157 void (* chat_leave) (struct gaim_connection *, int id); 158 int (* chat_send) (struct gaim_connection *, int id, char *message); 159 int (* chat_open) (struct gaim_connection *, char *who); 154 void (* chat_invite) (struct conversation *, char *who, char *message); 155 void (* chat_leave) (struct conversation *); 156 int (* chat_send) (struct conversation *, char *message); 157 struct conversation * 158 (* chat_open) (struct gaim_connection *, char *who); 159 struct conversation * 160 (* chat_join) (struct gaim_connection *, char *chat, char *nick, char *password); 160 161 161 162 /* DIE! */ … … 183 184 int bim_set_away( struct gaim_connection *gc, char *away ); 184 185 int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags ); 185 int bim_chat_msg( struct gaim_connection *gc, int id, char *msg );186 int bim_chat_msg( struct conversation *c, char *msg ); 186 187 187 188 void bim_add_allow( struct gaim_connection *gc, char *handle ); … … 224 225 G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *handle, const char *realname ); 225 226 226 /* server.c */ 227 /* server.c */ 227 228 G_MODULE_EXPORT void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps ); 228 229 G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len ); 229 230 G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type ); 230 231 G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data ); 231 G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, char *handle ); 232 G_MODULE_EXPORT void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime ); 233 G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id ); 234 235 struct conversation *conv_findchannel( char *channel ); 232 G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, char *handle ); 233 G_MODULE_EXPORT void serv_got_chat_in( struct conversation *c, char *who, int whisper, char *msg, time_t mtime ); 234 G_MODULE_EXPORT void serv_got_chat_left( struct conversation *c ); 235 236 struct conversation *chat_by_channel( char *channel ); 237 struct conversation *chat_by_id( int id ); 236 238 237 239 #endif -
protocols/oscar/oscar.c
r723e611 rfa29d093 157 157 return tmp; 158 158 } 159 160 static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) {161 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;162 struct chat_connection *c = NULL;163 164 while (g) {165 c = (struct chat_connection *)g->data;166 if (c->id == id)167 break;168 g = g->next;169 c = NULL;170 }171 172 return c;173 }174 175 159 176 160 static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc, … … 769 753 chatcon = find_oscar_chat_by_conn(gc, fr->conn); 770 754 chatcon->id = id; 771 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); 755 chatcon->cnv = serv_got_joined_chat(gc, chatcon->show); 756 chatcon->cnv->data = chatcon; 772 757 773 758 return 1; … … 1580 1565 tmp = g_malloc(BUF_LONG); 1581 1566 g_snprintf(tmp, BUF_LONG, "%s", msg); 1582 serv_got_chat_in( gc, ccon->id, info->sn, 0, tmp, time((time_t)NULL));1567 serv_got_chat_in(ccon->cnv, info->sn, 0, tmp, time((time_t)NULL)); 1583 1568 g_free(tmp); 1584 1569 … … 2521 2506 } 2522 2507 2523 int oscar_chat_send(struct gaim_connection * gc, int id, char *message) 2524 { 2508 int oscar_chat_send(struct conversation *c, char *message) 2509 { 2510 struct gaim_connection *gc = c->gc; 2525 2511 struct oscar_data * od = (struct oscar_data*)gc->proto_data; 2526 2512 struct chat_connection * ccon; … … 2530 2516 char *s; 2531 2517 2532 if(!(ccon = find_oscar_chat(gc, id))) 2533 return -1; 2518 ccon = c->data; 2534 2519 2535 2520 for (s = message; *s; s++) … … 2568 2553 } 2569 2554 2570 void oscar_chat_invite(struct gaim_connection * gc, int id, char *message, char *who) 2571 { 2555 void oscar_chat_invite(struct conversation *c, char *message, char *who) 2556 { 2557 struct gaim_connection *gc = c->gc; 2572 2558 struct oscar_data * od = (struct oscar_data *)gc->proto_data; 2573 struct chat_connection *ccon = find_oscar_chat(gc, id); 2574 2575 if (ccon == NULL) 2576 return; 2559 struct chat_connection *ccon = c->data; 2577 2560 2578 2561 aim_chat_invite(od->sess, od->conn, who, message ? message : "", … … 2585 2568 2586 2569 /* Notify the conversation window that we've left the chat */ 2587 serv_got_chat_left( gc, cc->id);2570 serv_got_chat_left(cc->cnv); 2588 2571 2589 2572 /* Destroy the chat_connection */ … … 2597 2580 } 2598 2581 2599 void oscar_chat_leave(struct gaim_connection * gc, int id) 2600 { 2601 struct chat_connection * ccon = find_oscar_chat(gc, id); 2602 2603 if(ccon == NULL) 2604 return; 2605 2606 oscar_chat_kill(gc, ccon); 2582 void oscar_chat_leave(struct conversation *c) 2583 { 2584 oscar_chat_kill(c->gc, c->data); 2607 2585 } 2608 2586 2609 2587 int oscar_chat_join(struct gaim_connection * gc, char * name) 2610 2588 { 2611 2589 struct oscar_data * od = (struct oscar_data *)gc->proto_data; 2612 2590 2613 2591 aim_conn_t * cur; … … 2627 2605 } 2628 2606 2629 intoscar_chat_open(struct gaim_connection * gc, char *who)2607 struct conversation *oscar_chat_open(struct gaim_connection * gc, char *who) 2630 2608 { 2631 2609 struct oscar_data * od = (struct oscar_data *)gc->proto_data; … … 2642 2620 g_free(chatname); 2643 2621 2644 return ret;2622 return NULL; 2645 2623 } 2646 2624 -
protocols/yahoo/yahoo.c
r723e611 rfa29d093 140 140 141 141 while( gc->conversations ) 142 serv_got_chat_left( gc , gc->conversations->id);142 serv_got_chat_left( gc->conversations ); 143 143 144 144 for( l = yd->buddygroups; l; l = l->next ) … … 332 332 } 333 333 334 static int byahoo_chat_send( struct gaim_connection *gc, int id, char *message ) 335 { 336 struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data; 337 struct conversation *c; 338 339 for( c = gc->conversations; c && c->id != id; c = c->next ); 340 334 static int byahoo_chat_send( struct conversation *c, char *message ) 335 { 336 struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data; 337 341 338 yahoo_conference_message( yd->y2_id, NULL, c->data, c->title, message, 1 ); 342 339 … … 344 341 } 345 342 346 static void byahoo_chat_invite( struct gaim_connection *gc, int id, char *msg, char *who ) 347 { 348 struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data; 349 struct conversation *c; 350 351 for( c = gc->conversations; c && c->id != id; c = c->next ); 343 static void byahoo_chat_invite( struct conversation *c, char *msg, char *who ) 344 { 345 struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data; 352 346 353 347 yahoo_conference_invite( yd->y2_id, NULL, c->data, c->title, msg ); 354 348 } 355 349 356 static void byahoo_chat_leave( struct gaim_connection *gc, int id ) 357 { 358 struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data; 359 struct conversation *c; 360 361 for( c = gc->conversations; c && c->id != id; c = c->next ); 350 static void byahoo_chat_leave( struct conversation *c ) 351 { 352 struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data; 362 353 363 354 yahoo_conference_logoff( yd->y2_id, NULL, c->data, c->title ); 364 serv_got_chat_left( gc, c->id);365 } 366 367 static intbyahoo_chat_open( struct gaim_connection *gc, char *who )355 serv_got_chat_left( c ); 356 } 357 358 static struct conversation *byahoo_chat_open( struct gaim_connection *gc, char *who ) 368 359 { 369 360 struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data; … … 375 366 g_snprintf( roomname, strlen( gc->username ) + 16, "%s-Bee-%d", gc->username, byahoo_chat_id ); 376 367 377 c = serv_got_joined_chat( gc, ++byahoo_chat_id,roomname );368 c = serv_got_joined_chat( gc, roomname ); 378 369 add_chat_buddy( c, gc->username ); 379 370 … … 387 378 g_free( roomname ); 388 379 389 return ( 1 );380 return c; 390 381 } 391 382 … … 805 796 { 806 797 yahoo_conference_decline( inv->yid, NULL, inv->members, inv->name, "User rejected groupchat" ); 807 serv_got_chat_left( inv-> gc, inv->c->id);798 serv_got_chat_left( inv->c ); 808 799 g_free( inv->name ); 809 800 g_free( inv ); … … 820 811 memset( inv, 0, sizeof( struct byahoo_conf_invitation ) ); 821 812 inv->name = g_strdup( room ); 822 inv->c = serv_got_joined_chat( gc, ++byahoo_chat_id,room );813 inv->c = serv_got_joined_chat( gc, room ); 823 814 inv->c->data = members; 824 815 inv->yid = id; … … 872 863 for( c = gc->conversations; c && strcmp( c->title, room ) != 0; c = c->next ); 873 864 874 serv_got_chat_in( gc, c ? c->id : 0, who, 0, m, 0 ); 865 if( c ) 866 serv_got_chat_in( c, who, 0, m, 0 ); 875 867 g_free( m ); 876 868 }
Note: See TracChangeset
for help on using the changeset viewer.