Changeset f485008
- Timestamp:
- 2010-05-01T23:55:48Z (15 years ago)
- Branches:
- master
- Children:
- a348d00
- Parents:
- c521362
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/purple/purple.c
rc521362 rf485008 365 365 } 366 366 367 static void purple_chat_msg( struct groupchat *gc, char *message, int flags ) 368 { 369 PurpleConversation *pc = gc->data; 370 371 purple_conv_chat_send( purple_conversation_get_chat_data( pc ), message ); 372 } 373 367 374 void purple_transfer_request( struct im_connection *ic, file_transfer_t *ft, char *handle ); 368 375 … … 506 513 }; 507 514 508 static void prplcb_conv_im( PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime ) 509 { 510 struct im_connection *ic = purple_ic_by_pa( conv->account ); 515 void prplcb_conv_new( PurpleConversation *conv ) 516 { 517 if( conv->type == PURPLE_CONV_TYPE_CHAT ) 518 { 519 struct im_connection *ic = purple_ic_by_pa( conv->account ); 520 struct groupchat *gc; 521 522 gc = imcb_chat_new( ic, conv->name ); 523 conv->ui_data = gc; 524 gc->data = conv; 525 } 526 } 527 528 void prplcb_conv_free( PurpleConversation *conv ) 529 { 530 struct groupchat *gc = conv->ui_data; 531 532 imcb_chat_free( gc ); 533 } 534 535 void prplcb_conv_add_users( PurpleConversation *conv, GList *cbuddies, gboolean new_arrivals ) 536 { 537 struct groupchat *gc = conv->ui_data; 538 GList *b; 539 540 for( b = cbuddies; b; b = b->next ) 541 { 542 PurpleConvChatBuddy *pcb = b->data; 543 544 imcb_chat_add_buddy( gc, pcb->name ); 545 } 546 } 547 548 void prplcb_conv_del_users( PurpleConversation *conv, GList *cbuddies ) 549 { 550 struct groupchat *gc = conv->ui_data; 551 GList *b; 552 553 for( b = cbuddies; b; b = b->next ) 554 imcb_chat_remove_buddy( gc, b->data, "" ); 555 } 556 557 void prplcb_conv_chat_msg( PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime ) 558 { 559 struct groupchat *gc = conv->ui_data; 511 560 PurpleBuddy *buddy; 512 561 … … 519 568 who = purple_buddy_get_name( buddy ); 520 569 570 imcb_chat_msg( gc, who, (char*) message, 0, mtime ); 571 } 572 573 static void prplcb_conv_im( PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime ) 574 { 575 struct im_connection *ic = purple_ic_by_pa( conv->account ); 576 PurpleBuddy *buddy; 577 578 /* ..._SEND means it's an outgoing message, no need to echo those. */ 579 if( flags & PURPLE_MESSAGE_SEND ) 580 return; 581 582 buddy = purple_find_buddy( conv->account, who ); 583 if( buddy != NULL ) 584 who = purple_buddy_get_name( buddy ); 585 521 586 imcb_buddy_msg( ic, (char*) who, (char*) message, 0, mtime ); 522 587 } … … 524 589 static PurpleConversationUiOps bee_conv_uiops = 525 590 { 526 NULL,/* create_conversation */527 NULL,/* destroy_conversation */528 NULL,/* write_chat */591 prplcb_conv_new, /* create_conversation */ 592 prplcb_conv_free, /* destroy_conversation */ 593 prplcb_conv_chat_msg, /* write_chat */ 529 594 prplcb_conv_im, /* write_im */ 530 595 NULL, /* write_conv */ 531 NULL,/* chat_add_users */596 prplcb_conv_add_users, /* chat_add_users */ 532 597 NULL, /* chat_rename_user */ 533 NULL,/* chat_remove_users */598 prplcb_conv_del_users, /* chat_remove_users */ 534 599 NULL, /* chat_update_user */ 535 600 NULL, /* present */ … … 918 983 funcs.send_typing = purple_send_typing; 919 984 funcs.handle_cmp = g_strcasecmp; 920 /* TODO(wilmer): Set this one only for protocols that support it? */ 985 /* TODO(wilmer): Set these only for protocols that support them? */ 986 funcs.chat_msg = purple_chat_msg; 921 987 funcs.transfer_request = purple_transfer_request; 922 988
Note: See TracChangeset
for help on using the changeset viewer.