Mercurial > pidgin
comparison libpurple/protocols/silc/silc.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | f07501af8bae |
children |
comparison
equal
deleted
inserted
replaced
32818:01ff09d4a463 | 32819:2c6510167895 |
---|---|
76 SilcBuffer idp; | 76 SilcBuffer idp; |
77 unsigned char mb[4]; | 77 unsigned char mb[4]; |
78 const char *state; | 78 const char *state; |
79 | 79 |
80 if (gc != NULL) | 80 if (gc != NULL) |
81 sg = gc->proto_data; | 81 sg = purple_connection_get_protocol_data(gc); |
82 | 82 |
83 if (status == NULL) | 83 if (status == NULL) |
84 return; | 84 return; |
85 | 85 |
86 state = purple_status_get_id(status); | 86 state = purple_status_get_id(status); |
123 /*************************** Connection Routines *****************************/ | 123 /*************************** Connection Routines *****************************/ |
124 | 124 |
125 static void | 125 static void |
126 silcpurple_keepalive(PurpleConnection *gc) | 126 silcpurple_keepalive(PurpleConnection *gc) |
127 { | 127 { |
128 SilcPurple sg = gc->proto_data; | 128 SilcPurple sg = purple_connection_get_protocol_data(gc); |
129 silc_packet_send(sg->conn->stream, SILC_PACKET_HEARTBEAT, 0, | 129 silc_packet_send(sg->conn->stream, SILC_PACKET_HEARTBEAT, 0, |
130 NULL, 0); | 130 NULL, 0); |
131 } | 131 } |
132 | 132 |
133 #if __SILC_TOOLKIT_VERSION < SILC_VERSION(1,1,1) | 133 #if __SILC_TOOLKIT_VERSION < SILC_VERSION(1,1,1) |
178 long seconds, long useconds, | 178 long seconds, long useconds, |
179 void *context) | 179 void *context) |
180 { | 180 { |
181 SilcClient client = (SilcClient)context; | 181 SilcClient client = (SilcClient)context; |
182 PurpleConnection *gc = client->application; | 182 PurpleConnection *gc = client->application; |
183 SilcPurple sg = gc->proto_data; | 183 SilcPurple sg = purple_connection_get_protocol_data(gc); |
184 SilcPurpleTask ptask = NULL; | 184 SilcPurpleTask ptask = NULL; |
185 | 185 |
186 if (added) { | 186 if (added) { |
187 if (fd_task) { | 187 if (fd_task) { |
188 /* Add fd or change fd events */ | 188 /* Add fd or change fd events */ |
250 PurpleStoredImage *img; | 250 PurpleStoredImage *img; |
251 #ifdef HAVE_SYS_UTSNAME_H | 251 #ifdef HAVE_SYS_UTSNAME_H |
252 struct utsname u; | 252 struct utsname u; |
253 #endif | 253 #endif |
254 | 254 |
255 sg = gc->proto_data; | 255 sg = purple_connection_get_protocol_data(gc); |
256 | 256 |
257 switch (status) { | 257 switch (status) { |
258 case SILC_CLIENT_CONN_SUCCESS: | 258 case SILC_CLIENT_CONN_SUCCESS: |
259 case SILC_CLIENT_CONN_SUCCESS_RESUME: | 259 case SILC_CLIENT_CONN_SUCCESS_RESUME: |
260 sg->conn = conn; | 260 sg->conn = conn; |
314 if (sg->resuming && !sg->detaching) | 314 if (sg->resuming && !sg->detaching) |
315 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); | 315 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
316 | 316 |
317 /* Close the connection */ | 317 /* Close the connection */ |
318 if (!sg->detaching) | 318 if (!sg->detaching) |
319 purple_connection_error_reason(gc, | 319 purple_connection_error(gc, |
320 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 320 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
321 _("Disconnected by server")); | 321 _("Disconnected by server")); |
322 else | 322 else |
323 /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ | 323 /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ |
324 purple_account_disconnect(purple_connection_get_account(gc)); | 324 purple_account_disconnect(purple_connection_get_account(gc)); |
325 break; | 325 break; |
326 | 326 |
327 case SILC_CLIENT_CONN_ERROR: | 327 case SILC_CLIENT_CONN_ERROR: |
328 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 328 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
329 _("Error connecting to SILC Server")); | 329 _("Error connecting to SILC Server")); |
330 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); | 330 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
331 break; | 331 break; |
332 | 332 |
333 case SILC_CLIENT_CONN_ERROR_KE: | 333 case SILC_CLIENT_CONN_ERROR_KE: |
334 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, | 334 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
335 _("Key Exchange failed")); | 335 _("Key Exchange failed")); |
336 break; | 336 break; |
337 | 337 |
338 case SILC_CLIENT_CONN_ERROR_AUTH: | 338 case SILC_CLIENT_CONN_ERROR_AUTH: |
339 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, | 339 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, |
340 _("Authentication failed")); | 340 _("Authentication failed")); |
341 break; | 341 break; |
342 | 342 |
343 case SILC_CLIENT_CONN_ERROR_RESUME: | 343 case SILC_CLIENT_CONN_ERROR_RESUME: |
344 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 344 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
345 _("Resuming detached session failed. " | 345 _("Resuming detached session failed. " |
346 "Press Reconnect to create new connection.")); | 346 "Press Reconnect to create new connection.")); |
347 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); | 347 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
348 break; | 348 break; |
349 | 349 |
350 case SILC_CLIENT_CONN_ERROR_TIMEOUT: | 350 case SILC_CLIENT_CONN_ERROR_TIMEOUT: |
351 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 351 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
352 _("Connection timed out")); | 352 _("Connection timed out")); |
353 break; | 353 break; |
354 } | 354 } |
355 | 355 |
356 /* Error */ | 356 /* Error */ |
365 SilcPurple sg; | 365 SilcPurple sg; |
366 SilcClient client; | 366 SilcClient client; |
367 SilcClientConnectionParams params; | 367 SilcClientConnectionParams params; |
368 const char *dfile; | 368 const char *dfile; |
369 | 369 |
370 sg = gc->proto_data; | 370 sg = purple_connection_get_protocol_data(gc); |
371 | 371 |
372 if (status != SILC_SOCKET_OK) { | 372 if (status != SILC_SOCKET_OK) { |
373 purple_connection_error_reason(gc, | 373 purple_connection_error(gc, |
374 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 374 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
375 _("Connection failed")); | 375 _("Connection failed")); |
376 silc_pkcs_public_key_free(sg->public_key); | 376 silc_pkcs_public_key_free(sg->public_key); |
377 silc_pkcs_private_key_free(sg->private_key); | 377 silc_pkcs_private_key_free(sg->private_key); |
378 silc_free(sg); | 378 silc_free(sg); |
379 gc->proto_data = NULL; | 379 purple_connection_set_protocol_data(gc, NULL); |
380 return; | 380 return; |
381 } | 381 } |
382 | 382 |
383 client = sg->client; | 383 client = sg->client; |
384 | 384 |
398 } else { | 398 } else { |
399 purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5); | 399 purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5); |
400 } | 400 } |
401 | 401 |
402 /* Perform SILC Key Exchange. */ | 402 /* Perform SILC Key Exchange. */ |
403 silc_client_key_exchange(sg->client, ¶ms, sg->public_key, | 403 silc_client_key_exchange(client, ¶ms, sg->public_key, |
404 sg->private_key, stream, SILC_CONN_SERVER, | 404 sg->private_key, stream, SILC_CONN_SERVER, |
405 silcpurple_connect_cb, gc); | 405 silcpurple_connect_cb, gc); |
406 | 406 |
407 silc_free(params.detach_data); | 407 silc_free(params.detach_data); |
408 } | 408 } |
413 PurpleConnection *gc = data; | 413 PurpleConnection *gc = data; |
414 SilcPurple sg; | 414 SilcPurple sg; |
415 | 415 |
416 g_return_if_fail(gc != NULL); | 416 g_return_if_fail(gc != NULL); |
417 | 417 |
418 sg = gc->proto_data; | 418 sg = purple_connection_get_protocol_data(gc); |
419 | 419 |
420 if (source < 0) { | 420 if (source < 0) { |
421 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 421 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
422 _("Connection failed")); | 422 _("Connection failed")); |
423 silc_pkcs_public_key_free(sg->public_key); | 423 silc_pkcs_public_key_free(sg->public_key); |
424 silc_pkcs_private_key_free(sg->private_key); | 424 silc_pkcs_private_key_free(sg->private_key); |
425 silc_free(sg); | 425 silc_free(sg); |
426 gc->proto_data = NULL; | 426 purple_connection_set_protocol_data(gc, NULL); |
427 return; | 427 return; |
428 } | 428 } |
429 | 429 |
430 silc_hash_alloc((unsigned char *)"sha1", &sg->sha1hash); | 430 silc_hash_alloc((unsigned char *)"sha1", &sg->sha1hash); |
431 | 431 |
445 purple_account_get_string(account, "server", | 445 purple_account_get_string(account, "server", |
446 "silc.silcnet.org"), | 446 "silc.silcnet.org"), |
447 purple_account_get_int(account, "port", 706), | 447 purple_account_get_int(account, "port", 706), |
448 silcpurple_login_connected, gc) == NULL) | 448 silcpurple_login_connected, gc) == NULL) |
449 { | 449 { |
450 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 450 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
451 _("Unable to connect")); | 451 _("Unable to connect")); |
452 gc->proto_data = NULL; | 452 purple_connection_set_protocol_data(gc, NULL); |
453 silc_free(sg); | 453 silc_free(sg); |
454 return; | 454 return; |
455 } | 455 } |
456 } | 456 } |
457 | 457 |
458 static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) | 458 static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
459 { | 459 { |
460 SilcPurple sg = (SilcPurple)gc->proto_data; | 460 SilcPurple sg = purple_connection_get_protocol_data(gc); |
461 PurpleAccount *account = purple_connection_get_account(gc); | 461 PurpleAccount *account = purple_connection_get_account(gc); |
462 char pkd[256], prd[256]; | 462 char pkd[256], prd[256]; |
463 const char *password; | 463 const char *password; |
464 gboolean remember; | 464 gboolean remember; |
465 | 465 |
471 remember = purple_request_fields_get_bool(fields, "remember"); | 471 remember = purple_request_fields_get_bool(fields, "remember"); |
472 | 472 |
473 if (!password || !*password) | 473 if (!password || !*password) |
474 { | 474 { |
475 purple_notify_error(gc, NULL, _("Password is required to sign on."), NULL); | 475 purple_notify_error(gc, NULL, _("Password is required to sign on."), NULL); |
476 gc->proto_data = NULL; | 476 purple_connection_set_protocol_data(gc, NULL); |
477 silc_free(sg); | 477 silc_free(sg); |
478 return; | 478 return; |
479 } | 479 } |
480 | 480 |
481 if (remember) | 481 if (remember) |
488 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); | 488 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); |
489 if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), | 489 if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), |
490 (char *)purple_account_get_string(account, "private-key", prd), | 490 (char *)purple_account_get_string(account, "private-key", prd), |
491 password, | 491 password, |
492 &sg->public_key, &sg->private_key)) { | 492 &sg->public_key, &sg->private_key)) { |
493 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 493 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
494 _("Unable to load SILC key pair")); | 494 _("Unable to load SILC key pair")); |
495 gc->proto_data = NULL; | 495 purple_connection_set_protocol_data(gc, NULL); |
496 silc_free(sg); | 496 silc_free(sg); |
497 return; | 497 return; |
498 } | 498 } |
499 silcpurple_continue_running(sg); | 499 silcpurple_continue_running(sg); |
500 } | 500 } |
503 { | 503 { |
504 SilcPurple sg; | 504 SilcPurple sg; |
505 /* The password prompt dialog doesn't get disposed if the account disconnects */ | 505 /* The password prompt dialog doesn't get disposed if the account disconnects */ |
506 if (!PURPLE_CONNECTION_IS_VALID(gc)) | 506 if (!PURPLE_CONNECTION_IS_VALID(gc)) |
507 return; | 507 return; |
508 sg = gc->proto_data; | 508 sg = purple_connection_get_protocol_data(gc); |
509 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 509 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
510 _("Unable to load SILC key pair")); | 510 _("Unable to load SILC key pair")); |
511 gc->proto_data = NULL; | 511 purple_connection_set_protocol_data(gc, NULL); |
512 silc_free(sg); | 512 silc_free(sg); |
513 } | 513 } |
514 | 514 |
515 static void silcpurple_running(SilcClient client, void *context) | 515 static void silcpurple_running(SilcClient client, void *context) |
516 { | 516 { |
526 /* Load SILC key pair */ | 526 /* Load SILC key pair */ |
527 g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); | 527 g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); |
528 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); | 528 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); |
529 if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), | 529 if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), |
530 (char *)purple_account_get_string(account, "private-key", prd), | 530 (char *)purple_account_get_string(account, "private-key", prd), |
531 (gc->password == NULL) ? "" : gc->password, | 531 (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), |
532 &sg->public_key, &sg->private_key)) { | 532 &sg->public_key, &sg->private_key)) { |
533 if (!purple_account_get_password(account)) { | 533 if (!purple_account_get_password(account)) { |
534 purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb), | 534 purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb), |
535 G_CALLBACK(silcpurple_no_password_cb), gc); | 535 G_CALLBACK(silcpurple_no_password_cb), gc); |
536 return; | 536 return; |
537 } | 537 } |
538 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 538 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
539 _("Unable to load SILC key pair")); | 539 _("Unable to load SILC key pair")); |
540 gc->proto_data = NULL; | 540 purple_connection_set_protocol_data(gc, NULL); |
541 silc_free(sg); | 541 silc_free(sg); |
542 return; | 542 return; |
543 } | 543 } |
544 silcpurple_continue_running(sg); | 544 silcpurple_continue_running(sg); |
545 } | 545 } |
553 SilcClientParams params; | 553 SilcClientParams params; |
554 const char *cipher, *hmac; | 554 const char *cipher, *hmac; |
555 char *username, *hostname, *realname, **up; | 555 char *username, *hostname, *realname, **up; |
556 int i; | 556 int i; |
557 | 557 |
558 gc = account->gc; | 558 gc = purple_account_get_connection(account); |
559 if (!gc) | 559 if (!gc) |
560 return; | 560 return; |
561 gc->proto_data = NULL; | 561 purple_connection_set_protocol_data(gc, NULL); |
562 | 562 |
563 memset(¶ms, 0, sizeof(params)); | 563 memset(¶ms, 0, sizeof(params)); |
564 strcat(params.nickname_format, "%n#a"); | 564 strcat(params.nickname_format, "%n#a"); |
565 | 565 |
566 /* Allocate SILC client */ | 566 /* Allocate SILC client */ |
567 client = silc_client_alloc(&ops, ¶ms, gc, NULL); | 567 client = silc_client_alloc(&ops, ¶ms, gc, NULL); |
568 if (!client) { | 568 if (!client) { |
569 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 569 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
570 _("Out of memory")); | 570 _("Out of memory")); |
571 return; | 571 return; |
572 } | 572 } |
573 | 573 |
574 /* Get username, real name and local hostname for SILC library */ | 574 /* Get username, real name and local hostname for SILC library */ |
610 if (!sg) | 610 if (!sg) |
611 return; | 611 return; |
612 sg->client = client; | 612 sg->client = client; |
613 sg->gc = gc; | 613 sg->gc = gc; |
614 sg->account = account; | 614 sg->account = account; |
615 gc->proto_data = sg; | 615 purple_connection_set_protocol_data(gc, sg); |
616 | 616 |
617 /* Init SILC client */ | 617 /* Init SILC client */ |
618 if (!silc_client_init(client, username, hostname, realname, | 618 if (!silc_client_init(client, username, hostname, realname, |
619 silcpurple_running, sg)) { | 619 silcpurple_running, sg)) { |
620 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 620 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
621 _("Unable to initialize SILC protocol")); | 621 _("Unable to initialize SILC protocol")); |
622 gc->proto_data = NULL; | 622 purple_connection_set_protocol_data(gc, NULL); |
623 silc_free(sg); | 623 silc_free(sg); |
624 silc_free(hostname); | 624 silc_free(hostname); |
625 g_free(username); | 625 g_free(username); |
626 return; | 626 return; |
627 } | 627 } |
628 silc_free(hostname); | 628 silc_free(hostname); |
629 g_free(username); | 629 g_free(username); |
630 | 630 |
631 /* Check the ~/.silc dir and create it, and new key pair if necessary. */ | 631 /* Check the ~/.silc dir and create it, and new key pair if necessary. */ |
632 if (!silcpurple_check_silc_dir(gc)) { | 632 if (!silcpurple_check_silc_dir(gc)) { |
633 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 633 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
634 _("Error loading SILC key pair")); | 634 _("Error loading SILC key pair")); |
635 gc->proto_data = NULL; | 635 purple_connection_set_protocol_data(gc, NULL); |
636 silc_free(sg); | 636 silc_free(sg); |
637 return; | 637 return; |
638 } | 638 } |
639 | 639 |
640 #if __SILC_TOOLKIT_VERSION < SILC_VERSION(1,1,1) | 640 #if __SILC_TOOLKIT_VERSION < SILC_VERSION(1,1,1) |
667 } | 667 } |
668 | 668 |
669 static void | 669 static void |
670 silcpurple_close(PurpleConnection *gc) | 670 silcpurple_close(PurpleConnection *gc) |
671 { | 671 { |
672 SilcPurple sg = gc->proto_data; | 672 SilcPurple sg = purple_connection_get_protocol_data(gc); |
673 #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) | 673 #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) |
674 SilcPurpleTask task; | 674 SilcPurpleTask task; |
675 #endif /* __SILC_TOOLKIT_VERSION */ | 675 #endif /* __SILC_TOOLKIT_VERSION */ |
676 GHashTable *ui_info; | 676 GHashTable *ui_info; |
677 const char *ui_name = NULL, *ui_website = NULL; | 677 const char *ui_name = NULL, *ui_website = NULL; |
731 } | 731 } |
732 | 732 |
733 static void | 733 static void |
734 silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) | 734 silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
735 { | 735 { |
736 SilcPurple sg = gc->proto_data; | 736 SilcPurple sg = purple_connection_get_protocol_data(gc); |
737 SilcClient client = sg->client; | 737 SilcClient client = sg->client; |
738 SilcClientConnection conn = sg->conn; | 738 SilcClientConnection conn = sg->conn; |
739 PurpleRequestField *f; | 739 PurpleRequestField *f; |
740 char *tmp; | 740 char *tmp; |
741 SilcUInt32 tmp_len, mask; | 741 SilcUInt32 tmp_len, mask; |
742 SilcAttributeObjService service; | 742 SilcAttributeObjService service; |
743 SilcAttributeObjDevice dev; | 743 SilcAttributeObjDevice dev; |
744 SilcVCardStruct vcard; | 744 SilcVCardStruct vcard; |
745 const char *val; | 745 const char *val; |
746 | 746 |
747 sg = gc->proto_data; | 747 sg = purple_connection_get_protocol_data(gc); |
748 if (!sg) | 748 if (!sg) |
749 return; | 749 return; |
750 | 750 |
751 memset(&service, 0, sizeof(service)); | 751 memset(&service, 0, sizeof(service)); |
752 memset(&dev, 0, sizeof(dev)); | 752 memset(&dev, 0, sizeof(dev)); |
903 | 903 |
904 static void | 904 static void |
905 silcpurple_attrs(PurplePluginAction *action) | 905 silcpurple_attrs(PurplePluginAction *action) |
906 { | 906 { |
907 PurpleConnection *gc = (PurpleConnection *) action->context; | 907 PurpleConnection *gc = (PurpleConnection *) action->context; |
908 SilcPurple sg = gc->proto_data; | 908 SilcPurple sg = purple_connection_get_protocol_data(gc); |
909 SilcClient client = sg->client; | 909 SilcClient client = sg->client; |
910 SilcClientConnection conn = sg->conn; | 910 SilcClientConnection conn = sg->conn; |
911 PurpleRequestFields *fields; | 911 PurpleRequestFields *fields; |
912 PurpleRequestFieldGroup *g; | 912 PurpleRequestFieldGroup *g; |
913 PurpleRequestField *f; | 913 PurpleRequestField *f; |
920 gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, | 920 gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, |
921 cmms = FALSE, cchat = TRUE, cvideo = FALSE; | 921 cmms = FALSE, cchat = TRUE, cvideo = FALSE; |
922 gboolean device = TRUE; | 922 gboolean device = TRUE; |
923 char status[1024], tz[16]; | 923 char status[1024], tz[16]; |
924 | 924 |
925 sg = gc->proto_data; | 925 sg = purple_connection_get_protocol_data(gc); |
926 if (!sg) | 926 if (!sg) |
927 return; | 927 return; |
928 | 928 |
929 memset(status, 0, sizeof(status)); | 929 memset(status, 0, sizeof(status)); |
930 | 930 |
1059 "and your personal information. Please fill the information " | 1059 "and your personal information. Please fill the information " |
1060 "you would like other users to see about yourself."), | 1060 "you would like other users to see about yourself."), |
1061 fields, | 1061 fields, |
1062 _("OK"), G_CALLBACK(silcpurple_attrs_cb), | 1062 _("OK"), G_CALLBACK(silcpurple_attrs_cb), |
1063 _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), | 1063 _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), |
1064 gc->account, NULL, NULL, gc); | 1064 purple_connection_get_account(gc), NULL, NULL, gc); |
1065 } | 1065 } |
1066 | 1066 |
1067 static void | 1067 static void |
1068 silcpurple_detach(PurplePluginAction *action) | 1068 silcpurple_detach(PurplePluginAction *action) |
1069 { | 1069 { |
1070 PurpleConnection *gc = (PurpleConnection *) action->context; | 1070 PurpleConnection *gc = (PurpleConnection *) action->context; |
1071 SilcPurple sg; | 1071 SilcPurple sg; |
1072 | 1072 |
1073 if (!gc) | 1073 if (!gc) |
1074 return; | 1074 return; |
1075 sg = gc->proto_data; | 1075 sg = purple_connection_get_protocol_data(gc); |
1076 if (!sg) | 1076 if (!sg) |
1077 return; | 1077 return; |
1078 | 1078 |
1079 /* Call DETACH */ | 1079 /* Call DETACH */ |
1080 silc_client_command_call(sg->client, sg->conn, "DETACH"); | 1080 silc_client_command_call(sg->client, sg->conn, "DETACH"); |
1088 SilcPurple sg; | 1088 SilcPurple sg; |
1089 char *tmp; | 1089 char *tmp; |
1090 | 1090 |
1091 if (!gc) | 1091 if (!gc) |
1092 return; | 1092 return; |
1093 sg = gc->proto_data; | 1093 sg = purple_connection_get_protocol_data(gc); |
1094 if (!sg) | 1094 if (!sg) |
1095 return; | 1095 return; |
1096 | 1096 |
1097 if (!sg->motd) { | 1097 if (!sg->motd) { |
1098 purple_notify_error( | 1098 purple_notify_error( |
1123 const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; | 1123 const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; |
1124 char *identifier; | 1124 char *identifier; |
1125 int keylen = SILCPURPLE_DEF_PKCS_LEN; | 1125 int keylen = SILCPURPLE_DEF_PKCS_LEN; |
1126 SilcPublicKey public_key; | 1126 SilcPublicKey public_key; |
1127 | 1127 |
1128 sg = gc->proto_data; | 1128 sg = purple_connection_get_protocol_data(gc); |
1129 if (!sg) | 1129 if (!sg) |
1130 return; | 1130 return; |
1131 | 1131 |
1132 val = NULL; | 1132 val = NULL; |
1133 f = purple_request_fields_get_field(fields, "pass1"); | 1133 f = purple_request_fields_get_field(fields, "pass1"); |
1206 | 1206 |
1207 static void | 1207 static void |
1208 silcpurple_create_keypair(PurplePluginAction *action) | 1208 silcpurple_create_keypair(PurplePluginAction *action) |
1209 { | 1209 { |
1210 PurpleConnection *gc = (PurpleConnection *) action->context; | 1210 PurpleConnection *gc = (PurpleConnection *) action->context; |
1211 SilcPurple sg = gc->proto_data; | 1211 SilcPurple sg = purple_connection_get_protocol_data(gc); |
1212 PurpleRequestFields *fields; | 1212 PurpleRequestFields *fields; |
1213 PurpleRequestFieldGroup *g; | 1213 PurpleRequestFieldGroup *g; |
1214 PurpleRequestField *f; | 1214 PurpleRequestField *f; |
1215 const char *username, *realname; | 1215 const char *username, *realname; |
1216 char *hostname, **u; | 1216 char *hostname, **u; |
1224 g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); | 1224 g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); |
1225 | 1225 |
1226 g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); | 1226 g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); |
1227 g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); | 1227 g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); |
1228 g_snprintf(pkd, sizeof(pkd) - 1, "%s", | 1228 g_snprintf(pkd, sizeof(pkd) - 1, "%s", |
1229 purple_account_get_string(gc->account, "public-key", pkd2)); | 1229 purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd2)); |
1230 g_snprintf(prd, sizeof(prd) - 1, "%s", | 1230 g_snprintf(prd, sizeof(prd) - 1, "%s", |
1231 purple_account_get_string(gc->account, "private-key", prd2)); | 1231 purple_account_get_string(purple_connection_get_account(gc), "private-key", prd2)); |
1232 | 1232 |
1233 fields = purple_request_fields_new(); | 1233 fields = purple_request_fields_new(); |
1234 | 1234 |
1235 g = purple_request_field_group_new(NULL); | 1235 g = purple_request_field_group_new(NULL); |
1236 f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE); | 1236 f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE); |
1267 | 1267 |
1268 purple_request_fields(gc, _("Create New SILC Key Pair"), | 1268 purple_request_fields(gc, _("Create New SILC Key Pair"), |
1269 _("Create New SILC Key Pair"), NULL, fields, | 1269 _("Create New SILC Key Pair"), NULL, fields, |
1270 _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), | 1270 _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), |
1271 _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), | 1271 _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), |
1272 gc->account, NULL, NULL, gc); | 1272 purple_connection_get_account(gc), NULL, NULL, gc); |
1273 | 1273 |
1274 g_strfreev(u); | 1274 g_strfreev(u); |
1275 silc_free(hostname); | 1275 silc_free(hostname); |
1276 } | 1276 } |
1277 | 1277 |
1285 static void | 1285 static void |
1286 silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) | 1286 silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) |
1287 { | 1287 { |
1288 char prd[256]; | 1288 char prd[256]; |
1289 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); | 1289 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); |
1290 silc_change_private_key_passphrase(purple_account_get_string(gc->account, | 1290 silc_change_private_key_passphrase(purple_account_get_string(purple_connection_get_account(gc), |
1291 "private-key", | 1291 "private-key", |
1292 prd), old ? old : "", new ? new : ""); | 1292 prd), old ? old : "", new ? new : ""); |
1293 } | 1293 } |
1294 | 1294 |
1295 static void | 1295 static void |
1354 SilcStatus status, | 1354 SilcStatus status, |
1355 SilcDList clients, | 1355 SilcDList clients, |
1356 void *context) | 1356 void *context) |
1357 { | 1357 { |
1358 PurpleConnection *gc = client->application; | 1358 PurpleConnection *gc = client->application; |
1359 SilcPurple sg = gc->proto_data; | 1359 SilcPurple sg = purple_connection_get_protocol_data(gc); |
1360 SilcPurpleIM im = context; | 1360 SilcPurpleIM im = context; |
1361 PurpleConversation *convo; | 1361 PurpleConversation *convo; |
1362 char tmp[256]; | 1362 char tmp[256]; |
1363 SilcClientEntry client_entry; | 1363 SilcClientEntry client_entry; |
1364 SilcDList list; | 1364 SilcDList list; |
1431 | 1431 |
1432 static int | 1432 static int |
1433 silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, | 1433 silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, |
1434 PurpleMessageFlags flags) | 1434 PurpleMessageFlags flags) |
1435 { | 1435 { |
1436 SilcPurple sg = gc->proto_data; | 1436 SilcPurple sg = purple_connection_get_protocol_data(gc); |
1437 SilcClient client = sg->client; | 1437 SilcClient client = sg->client; |
1438 SilcClientConnection conn = sg->conn; | 1438 SilcClientConnection conn = sg->conn; |
1439 SilcDList clients; | 1439 SilcDList clients; |
1440 SilcClientEntry client_entry; | 1440 SilcClientEntry client_entry; |
1441 SilcUInt32 mflags; | 1441 SilcUInt32 mflags; |
1546 { | 1546 { |
1547 PurpleConnection *gc; | 1547 PurpleConnection *gc; |
1548 PurpleConversation *convo = conv; | 1548 PurpleConversation *convo = conv; |
1549 int id = 0; | 1549 int id = 0; |
1550 | 1550 |
1551 gc = purple_conversation_get_gc(conv); | 1551 gc = purple_conversation_get_connection(conv); |
1552 | 1552 |
1553 if (gc == NULL) | 1553 if (gc == NULL) |
1554 return PURPLE_CMD_RET_FAILED; | 1554 return PURPLE_CMD_RET_FAILED; |
1555 | 1555 |
1556 if(args && args[0]) | 1556 if(args && args[0]) |
1557 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], | 1557 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], |
1558 gc->account); | 1558 purple_connection_get_account(gc)); |
1559 | 1559 |
1560 if (convo != NULL) | 1560 if (convo != NULL) |
1561 id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); | 1561 id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); |
1562 | 1562 |
1563 if (id == 0) | 1563 if (id == 0) |
1575 PurpleConnection *gc; | 1575 PurpleConnection *gc; |
1576 int id = 0; | 1576 int id = 0; |
1577 char *buf, *tmp, *tmp2; | 1577 char *buf, *tmp, *tmp2; |
1578 const char *topic; | 1578 const char *topic; |
1579 | 1579 |
1580 gc = purple_conversation_get_gc(conv); | 1580 gc = purple_conversation_get_connection(conv); |
1581 id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); | 1581 id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); |
1582 | 1582 |
1583 if (gc == NULL || id == 0) | 1583 if (gc == NULL || id == 0) |
1584 return PURPLE_CMD_RET_FAILED; | 1584 return PURPLE_CMD_RET_FAILED; |
1585 | 1585 |
1591 buf = g_strdup_printf(_("current topic is: %s"), tmp2); | 1591 buf = g_strdup_printf(_("current topic is: %s"), tmp2); |
1592 g_free(tmp); | 1592 g_free(tmp); |
1593 g_free(tmp2); | 1593 g_free(tmp2); |
1594 } else | 1594 } else |
1595 buf = g_strdup(_("No topic is set")); | 1595 buf = g_strdup(_("No topic is set")); |
1596 purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf, | 1596 purple_conv_chat_write(PURPLE_CONV_CHAT(conv), purple_account_get_username(purple_connection_get_account(gc)), buf, |
1597 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); | 1597 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); |
1598 g_free(buf); | 1598 g_free(buf); |
1599 | 1599 |
1600 } | 1600 } |
1601 | 1601 |
1621 | 1621 |
1622 g_hash_table_replace(comp, "channel", args[0]); | 1622 g_hash_table_replace(comp, "channel", args[0]); |
1623 if(args[1]) | 1623 if(args[1]) |
1624 g_hash_table_replace(comp, "passphrase", args[1]); | 1624 g_hash_table_replace(comp, "passphrase", args[1]); |
1625 | 1625 |
1626 silcpurple_chat_join(purple_conversation_get_gc(conv), comp); | 1626 silcpurple_chat_join(purple_conversation_get_connection(conv), comp); |
1627 | 1627 |
1628 g_hash_table_destroy(comp); | 1628 g_hash_table_destroy(comp); |
1629 return PURPLE_CMD_RET_OK; | 1629 return PURPLE_CMD_RET_OK; |
1630 } | 1630 } |
1631 | 1631 |
1632 static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, | 1632 static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, |
1633 const char *cmd, char **args, char **error, void *data) | 1633 const char *cmd, char **args, char **error, void *data) |
1634 { | 1634 { |
1635 PurpleConnection *gc; | 1635 PurpleConnection *gc; |
1636 gc = purple_conversation_get_gc(conv); | 1636 gc = purple_conversation_get_connection(conv); |
1637 purple_roomlist_show_with_account(purple_connection_get_account(gc)); | 1637 purple_roomlist_show_with_account(purple_connection_get_account(gc)); |
1638 return PURPLE_CMD_RET_OK; | 1638 return PURPLE_CMD_RET_OK; |
1639 } | 1639 } |
1640 | 1640 |
1641 static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, | 1641 static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, |
1642 const char *cmd, char **args, char **error, void *data) | 1642 const char *cmd, char **args, char **error, void *data) |
1643 { | 1643 { |
1644 PurpleConnection *gc; | 1644 PurpleConnection *gc; |
1645 | 1645 |
1646 gc = purple_conversation_get_gc(conv); | 1646 gc = purple_conversation_get_connection(conv); |
1647 | 1647 |
1648 if (gc == NULL) | 1648 if (gc == NULL) |
1649 return PURPLE_CMD_RET_FAILED; | 1649 return PURPLE_CMD_RET_FAILED; |
1650 | 1650 |
1651 silcpurple_get_info(gc, args[0]); | 1651 silcpurple_get_info(gc, args[0]); |
1657 const char *cmd, char **args, char **error, void *data) | 1657 const char *cmd, char **args, char **error, void *data) |
1658 { | 1658 { |
1659 int ret; | 1659 int ret; |
1660 PurpleConnection *gc; | 1660 PurpleConnection *gc; |
1661 | 1661 |
1662 gc = purple_conversation_get_gc(conv); | 1662 gc = purple_conversation_get_connection(conv); |
1663 | 1663 |
1664 if (gc == NULL) | 1664 if (gc == NULL) |
1665 return PURPLE_CMD_RET_FAILED; | 1665 return PURPLE_CMD_RET_FAILED; |
1666 | 1666 |
1667 ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); | 1667 ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); |
1683 if (!args || !args[0]) { | 1683 if (!args || !args[0]) { |
1684 *error = g_strdup(_("You must specify a nick")); | 1684 *error = g_strdup(_("You must specify a nick")); |
1685 return PURPLE_CMD_RET_FAILED; | 1685 return PURPLE_CMD_RET_FAILED; |
1686 } | 1686 } |
1687 | 1687 |
1688 gc = purple_conversation_get_gc(conv); | 1688 gc = purple_conversation_get_connection(conv); |
1689 | 1689 |
1690 if (gc == NULL) | 1690 if (gc == NULL) |
1691 return PURPLE_CMD_RET_FAILED; | 1691 return PURPLE_CMD_RET_FAILED; |
1692 | 1692 |
1693 account = purple_connection_get_account(gc); | 1693 account = purple_connection_get_account(gc); |
1711 { | 1711 { |
1712 PurpleConnection *gc; | 1712 PurpleConnection *gc; |
1713 SilcPurple sg; | 1713 SilcPurple sg; |
1714 char *tmp; | 1714 char *tmp; |
1715 | 1715 |
1716 gc = purple_conversation_get_gc(conv); | 1716 gc = purple_conversation_get_connection(conv); |
1717 | 1717 |
1718 if (gc == NULL) | 1718 if (gc == NULL) |
1719 return PURPLE_CMD_RET_FAILED; | 1719 return PURPLE_CMD_RET_FAILED; |
1720 | 1720 |
1721 sg = gc->proto_data; | 1721 sg = purple_connection_get_protocol_data(gc); |
1722 | 1722 |
1723 if (sg == NULL) | 1723 if (sg == NULL) |
1724 return PURPLE_CMD_RET_FAILED; | 1724 return PURPLE_CMD_RET_FAILED; |
1725 | 1725 |
1726 if (!sg->motd) { | 1726 if (!sg->motd) { |
1740 const char *cmd, char **args, char **error, void *data) | 1740 const char *cmd, char **args, char **error, void *data) |
1741 { | 1741 { |
1742 PurpleConnection *gc; | 1742 PurpleConnection *gc; |
1743 SilcPurple sg; | 1743 SilcPurple sg; |
1744 | 1744 |
1745 gc = purple_conversation_get_gc(conv); | 1745 gc = purple_conversation_get_connection(conv); |
1746 | 1746 |
1747 if (gc == NULL) | 1747 if (gc == NULL) |
1748 return PURPLE_CMD_RET_FAILED; | 1748 return PURPLE_CMD_RET_FAILED; |
1749 | 1749 |
1750 sg = gc->proto_data; | 1750 sg = purple_connection_get_protocol_data(gc); |
1751 | 1751 |
1752 if (sg == NULL) | 1752 if (sg == NULL) |
1753 return PURPLE_CMD_RET_FAILED; | 1753 return PURPLE_CMD_RET_FAILED; |
1754 | 1754 |
1755 silc_client_command_call(sg->client, sg->conn, "DETACH"); | 1755 silc_client_command_call(sg->client, sg->conn, "DETACH"); |
1765 SilcPurple sg; | 1765 SilcPurple sg; |
1766 SilcChannelEntry channel; | 1766 SilcChannelEntry channel; |
1767 char *silccmd, *silcargs, *msg, tmp[256]; | 1767 char *silccmd, *silcargs, *msg, tmp[256]; |
1768 const char *chname; | 1768 const char *chname; |
1769 | 1769 |
1770 gc = purple_conversation_get_gc(conv); | 1770 gc = purple_conversation_get_connection(conv); |
1771 | 1771 |
1772 if (gc == NULL || !args || gc->proto_data == NULL) | 1772 if (gc == NULL || !args || purple_connection_get_protocol_data(gc) == NULL) |
1773 return PURPLE_CMD_RET_FAILED; | 1773 return PURPLE_CMD_RET_FAILED; |
1774 | 1774 |
1775 sg = gc->proto_data; | 1775 sg = purple_connection_get_protocol_data(gc); |
1776 | 1776 |
1777 if (args[0]) | 1777 if (args[0]) |
1778 chname = args[0]; | 1778 chname = args[0]; |
1779 else | 1779 else |
1780 chname = purple_conversation_get_name(conv); | 1780 chname = purple_conversation_get_name(conv); |
1816 { | 1816 { |
1817 PurpleConnection *gc; | 1817 PurpleConnection *gc; |
1818 SilcPurple sg; | 1818 SilcPurple sg; |
1819 char *silccmd, *silcargs; | 1819 char *silccmd, *silcargs; |
1820 | 1820 |
1821 gc = purple_conversation_get_gc(conv); | 1821 gc = purple_conversation_get_connection(conv); |
1822 | 1822 |
1823 if (gc == NULL) | 1823 if (gc == NULL) |
1824 return PURPLE_CMD_RET_FAILED; | 1824 return PURPLE_CMD_RET_FAILED; |
1825 | 1825 |
1826 sg = gc->proto_data; | 1826 sg = purple_connection_get_protocol_data(gc); |
1827 | 1827 |
1828 if (sg == NULL) | 1828 if (sg == NULL) |
1829 return PURPLE_CMD_RET_FAILED; | 1829 return PURPLE_CMD_RET_FAILED; |
1830 | 1830 |
1831 silcargs = g_strjoinv(" ", args); | 1831 silcargs = g_strjoinv(" ", args); |
1848 SilcPurple sg; | 1848 SilcPurple sg; |
1849 GHashTable *ui_info; | 1849 GHashTable *ui_info; |
1850 const char *ui_name = NULL, *ui_website = NULL; | 1850 const char *ui_name = NULL, *ui_website = NULL; |
1851 char *quit_msg; | 1851 char *quit_msg; |
1852 | 1852 |
1853 gc = purple_conversation_get_gc(conv); | 1853 gc = purple_conversation_get_connection(conv); |
1854 | 1854 |
1855 if (gc == NULL) | 1855 if (gc == NULL) |
1856 return PURPLE_CMD_RET_FAILED; | 1856 return PURPLE_CMD_RET_FAILED; |
1857 | 1857 |
1858 sg = gc->proto_data; | 1858 sg = purple_connection_get_protocol_data(gc); |
1859 | 1859 |
1860 if (sg == NULL) | 1860 if (sg == NULL) |
1861 return PURPLE_CMD_RET_FAILED; | 1861 return PURPLE_CMD_RET_FAILED; |
1862 | 1862 |
1863 ui_info = purple_core_get_ui_info(); | 1863 ui_info = purple_core_get_ui_info(); |
1885 const char *cmd, char **args, char **error, void *data) | 1885 const char *cmd, char **args, char **error, void *data) |
1886 { | 1886 { |
1887 PurpleConnection *gc; | 1887 PurpleConnection *gc; |
1888 SilcPurple sg; | 1888 SilcPurple sg; |
1889 | 1889 |
1890 gc = purple_conversation_get_gc(conv); | 1890 gc = purple_conversation_get_connection(conv); |
1891 | 1891 |
1892 if (gc == NULL) | 1892 if (gc == NULL) |
1893 return PURPLE_CMD_RET_FAILED; | 1893 return PURPLE_CMD_RET_FAILED; |
1894 | 1894 |
1895 sg = gc->proto_data; | 1895 sg = purple_connection_get_protocol_data(gc); |
1896 | 1896 |
1897 if (sg == NULL) | 1897 if (sg == NULL) |
1898 return PURPLE_CMD_RET_FAILED; | 1898 return PURPLE_CMD_RET_FAILED; |
1899 | 1899 |
1900 if (!silc_client_command_call(sg->client, sg->conn, args[0])) { | 1900 if (!silc_client_command_call(sg->client, sg->conn, args[0])) { |
2048 NULL | 2048 NULL |
2049 }; | 2049 }; |
2050 | 2050 |
2051 static PurplePluginProtocolInfo prpl_info = | 2051 static PurplePluginProtocolInfo prpl_info = |
2052 { | 2052 { |
2053 sizeof(PurplePluginProtocolInfo), /* struct_size */ | |
2053 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | | 2054 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | |
2054 OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE | | 2055 OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE | |
2055 OPT_PROTO_SLASH_COMMANDS_NATIVE, | 2056 OPT_PROTO_SLASH_COMMANDS_NATIVE, |
2056 NULL, /* user_splits */ | 2057 NULL, /* user_splits */ |
2057 NULL, /* protocol_options */ | 2058 NULL, /* protocol_options */ |
2090 NULL, /* chat_whisper */ | 2091 NULL, /* chat_whisper */ |
2091 silcpurple_chat_send, /* chat_send */ | 2092 silcpurple_chat_send, /* chat_send */ |
2092 silcpurple_keepalive, /* keepalive */ | 2093 silcpurple_keepalive, /* keepalive */ |
2093 NULL, /* register_user */ | 2094 NULL, /* register_user */ |
2094 NULL, /* get_cb_info */ | 2095 NULL, /* get_cb_info */ |
2095 NULL, /* get_cb_away */ | |
2096 NULL, /* alias_buddy */ | 2096 NULL, /* alias_buddy */ |
2097 NULL, /* group_buddy */ | 2097 NULL, /* group_buddy */ |
2098 NULL, /* rename_group */ | 2098 NULL, /* rename_group */ |
2099 NULL, /* buddy_free */ | 2099 NULL, /* buddy_free */ |
2100 NULL, /* convo_closed */ | 2100 NULL, /* convo_closed */ |
2115 NULL, /* send_raw */ | 2115 NULL, /* send_raw */ |
2116 NULL, /* roomlist_room_serialize */ | 2116 NULL, /* roomlist_room_serialize */ |
2117 NULL, /* unregister_user */ | 2117 NULL, /* unregister_user */ |
2118 NULL, /* send_attention */ | 2118 NULL, /* send_attention */ |
2119 NULL, /* get_attention_types */ | 2119 NULL, /* get_attention_types */ |
2120 sizeof(PurplePluginProtocolInfo), /* struct_size */ | |
2121 NULL, /* get_account_text_table */ | 2120 NULL, /* get_account_text_table */ |
2122 NULL, /* initiate_media */ | 2121 NULL, /* initiate_media */ |
2123 NULL, /* get_media_caps */ | 2122 NULL, /* get_media_caps */ |
2124 NULL, /* get_moods */ | 2123 NULL, /* get_moods */ |
2125 NULL, /* set_public_alias */ | 2124 NULL, /* set_public_alias */ |
2126 NULL, /* get_public_alias */ | 2125 NULL /* get_public_alias */ |
2127 NULL, /* add_buddy_with_invite */ | |
2128 NULL /* add_buddies_with_invite */ | |
2129 }; | 2126 }; |
2130 | 2127 |
2131 static PurplePluginInfo info = | 2128 static PurplePluginInfo info = |
2132 { | 2129 { |
2133 PURPLE_PLUGIN_MAGIC, | 2130 PURPLE_PLUGIN_MAGIC, |