Changes in / [de03374:2379566]
- Files:
-
- 5 added
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
rde03374 r2379566 10 10 11 11 # Program variables 12 objects = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) unix.o user.o 13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/nogaim.h12 objects = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) unix.o user.o dcc.o 13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h dcc.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/nogaim.h protocols/ft.h 14 14 subdirs = lib protocols 15 15 -
account.c
rde03374 r2379566 95 95 g_free( acc->server ); 96 96 if( *value ) 97 { 97 98 acc->server = g_strdup( value ); 99 return value; 100 } 98 101 else 102 { 99 103 acc->server = NULL; 100 return value; 104 return g_strdup( set->def ); 105 } 101 106 } 102 107 else if( strcmp( set->key, "auto_connect" ) == 0 ) -
conf.c
rde03374 r2379566 64 64 conf->ping_timeout = 300; 65 65 conf->user = NULL; 66 conf->max_filetransfer_size = G_MAXUINT; 66 67 proxytype = 0; 67 68 -
conf.h
rde03374 r2379566 50 50 int ping_timeout; 51 51 char *user; 52 size_t max_filetransfer_size; 52 53 } conf_t; 53 54 -
doc/CREDITS
rde03374 r2379566 55 55 - Greg (gropeep.org), for updating the Yahoo! module to fix some issues 56 56 that were there for quite some time already. 57 - misc@mandriva.org for lots of Jabber contributions. 57 58 58 59 - And all other users who help us by sending useful bug reports, positive -
doc/user-guide/commands.xml
rde03374 r2379566 17 17 18 18 <bitlbee-command name="add"> 19 <syntax>account add <protocol> <username> <password> [<server>]</syntax>19 <syntax>account add <protocol> <username> <password></syntax> 20 20 21 21 <description> … … 26 26 27 27 <bitlbee-command name="jabber"> 28 <syntax>account add jabber <handle@server.tld> <password> [<servertag>]</syntax>28 <syntax>account add jabber <handle@server.tld> <password></syntax> 29 29 30 30 <description> … … 50 50 51 51 <bitlbee-command name="oscar"> 52 <syntax>account add oscar <handle> <password> [<servername>]</syntax>52 <syntax>account add oscar <handle> <password></syntax> 53 53 54 54 <description> 55 55 <para> 56 Specifying a server is required for OSCAR, since OSCAR can be used for both ICQ- and AIM-connections. Although these days it's supposed to be possible to connect to ICQ via AIM-servers and vice versa, we like to stick with this separation for now. For ICQ connections, the servername is <emphasis>login.icq.com</emphasis>, for AIM connections it's <emphasis>login.oscar.aol.com</emphasis>.56 OSCAR is the protocol used to connect to AIM and/or ICQ. The servers will automatically detect if you're using a numeric or non-numeric username so there's no need to tell which network you want to connect to. 57 57 </para> 58 58 </description> 59 59 60 60 <ircexample> 61 <ircline nick="wilmer">account add oscar 72696705 hobbelmeeuw login.icq.com</ircline>61 <ircline nick="wilmer">account add oscar 72696705 hobbelmeeuw</ircline> 62 62 <ircline nick="root">Account successfully added</ircline> 63 63 </ircexample> … … 595 595 <description> 596 596 <para> 597 Can be set for Jabber- and OSCAR-connections. For OSCAR, this must be set to <emphasis>login.icq.com</emphasis> if it's an ICQ connection, or <emphasis>login.oscar.aol.com</emphasis> if it's an AIM connection. For Jabber, you have to set this if the servername isn't equal to the part after the @ in the Jabber handle.597 Can be set for Jabber- and OSCAR-connections. For Jabber, you might have to set this if the servername isn't equal to the part after the @ in the Jabber handle. For OSCAR this shouldn't be necessary anymore in recent BitlBee versions. 598 598 </para> 599 599 </description> … … 861 861 862 862 </bitlbee-command> 863 864 <bitlbee-command name="transfers"> 865 <short-description>Monitor, cancel, or reject file transfers</short-description> 866 <syntax>transfers [<cancel> id | <reject>]</syntax> 867 868 <description> 869 <para> 870 Without parameters the currently pending file transfers and their status will be listed. Available actions are <emphasis>cancel</emphasis> and <emphasis>reject</emphasis>. See <emphasis>help transfers <action></emphasis> for more information. 871 </para> 872 873 <ircexample> 874 <ircline nick="ulim">transfers</ircline> 875 </ircexample> 876 </description> 877 878 <bitlbee-command name="cancel"> 879 <short-description>Cancels the file transfer with the given id</short-description> 880 <syntax>transfers <cancel> id</syntax> 881 882 <description> 883 <para>Cancels the file transfer with the given id</para> 884 </description> 885 886 <ircexample> 887 <ircline nick="ulim">transfers cancel 1</ircline> 888 <ircline nick="root">Canceling file transfer for test</ircline> 889 </ircexample> 890 </bitlbee-command> 891 892 <bitlbee-command name="reject"> 893 <short-description>Rejects all incoming transfers</short-description> 894 <syntax>transfers <reject></syntax> 895 896 <description> 897 <para>Rejects all incoming (not already transferring) file transfers. Since you probably have only one incoming transfer at a time, no id is neccessary. Or is it?</para> 898 </description> 899 900 <ircexample> 901 <ircline nick="ulim">transfers reject</ircline> 902 </ircexample> 903 </bitlbee-command> 904 </bitlbee-command> 905 863 906 </chapter> -
doc/user-guide/quickstart.xml
rde03374 r2379566 38 38 39 39 <ircexample> 40 <ircline nick="you">account add oscar 72696705 QuickStart login.icq.com</ircline>40 <ircline nick="you">account add jabber bitlbee@jabber.org QuickStart</ircline> 41 41 <ircline nick="root">Account successfully added</ircline> 42 42 </ircexample> 43 43 44 44 <para> 45 Other available IM protocols are jabber, msn, and yahoo. Oscar is the protocol used by ICQ and AOL. For oscar, you need to specify the IM-server as a fourth argument (for msn and yahoo there is no fourth argument). For AOL Instant Messenger, the server name is <emphasis>login.oscar.aol.com</emphasis>. For ICQ, the server name is <emphasis>login.icq.com</emphasis>.45 Other available IM protocols are msn, oscar, and yahoo. Oscar is the protocol used by ICQ and AOL. 46 46 </para> 47 47 -
irc.c
rde03374 r2379566 28 28 #include "crypting.h" 29 29 #include "ipc.h" 30 #include "dcc.h" 31 32 #include <regex.h> 33 #include <netinet/in.h> 30 34 31 35 static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond ); … … 992 996 return( 1 ); 993 997 } 998 else if( g_strncasecmp( s + 1, "DCC", 3 ) == 0 ) 999 { 1000 if( u && u->ic && u->ic->acc->prpl->transfer_request ) 1001 { 1002 file_transfer_t *ft = dcc_request( u->ic, s + 5 ); 1003 if ( ft ) 1004 u->ic->acc->prpl->transfer_request( u->ic, ft, u->handle ); 1005 } 1006 return( 1 ); 1007 } 994 1008 else 995 1009 { 996 irc_usermsg( irc, " Non-ACTION CTCP's aren't supported" );1010 irc_usermsg( irc, "Supported CTCPs are ACTION, VERSION, PING, TYPING, DCC" ); 997 1011 return( 0 ); 998 1012 } -
irc.h
rde03374 r2379566 84 84 struct query *queries; 85 85 struct account *accounts; 86 GSList *file_transfers; 86 87 87 88 struct __USER *users; -
irc_commands.c
rde03374 r2379566 207 207 if( c->ic && c->ic->acc->prpl->chat_invite ) 208 208 { 209 c->ic->acc->prpl->chat_invite( c, "", u->handle);209 c->ic->acc->prpl->chat_invite( c, u->handle, NULL ); 210 210 irc_reply( irc, 341, "%s %s", nick, channel ); 211 211 return; -
lib/misc.c
rde03374 r2379566 44 44 #include <resolv.h> 45 45 #endif 46 47 #include "ssl_client.h" 46 48 47 49 void strip_linefeed(gchar *text) … … 591 593 return g_string_free( ret, FALSE ); 592 594 } 595 596 gboolean ssl_sockerr_again( void *ssl ) 597 { 598 if( ssl ) 599 return ssl_errno == SSL_AGAIN; 600 else 601 return sockerr_again(); 602 } -
lib/misc.h
rde03374 r2379566 66 66 G_MODULE_EXPORT char *word_wrap( char *msg, int line_len ); 67 67 68 G_MODULE_EXPORT gboolean ssl_sockerr_again( void *ssl ); 69 68 70 #endif -
lib/ssl_gnutls.c
rde03374 r2379566 223 223 closesocket( conn->fd ); 224 224 225 gnutls_deinit( conn->session ); 226 gnutls_certificate_free_credentials( conn->xcred ); 225 if( conn->session ) 226 gnutls_deinit( conn->session ); 227 if( conn->xcred ) 228 gnutls_certificate_free_credentials( conn->xcred ); 227 229 g_free( conn ); 228 230 } -
nick.c
rde03374 r2379566 154 154 With one difference, we allow dashes. */ 155 155 156 static char *nick_lc_chars = "0123456789abcdefghijklmnopqrstuvwxyz{}^ -_|";157 static char *nick_uc_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[]~ -_\\";158 159 void nick_strip( char * 156 static char *nick_lc_chars = "0123456789abcdefghijklmnopqrstuvwxyz{}^`-_|"; 157 static char *nick_uc_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[]~`-_\\"; 158 159 void nick_strip( char *nick ) 160 160 { 161 161 int i, j; … … 170 170 } 171 171 } 172 if( isdigit( nick[0] ) ) 173 { 174 char *orig; 175 176 orig = g_strdup( nick ); 177 g_snprintf( nick, MAX_NICK_LENGTH, "_%s", orig ); 178 g_free( orig ); 179 j ++; 180 } 172 181 while( j <= MAX_NICK_LENGTH ) 173 182 nick[j++] = '\0'; … … 178 187 const char *s; 179 188 180 /* Empty/long nicks are not allowed */181 if( !*nick || strlen( nick ) > MAX_NICK_LENGTH )189 /* Empty/long nicks are not allowed, nor numbers at [0] */ 190 if( !*nick || isdigit( nick[0] ) || strlen( nick ) > MAX_NICK_LENGTH ) 182 191 return( 0 ); 183 192 -
protocols/jabber/Makefile
rde03374 r2379566 10 10 11 11 # [SH] Program variables 12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o xmltree.o 12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o xmltree.o si.o s5bytestream.o 13 13 14 14 CFLAGS += -Wall -
protocols/jabber/conference.c
rde03374 r2379566 174 174 175 175 return 1; 176 } 177 178 void jabber_chat_invite( struct groupchat *c, char *who, char *message ) 179 { 180 struct xt_node *node; 181 struct im_connection *ic = c->ic; 182 struct jabber_chat *jc = c->data; 183 184 node = xt_new_node( "reason", message, NULL ); 185 186 node = xt_new_node( "invite", NULL, node ); 187 xt_add_attr( node, "to", who ); 188 189 node = xt_new_node( "x", NULL, node ); 190 xt_add_attr( node, "xmlns", XMLNS_MUC_USER ); 191 192 node = jabber_make_packet( "message", NULL, jc->name, node ); 193 194 jabber_write_packet( ic, node ); 195 196 xt_free_node( node ); 176 197 } 177 198 -
protocols/jabber/io.c
rde03374 r2379566 120 120 return TRUE; 121 121 } 122 else if( st == 0 || ( st < 0 && !s ockerr_again() ) )122 else if( st == 0 || ( st < 0 && !ssl_sockerr_again( jd->ssl ) ) ) 123 123 { 124 124 /* Set fd to -1 to make sure we won't write to it anymore. */ … … 231 231 } 232 232 } 233 else if( st == 0 || ( st < 0 && !s ockerr_again() ) )233 else if( st == 0 || ( st < 0 && !ssl_sockerr_again( jd->ssl ) ) ) 234 234 { 235 235 closesocket( jd->fd ); -
protocols/jabber/iq.c
rde03374 r2379566 50 50 else if( strcmp( type, "get" ) == 0 ) 51 51 { 52 if( !( c = xt_find_node( node->children, "query" ) ) || 52 if( !( ( c = xt_find_node( node->children, "query" ) ) || 53 ( c = xt_find_node( node->children, "ping" ) ) ) || /* O_o WHAT is wrong with just <query/> ????? */ 53 54 !( s = xt_find_attr( c, "xmlns" ) ) ) 54 55 { … … 81 82 xt_add_child( reply, xt_new_node( "tz", buf, NULL ) ); 82 83 } 83 else if( strcmp( s, XMLNS_DISCOVER ) == 0 ) 84 else if( strcmp( s, XMLNS_PING ) == 0 ) 85 { 86 xt_free_node( reply ); 87 reply = jabber_make_packet( "iq", "result", xt_find_attr( node, "from" ), NULL ); 88 if( ( s = xt_find_attr( node, "id" ) ) ) 89 xt_add_attr( reply, "id", s ); 90 pack = 0; 91 } 92 else if( strcmp( s, XMLNS_DISCO_INFO ) == 0 ) 84 93 { 85 94 const char *features[] = { XMLNS_VERSION, … … 87 96 XMLNS_CHATSTATES, 88 97 XMLNS_MUC, 98 XMLNS_PING, 99 XMLNS_SI, 100 XMLNS_BYTESTREAMS, 101 XMLNS_FILETRANSFER, 89 102 NULL }; 90 103 const char **f; … … 106 119 { 107 120 xt_free_node( reply ); 108 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );121 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL ); 109 122 pack = 0; 110 123 } … … 112 125 else if( strcmp( type, "set" ) == 0 ) 113 126 { 114 if( !( c = xt_find_node( node->children, "query" ) ) || 127 if( ( c = xt_find_node( node->children, "si" ) ) && 128 ( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_SI ) == 0 ) ) 129 { 130 return jabber_si_handle_request( ic, node, c ); 131 } else if( !( c = xt_find_node( node->children, "query" ) ) || 115 132 !( s = xt_find_attr( c, "xmlns" ) ) ) 116 133 { 117 134 imcb_log( ic, "WARNING: Received incomplete IQ-%s packet", type ); 118 135 return XT_HANDLED; 119 } 120 136 } else if( strcmp( s, XMLNS_ROSTER ) == 0 ) 137 { 121 138 /* This is a roster push. XMPP servers send this when someone 122 139 was added to (or removed from) the buddy list. AFAIK they're 123 140 sent even if we added this buddy in our own session. */ 124 if( strcmp( s, XMLNS_ROSTER ) == 0 )125 {126 141 int bare_len = strlen( ic->acc->user ); 127 142 … … 140 155 141 156 xt_free_node( reply ); 142 reply = jabber_make_error_packet( node, "not-allowed", "cancel" );157 reply = jabber_make_error_packet( node, "not-allowed", "cancel", NULL ); 143 158 pack = 0; 144 159 } 145 } 146 else 160 } else if( strcmp( s, XMLNS_BYTESTREAMS ) == 0 ) 161 { 162 /* Bytestream Request (stage 2 of file transfer) */ 163 return jabber_bs_recv_request( ic, node, c ); 164 } else 147 165 { 148 166 xt_free_node( reply ); 149 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );167 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL ); 150 168 pack = 0; 151 169 } … … 557 575 return st; 558 576 } 577 578 xt_status jabber_iq_parse_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); 579 580 xt_status jabber_iq_query_features( struct im_connection *ic, char *bare_jid ) 581 { 582 struct xt_node *node, *query; 583 struct jabber_buddy *bud; 584 585 if( ( bud = jabber_buddy_by_jid( ic, bare_jid , 0 ) ) == NULL ) 586 { 587 /* Who cares about the unknown... */ 588 imcb_log( ic, "Couldnt find the man: %s", bare_jid); 589 return 0; 590 } 591 592 if( bud->features ) /* been here already */ 593 return XT_HANDLED; 594 595 node = xt_new_node( "query", NULL, NULL ); 596 xt_add_attr( node, "xmlns", XMLNS_DISCO_INFO ); 597 598 if( !( query = jabber_make_packet( "iq", "get", bare_jid, node ) ) ) 599 { 600 imcb_log( ic, "WARNING: Couldn't generate feature query" ); 601 xt_free_node( node ); 602 } 603 604 jabber_cache_add( ic, query, jabber_iq_parse_features ); 605 606 return jabber_write_packet( ic, query ); 607 } 608 609 xt_status jabber_iq_parse_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ) 610 { 611 struct xt_node *c; 612 struct jabber_buddy *bud; 613 char *feature; 614 615 if( !( c = xt_find_node( node->children, "query" ) ) || 616 !( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_DISCO_INFO ) == 0 ) ) 617 { 618 imcb_log( ic, "WARNING: Received incomplete IQ-result packet for discover" ); 619 return XT_HANDLED; 620 } 621 if( ( bud = jabber_buddy_by_jid( ic, xt_find_attr( node, "from") , 0 ) ) == NULL ) 622 { 623 /* Who cares about the unknown... */ 624 imcb_log( ic, "Couldnt find the man: %s", xt_find_attr( node, "from")); 625 return 0; 626 } 627 628 c = c->children; 629 while( ( c = xt_find_node( c, "feature" ) ) ) { 630 feature = xt_find_attr( c, "var" ); 631 bud->features = g_slist_append(bud->features, g_strdup(feature) ); 632 c = c->next; 633 } 634 635 return XT_HANDLED; 636 } 637 638 xt_status jabber_iq_parse_server_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); 639 640 xt_status jabber_iq_query_server( struct im_connection *ic, char *jid, char *xmlns ) 641 { 642 struct xt_node *node, *query; 643 struct jabber_data *jd = ic->proto_data; 644 645 node = xt_new_node( "query", NULL, NULL ); 646 xt_add_attr( node, "xmlns", xmlns ); 647 648 if( !( query = jabber_make_packet( "iq", "get", jid, node ) ) ) 649 { 650 imcb_log( ic, "WARNING: Couldn't generate server query" ); 651 xt_free_node( node ); 652 } 653 654 jd->have_streamhosts--; 655 jabber_cache_add( ic, query, jabber_iq_parse_server_features ); 656 657 return jabber_write_packet( ic, query ); 658 } 659 660 /* 661 * Query the server for "items", query each "item" for identities, query each "item" that's a proxy for it's bytestream info 662 */ 663 xt_status jabber_iq_parse_server_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ) 664 { 665 struct xt_node *c; 666 struct jabber_data *jd = ic->proto_data; 667 668 if( !( c = xt_find_node( node->children, "query" ) ) || 669 !xt_find_attr( node, "from" ) ) 670 { 671 imcb_log( ic, "WARNING: Received incomplete IQ-result packet for discover" ); 672 return XT_HANDLED; 673 } 674 675 jd->have_streamhosts++; 676 677 if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_DISCO_ITEMS ) == 0 ) 678 { 679 char *item, *itemjid; 680 681 /* answer from server */ 682 683 c = c->children; 684 while( ( c = xt_find_node( c, "item" ) ) ) 685 { 686 item = xt_find_attr( c, "name" ); 687 itemjid = xt_find_attr( c, "jid" ); 688 689 jabber_iq_query_server( ic, itemjid, XMLNS_DISCO_INFO ); 690 691 c = c->next; 692 } 693 } else if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_DISCO_INFO ) == 0 ) 694 { 695 char *category, *type; 696 697 /* answer from potential proxy */ 698 699 c = c->children; 700 while( ( c = xt_find_node( c, "identity" ) ) ) 701 { 702 category = xt_find_attr( c, "category" ); 703 type = xt_find_attr( c, "type" ); 704 705 if( type && ( strcmp( type, "bytestreams" ) == 0 ) && 706 category && ( strcmp( category, "proxy" ) == 0 ) ) 707 jabber_iq_query_server( ic, xt_find_attr( node, "from" ), XMLNS_BYTESTREAMS ); 708 709 c = c->next; 710 } 711 } else if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_BYTESTREAMS ) == 0 ) 712 { 713 char *host, *jid; 714 int port; 715 716 /* answer from proxy */ 717 718 if( ( c = xt_find_node( c->children, "streamhost" ) ) && 719 ( host = xt_find_attr( c, "host" ) ) && 720 ( port = atoi( xt_find_attr( c, "port" ) ) ) && 721 ( jid = xt_find_attr( c, "jid" ) ) ) 722 { 723 jabber_streamhost_t *sh = g_new0( jabber_streamhost_t, 1 ); 724 sh->jid = g_strdup( jid ); 725 sh->host = g_strdup( host ); 726 sprintf( sh->port, "%u", port ); 727 728 imcb_log( ic, "Proxy found: jid %s host %s port %u", jid, host, port ); 729 jd->streamhosts = g_slist_append( jd->streamhosts, sh ); 730 } 731 } 732 733 if( jd->have_streamhosts == 0 ) 734 jd->have_streamhosts++; 735 return XT_HANDLED; 736 } -
protocols/jabber/jabber.c
rde03374 r2379566 427 427 } 428 428 429 static void jabber_chat_invite_( struct groupchat *c, char *who, char *msg ) 430 { 431 struct jabber_chat *jc = c->data; 432 gchar *msg_alt = NULL; 433 434 if( msg == NULL ) 435 msg_alt = g_strdup_printf( "%s invited you to %s", c->ic->acc->user, jc->name ); 436 437 if( c && who ) 438 jabber_chat_invite( c, who, msg ? msg : msg_alt ); 439 440 g_free( msg_alt ); 441 } 442 429 443 static void jabber_keepalive( struct im_connection *ic ) 430 444 { … … 498 512 ret->chat_msg = jabber_chat_msg_; 499 513 ret->chat_topic = jabber_chat_topic_; 500 // ret->chat_invite = jabber_chat_invite;514 ret->chat_invite = jabber_chat_invite_; 501 515 ret->chat_leave = jabber_chat_leave_; 502 516 ret->chat_join = jabber_chat_join_; … … 504 518 ret->send_typing = jabber_send_typing; 505 519 ret->handle_cmp = g_strcasecmp; 520 ret->transfer_request = jabber_si_transfer_request; 506 521 507 522 register_protocol( ret ); -
protocols/jabber/jabber.h
rde03374 r2379566 57 57 } jabber_buddy_flags_t; 58 58 59 /* Stores a streamhost's(a.k.a. proxy) data */ 60 typedef struct 61 { 62 char *jid; 63 char *host; 64 char port[6]; 65 } jabber_streamhost_t; 66 59 67 struct jabber_data 60 68 { … … 81 89 GHashTable *node_cache; 82 90 GHashTable *buddies; 91 92 GSList *filetransfers; 93 GSList *streamhosts; 94 int have_streamhosts; 83 95 }; 84 96 … … 109 121 struct jabber_away_state *away_state; 110 122 char *away_message; 123 GSList *features; 111 124 112 125 time_t last_act; … … 122 135 char *my_full_jid; /* Separate copy because of case sensitivity. */ 123 136 struct jabber_buddy *me; 137 }; 138 139 struct jabber_transfer 140 { 141 /* bitlbee's handle for this transfer */ 142 file_transfer_t *ft; 143 144 /* the stream's private handle */ 145 gpointer streamhandle; 146 147 struct im_connection *ic; 148 149 int watch_in; 150 int watch_out; 151 152 char *ini_jid; 153 char *tgt_jid; 154 char *iq_id; 155 char *sid; 156 int accepted; 157 158 size_t bytesread, byteswritten; 159 int fd; 160 struct sockaddr_storage saddr; 124 161 }; 125 162 … … 149 186 150 187 /* Some supported extensions/legacy stuff */ 151 #define XMLNS_AUTH "jabber:iq:auth" /* XEP-0078 */ 152 #define XMLNS_VERSION "jabber:iq:version" /* XEP-0092 */ 153 #define XMLNS_TIME "jabber:iq:time" /* XEP-0090 */ 154 #define XMLNS_VCARD "vcard-temp" /* XEP-0054 */ 155 #define XMLNS_DELAY "jabber:x:delay" /* XEP-0091 */ 156 #define XMLNS_CHATSTATES "http://jabber.org/protocol/chatstates" /* 0085 */ 157 #define XMLNS_DISCOVER "http://jabber.org/protocol/disco#info" /* 0030 */ 158 #define XMLNS_MUC "http://jabber.org/protocol/muc" /* XEP-0045 */ 159 #define XMLNS_MUC_USER "http://jabber.org/protocol/muc#user"/* XEP-0045 */ 188 #define XMLNS_AUTH "jabber:iq:auth" /* XEP-0078 */ 189 #define XMLNS_VERSION "jabber:iq:version" /* XEP-0092 */ 190 #define XMLNS_TIME "jabber:iq:time" /* XEP-0090 */ 191 #define XMLNS_PING "urn:xmpp:ping" /* XEP-0199 */ 192 #define XMLNS_VCARD "vcard-temp" /* XEP-0054 */ 193 #define XMLNS_DELAY "jabber:x:delay" /* XEP-0091 */ 194 #define XMLNS_XDATA "jabber:x:data" /* XEP-0004 */ 195 #define XMLNS_CHATSTATES "http://jabber.org/protocol/chatstates" /* XEP-0085 */ 196 #define XMLNS_DISCO_INFO "http://jabber.org/protocol/disco#info" /* XEP-0030 */ 197 #define XMLNS_DISCO_ITEMS "http://jabber.org/protocol/disco#items" /* XEP-0030 */ 198 #define XMLNS_MUC "http://jabber.org/protocol/muc" /* XEP-0045 */ 199 #define XMLNS_MUC_USER "http://jabber.org/protocol/muc#user" /* XEP-0045 */ 200 #define XMLNS_FEATURE "http://jabber.org/protocol/feature-neg" /* XEP-0020 */ 201 #define XMLNS_SI "http://jabber.org/protocol/si" /* XEP-0095 */ 202 #define XMLNS_FILETRANSFER "http://jabber.org/protocol/si/profile/file-transfer" /* XEP-0096 */ 203 #define XMLNS_BYTESTREAMS "http://jabber.org/protocol/bytestreams" /* XEP-0065 */ 204 #define XMLNS_IBB "http://jabber.org/protocol/ibb" /* XEP-0047 */ 160 205 161 206 /* iq.c */ … … 167 212 int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name ); 168 213 int jabber_remove_from_roster( struct im_connection *ic, char *handle ); 214 xt_status jabber_iq_query_features( struct im_connection *ic, char *bare_jid ); 215 xt_status jabber_iq_query_server( struct im_connection *ic, char *jid, char *xmlns ); 216 217 /* si.c */ 218 int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, struct xt_node *sinode ); 219 void jabber_si_transfer_request( struct im_connection *ic, file_transfer_t *ft, char *who ); 220 void jabber_si_free_transfer( file_transfer_t *ft); 221 222 /* s5bytestream.c */ 223 int jabber_bs_recv_request( struct im_connection *ic, struct xt_node *node, struct xt_node *qnode); 224 gboolean jabber_bs_send_start( struct jabber_transfer *tf ); 225 gboolean jabber_bs_send_write( file_transfer_t *ft, char *buffer, unsigned int len ); 169 226 170 227 /* message.c */ … … 180 237 char *set_eval_tls( set_t *set, char *value ); 181 238 struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children ); 182 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type );239 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type, char *err_code ); 183 240 void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func ); 184 241 struct xt_node *jabber_cache_get( struct im_connection *ic, char *id ); … … 237 294 void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node ); 238 295 void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node ); 296 void jabber_chat_invite( struct groupchat *c, char *who, char *message ); 239 297 240 298 #endif -
protocols/jabber/jabber_util.c
rde03374 r2379566 97 97 } 98 98 99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type )99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type, char *err_code ) 100 100 { 101 101 struct xt_node *node, *c; … … 109 109 c = xt_new_node( "error", NULL, c ); 110 110 xt_add_attr( c, "type", err_type ); 111 112 /* Add the error code, if present */ 113 if (err_code) 114 xt_add_attr( c, "code", err_code ); 111 115 112 116 /* To make the actual error packet, we copy the original packet and … … 291 295 new = g_new( char, len + 1 ); 292 296 for( i = 0; i < len; i ++ ) 297 { 298 /* don't normalize the resource */ 299 if( orig[i] == '/' ) 300 break; 293 301 new[i] = tolower( orig[i] ); 302 } 303 for( ; i < len; i ++ ) 304 new[i] = orig[i]; 294 305 295 306 new[i] = 0; -
protocols/msn/msn.c
rde03374 r2379566 241 241 } 242 242 243 static void msn_chat_invite( struct groupchat *c, char * msg, char *who)243 static void msn_chat_invite( struct groupchat *c, char *who, char *message ) 244 244 { 245 245 struct msn_switchboard *sb = msn_sb_by_chat( c ); -
protocols/nogaim.h
rde03374 r2379566 43 43 #include "proxy.h" 44 44 #include "md5.h" 45 #include "ft.h" 45 46 46 47 #define BUF_LEN MSG_LEN … … 228 229 * - Most protocols will just want to set this to g_strcasecmp().*/ 229 230 int (* handle_cmp) (const char *who1, const char *who2); 231 232 /* Incoming transfer request */ 233 void (* transfer_request) (struct im_connection *, file_transfer_t *ft, char *handle ); 230 234 }; 231 235 -
protocols/oscar/aim.h
rde03374 r2379566 94 94 * 95 95 */ 96 #define AIM_DEFAULT_LOGIN_SERVER "login. oscar.aol.com"96 #define AIM_DEFAULT_LOGIN_SERVER "login.messaging.aol.com" 97 97 #define AIM_LOGIN_PORT 5190 98 98 -
protocols/oscar/oscar.c
rde03374 r2379566 341 341 set_t *s; 342 342 343 s = set_add( &acc->set, "server", NULL, set_eval_account, acc );343 s = set_add( &acc->set, "server", AIM_DEFAULT_LOGIN_SERVER, set_eval_account, acc ); 344 344 s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY; 345 345 … … 356 356 struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1); 357 357 358 if (isdigit(acc->user[0])) { 359 odata->icq = TRUE; 360 /* This is odd but it's necessary for a proper do_import and do_export. 361 We don't do those anymore, but let's stick with it, just in case 362 it accidentally fixes something else too... </bitlbee> */ 363 /* ic->acc->pass[8] = 0; 364 Not touching this anymore now that it belongs to account_t! 365 Let's hope nothing will break. ;-) */ 366 } else { 358 if (!isdigit(acc->user[0])) { 367 359 ic->flags |= OPT_DOES_HTML; 368 360 } … … 385 377 } 386 378 387 if (acc->server == NULL) {388 imcb_error(ic, "No servername specified");389 imc_logout(ic, FALSE);390 return;391 }392 393 if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&394 g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {395 imcb_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);396 }397 398 379 imcb_log(ic, _("Signon: %s"), ic->acc->user); 399 380 … … 402 383 403 384 conn->status |= AIM_CONN_STATUS_INPROGRESS; 404 conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic); 385 conn->fd = proxy_connect(set_getstr(&acc->set, "server"), 386 AIM_LOGIN_PORT, oscar_login_connect, ic); 405 387 if (conn->fd < 0) { 406 388 imcb_error(ic, _("Couldn't connect to host")); … … 2509 2491 } 2510 2492 2511 void oscar_chat_invite(struct groupchat *c, char * message, char *who)2493 void oscar_chat_invite(struct groupchat *c, char *who, char *message) 2512 2494 { 2513 2495 struct im_connection *ic = c->ic; -
protocols/yahoo/yahoo.c
rde03374 r2379566 306 306 } 307 307 308 static void byahoo_chat_invite( struct groupchat *c, char * msg, char *who)308 static void byahoo_chat_invite( struct groupchat *c, char *who, char *msg ) 309 309 { 310 310 struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data; -
root_commands.c
rde03374 r2379566 199 199 break; 200 200 default: 201 irc_usermsg( irc, "Error: '%d'", status );201 irc_usermsg( irc, "Error: `%d'", status ); 202 202 break; 203 203 } … … 234 234 a = account_add( irc, prpl, cmd[3], cmd[4] ); 235 235 if( cmd[5] ) 236 { 237 irc_usermsg( irc, "Warning: Passing a servername/other flags to `account add' " 238 "is now deprecated. Use `account set' instead." ); 236 239 set_setstr( &a->set, "server", cmd[5] ); 240 } 237 241 238 242 irc_usermsg( irc, "Account successfully added" ); … … 317 321 else 318 322 { 319 irc_usermsg( irc, "No accounts known. Use 'account add' to add one." );323 irc_usermsg( irc, "No accounts known. Use `account add' to add one." ); 320 324 } 321 325 } … … 403 407 } 404 408 405 if( ( strcmp( cmd[3], "=" ) ) == 0 && cmd[4] ) 406 irc_usermsg( irc, "Warning: Correct syntax: \002account set <variable> <value>\002 (without =)" ); 407 else if( g_strncasecmp( cmd[2], "-del", 4 ) == 0 ) 409 if( g_strncasecmp( cmd[2], "-del", 4 ) == 0 ) 408 410 set_reset( &a->set, set_name ); 409 411 else … … 745 747 static void cmd_set( irc_t *irc, char **cmd ) 746 748 { 747 char *set_name = NULL;749 char *set_name = cmd[1]; 748 750 749 751 if( cmd[1] && cmd[2] ) 750 752 { 751 if( ( strcmp( cmd[2], "=" ) ) == 0 && cmd[3] ) 752 { 753 irc_usermsg( irc, "Warning: Correct syntax: \002set <variable> <value>\002 (without =)" ); 754 return; 755 } 756 else if( g_strncasecmp( cmd[1], "-del", 4 ) == 0 ) 753 if( g_strncasecmp( cmd[1], "-del", 4 ) == 0 ) 757 754 { 758 755 set_reset( &irc->set, cmd[2] ); … … 762 759 { 763 760 set_setstr( &irc->set, cmd[1], cmd[2] ); 764 set_name = cmd[1];765 761 } 766 762 } … … 972 968 irc_usermsg( irc, "Tried to join chat, not sure if this was successful" ); 973 969 g_free( channel ); 970 } 971 } 972 973 static void cmd_transfers( irc_t *irc, char **cmd ) 974 { 975 GSList *files = irc->file_transfers; 976 enum { LIST, REJECT, CANCEL }; 977 int subcmd = LIST; 978 int fid; 979 980 if( !files ) 981 { 982 irc_usermsg( irc, "No pending transfers" ); 983 return; 984 } 985 986 if( cmd[1] && 987 ( strcmp( cmd[1], "reject" ) == 0 ) ) 988 { 989 subcmd = REJECT; 990 } 991 else if( cmd[1] && 992 ( strcmp( cmd[1], "cancel" ) == 0 ) && 993 cmd[2] && 994 ( fid = atoi( cmd[2] ) ) ) 995 { 996 subcmd = CANCEL; 997 } 998 999 for( ; files; files = g_slist_next( files ) ) 1000 { 1001 file_transfer_t *file = files->data; 1002 1003 switch( subcmd ) { 1004 case LIST: 1005 if ( file->status == FT_STATUS_LISTENING ) 1006 irc_usermsg( irc, 1007 "Pending file(id %d): %s (Listening...)", file->local_id, file->file_name); 1008 else 1009 { 1010 int kb_per_s = 0; 1011 time_t diff = time( NULL ) - file->started; 1012 if ( ( file->started > 0 ) && ( file->bytes_transferred > 0 ) ) 1013 kb_per_s = file->bytes_transferred / 1024 / diff; 1014 1015 irc_usermsg( irc, 1016 "Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name, 1017 file->bytes_transferred/1024, file->file_size/1024, kb_per_s); 1018 } 1019 break; 1020 case REJECT: 1021 if( file->status == FT_STATUS_LISTENING ) 1022 { 1023 irc_usermsg( irc, "Rejecting file transfer for %s", file->file_name ); 1024 imcb_file_canceled( file, "Denied by user" ); 1025 } 1026 break; 1027 case CANCEL: 1028 if( file->local_id == fid ) 1029 { 1030 irc_usermsg( irc, "Canceling file transfer for %s", file->file_name ); 1031 imcb_file_canceled( file, "Canceled by user" ); 1032 } 1033 break; 1034 } 974 1035 } 975 1036 } … … 995 1056 { "qlist", 0, cmd_qlist, 0 }, 996 1057 { "join_chat", 2, cmd_join_chat, 0 }, 1058 { "transfers", 0, cmd_transfers, 0 }, 997 1059 { NULL } 998 1060 }; -
tests/check_nick.c
rde03374 r2379566 15 15 "thisisave:ryveryveryverylongnick", 16 16 "t::::est", 17 "test123", 18 "123test", 19 "123", 17 20 NULL }; 18 21 const char *expected[] = { "test", "test", "test", … … 20 23 "thisisaveryveryveryveryl", 21 24 "test", 25 "test123", 26 "_123test", 27 "_123", 22 28 NULL }; 23 29 … … 35 41 START_TEST(test_nick_ok_ok) 36 42 { 37 const char *nicks[] = { "foo", "bar ", "bla[", "blie]",38 "BreEZaH", "\\od^~", NULL };43 const char *nicks[] = { "foo", "bar123", "bla[", "blie]", "BreEZaH", 44 "\\od^~", "_123", "_123test", NULL }; 39 45 int i; 40 46 … … 49 55 { 50 56 const char *nicks[] = { "thisisaveryveryveryveryveryveryverylongnick", 51 "\nillegalchar", "", "nick%", NULL };57 "\nillegalchar", "", "nick%", "123test", NULL }; 52 58 int i; 53 59
Note: See TracChangeset
for help on using the changeset viewer.