Changeset d93c8beb for protocols/purple
- Timestamp:
- 2015-03-02T03:27:16Z (10 years ago)
- Branches:
- master
- Children:
- 56985aa
- Parents:
- ce70e88
- git-author:
- Antoine Pietri <antoine.pietri@…> (01-03-15 17:47:15)
- git-committer:
- dequis <dx@…> (02-03-15 03:27:16)
- Location:
- protocols/purple
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/purple/ft-direct.c
rce70e88 rd93c8beb 28 28 29 29 #include "bitlbee.h" 30 #include "bpurple.h" 30 31 31 32 #include <stdarg.h> … … 207 208 void purple_transfer_request(struct im_connection *ic, file_transfer_t *ft, char *handle) 208 209 { 209 PurpleAccount *pa= ic->proto_data;210 struct purple_data *pd = ic->proto_data; 210 211 struct prpl_xfer_data *px; 211 212 … … 213 214 multi-threaded anyway. */ 214 215 next_ft = ft; 215 serv_send_file(purple_account_get_connection(pa), handle, ft->file_name); 216 serv_send_file(purple_account_get_connection(pd->account), handle, 217 ft->file_name); 216 218 217 219 ft->write = prpl_xfer_write; -
protocols/purple/ft.c
rce70e88 rd93c8beb 28 28 29 29 #include "bitlbee.h" 30 #include "bpurple.h" 30 31 31 32 #include <stdarg.h> … … 285 286 { 286 287 struct prpl_xfer_data *px = ft->data; 287 PurpleAccount *pa= px->ic->proto_data;288 struct purple_data *pd = px->ic->proto_data; 288 289 289 290 /* xfer_new() will pick up this variable. It's a hack but we're not 290 291 multi-threaded anyway. */ 291 292 next_ft = ft; 292 serv_send_file(purple_account_get_connection(pa), px->handle, px->fn); 293 serv_send_file(purple_account_get_connection(pd->account), 294 px->handle, px->fn); 293 295 } 294 296 -
protocols/purple/purple.c
rce70e88 rd93c8beb 23 23 24 24 #include "bitlbee.h" 25 #include "bpurple.h" 25 26 #include "help.h" 26 27 … … 42 43 { 43 44 GSList *i; 45 struct purple_data *pd; 44 46 45 47 for (i = purple_connections; i; i = i->next) { 46 if (((struct im_connection *) i->data)->proto_data == pa) { 48 pd = ((struct im_connection *) i->data)->proto_data; 49 if (pd->account == pa) { 47 50 return i->data; 48 51 } … … 290 293 { 291 294 struct im_connection *ic = imcb_new(acc); 292 PurpleAccount *pa;295 struct purple_data *pd; 293 296 294 297 if ((local_bee != NULL && local_bee != acc->bee) || … … 306 309 purple_connections = g_slist_prepend(purple_connections, ic); 307 310 308 ic->proto_data = pa = purple_account_new(acc->user, (char *) acc->prpl->data); 309 purple_account_set_password(pa, acc->pass); 310 purple_sync_settings(acc, pa); 311 312 purple_account_set_enabled(pa, "BitlBee", TRUE); 311 ic->proto_data = pd = g_new0(struct purple_data, 1); 312 pd->account = purple_account_new(acc->user, (char *) acc->prpl->data); 313 purple_account_set_password(pd->account, acc->pass); 314 purple_sync_settings(acc, pd->account); 315 316 purple_account_set_enabled(pd->account, "BitlBee", TRUE); 313 317 } 314 318 315 319 static void purple_logout(struct im_connection *ic) 316 320 { 317 PurpleAccount *pa= ic->proto_data;318 319 purple_account_set_enabled(p a, "BitlBee", FALSE);321 struct purple_data *pd = ic->proto_data; 322 323 purple_account_set_enabled(pd->account, "BitlBee", FALSE); 320 324 purple_connections = g_slist_remove(purple_connections, ic); 321 purple_accounts_remove(pa); 325 purple_accounts_remove(pd->account); 326 g_free(pd); 322 327 } 323 328 … … 325 330 { 326 331 PurpleConversation *conv; 332 struct purple_data *pd = ic->proto_data; 327 333 328 334 if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, 329 who, ic->proto_data)) == NULL) {335 who, pd->account)) == NULL) { 330 336 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, 331 ic->proto_data, who);337 pd->account, who); 332 338 } 333 339 … … 339 345 static GList *purple_away_states(struct im_connection *ic) 340 346 { 341 PurpleAccount *pa= ic->proto_data;347 struct purple_data *pd = ic->proto_data; 342 348 GList *st, *ret = NULL; 343 349 344 for (st = purple_account_get_status_types(p a); st; st = st->next) {350 for (st = purple_account_get_status_types(pd->account); st; st = st->next) { 345 351 PurpleStatusPrimitive prim = purple_status_type_get_primitive(st->data); 346 352 if (prim != PURPLE_STATUS_AVAILABLE && prim != PURPLE_STATUS_OFFLINE) { … … 354 360 static void purple_set_away(struct im_connection *ic, char *state_txt, char *message) 355 361 { 356 PurpleAccount *pa= ic->proto_data;357 GList *status_types = purple_account_get_status_types(p a), *st;362 struct purple_data *pd = ic->proto_data; 363 GList *status_types = purple_account_get_status_types(pd->account), *st; 358 364 PurpleStatusType *pst = NULL; 359 365 GList *args = NULL; … … 378 384 } 379 385 380 purple_account_set_status_list(pa, st ? purple_status_type_get_id(pst) : "away", 386 purple_account_set_status_list(pd->account, 387 st ? purple_status_type_get_id(pst) : "away", 381 388 TRUE, args); 382 389 … … 447 454 PurpleBuddy *pb; 448 455 PurpleGroup *pg = NULL; 456 struct purple_data *pd = ic->proto_data; 449 457 450 458 if (group && !(pg = purple_find_group(group))) { … … 453 461 } 454 462 455 pb = purple_buddy_new( (PurpleAccount *) ic->proto_data, who, NULL);463 pb = purple_buddy_new(pd->account, who, NULL); 456 464 purple_blist_add_buddy(pb, NULL, pg, NULL); 457 purple_account_add_buddy( (PurpleAccount *) ic->proto_data, pb);458 459 purple_gg_buddylist_export( ((PurpleAccount *) ic->proto_data)->gc);465 purple_account_add_buddy(pd->account, pb); 466 467 purple_gg_buddylist_export(pd->account->gc); 460 468 } 461 469 … … 463 471 { 464 472 PurpleBuddy *pb; 465 466 pb = purple_find_buddy((PurpleAccount *) ic->proto_data, who); 473 struct purple_data *pd = ic->proto_data; 474 475 pb = purple_find_buddy(pd->account, who); 467 476 if (pb != NULL) { 468 477 PurpleGroup *group; 469 478 470 479 group = purple_buddy_get_group(pb); 471 purple_account_remove_buddy( (PurpleAccount *) ic->proto_data, pb, group);480 purple_account_remove_buddy(pd->account, pb, group); 472 481 473 482 purple_blist_remove_buddy(pb); 474 483 } 475 484 476 purple_gg_buddylist_export( ((PurpleAccount *) ic->proto_data)->gc);485 purple_gg_buddylist_export(pd->account->gc); 477 486 } 478 487 479 488 static void purple_add_permit(struct im_connection *ic, char *who) 480 489 { 481 PurpleAccount *pa= ic->proto_data;482 483 purple_privacy_permit_add(p a, who, FALSE);490 struct purple_data *pd = ic->proto_data; 491 492 purple_privacy_permit_add(pd->account, who, FALSE); 484 493 } 485 494 486 495 static void purple_add_deny(struct im_connection *ic, char *who) 487 496 { 488 PurpleAccount *pa= ic->proto_data;489 490 purple_privacy_deny_add(p a, who, FALSE);497 struct purple_data *pd = ic->proto_data; 498 499 purple_privacy_deny_add(pd->account, who, FALSE); 491 500 } 492 501 493 502 static void purple_rem_permit(struct im_connection *ic, char *who) 494 503 { 495 PurpleAccount *pa= ic->proto_data;496 497 purple_privacy_permit_remove(p a, who, FALSE);504 struct purple_data *pd = ic->proto_data; 505 506 purple_privacy_permit_remove(pd->account, who, FALSE); 498 507 } 499 508 500 509 static void purple_rem_deny(struct im_connection *ic, char *who) 501 510 { 502 PurpleAccount *pa= ic->proto_data;503 504 purple_privacy_deny_remove(p a, who, FALSE);511 struct purple_data *pd = ic->proto_data; 512 513 purple_privacy_deny_remove(pd->account, who, FALSE); 505 514 } 506 515 507 516 static void purple_get_info(struct im_connection *ic, char *who) 508 517 { 509 serv_get_info(purple_account_get_connection(ic->proto_data), who); 518 struct purple_data *pd = ic->proto_data; 519 520 serv_get_info(purple_account_get_connection(pd->account), who); 510 521 } 511 522 … … 517 528 { 518 529 PurpleTypingState state = PURPLE_NOT_TYPING; 519 PurpleAccount *pa= ic->proto_data;530 struct purple_data *pd = ic->proto_data; 520 531 521 532 if (flags & OPT_TYPING) { … … 525 536 } 526 537 527 serv_send_typing(purple_account_get_connection(p a), who, state);538 serv_send_typing(purple_account_get_connection(pd->account), who, state); 528 539 529 540 return 1; … … 559 570 /* There went my nice afternoon. :-( */ 560 571 561 PurpleAccount *pa= ic->proto_data;562 PurplePlugin *prpl = purple_plugins_find_with_id(p a->protocol_id);572 struct purple_data *pd = ic->proto_data; 573 PurplePlugin *prpl = purple_plugins_find_with_id(pd->account->protocol_id); 563 574 PurplePluginProtocolInfo *pi = prpl->info->extra_info; 564 PurpleBuddy *pb = purple_find_buddy( (PurpleAccount *) ic->proto_data, who);575 PurpleBuddy *pb = purple_find_buddy(pd->account, who); 565 576 PurpleMenuAction *mi; 566 577 GList *menu; … … 597 608 PurpleConversation *pc = gc->data; 598 609 PurpleConvChat *pcc = PURPLE_CONV_CHAT(pc); 599 600 serv_chat_invite(purple_account_get_connection(gc->ic->proto_data), 610 struct purple_data *pd = gc->ic->proto_data; 611 612 serv_chat_invite(purple_account_get_connection(pd->account), 601 613 purple_conv_chat_get_id(pcc), 602 614 message && *message ? message : "Please join my chat", … … 623 635 set_t **sets) 624 636 { 625 PurpleAccount *pa= ic->proto_data;626 PurplePlugin *prpl = purple_plugins_find_with_id(p a->protocol_id);637 struct purple_data *pd = ic->proto_data; 638 PurplePlugin *prpl = purple_plugins_find_with_id(pd->account->protocol_id); 627 639 PurplePluginProtocolInfo *pi = prpl->info->extra_info; 628 640 GHashTable *chat_hash; … … 631 643 632 644 if (!pi->chat_info || !pi->chat_info_defaults || 633 !(info = pi->chat_info(purple_account_get_connection(p a)))) {645 !(info = pi->chat_info(purple_account_get_connection(pd->account)))) { 634 646 imcb_error(ic, "Joining chatrooms not supported by this protocol"); 635 647 return NULL; 636 648 } 637 649 638 if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, room, pa))) { 650 if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, 651 room, pd->account))) { 639 652 purple_conversation_destroy(conv); 640 653 } 641 654 642 chat_hash = pi->chat_info_defaults(purple_account_get_connection(pa), room); 655 chat_hash = pi->chat_info_defaults( 656 purple_account_get_connection(pd->account), room 657 ); 643 658 644 659 for (l = info; l; l = l->next) { … … 654 669 } 655 670 656 serv_join_chat(purple_account_get_connection(p a), chat_hash);671 serv_join_chat(purple_account_get_connection(pd->account), chat_hash); 657 672 658 673 return NULL;
Note: See TracChangeset
for help on using the changeset viewer.