Changes in / [2379566:de03374]
- Files:
-
- 5 deleted
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r2379566 rde03374 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 dcc.o13 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.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 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.h 14 14 subdirs = lib protocols 15 15 -
account.c
r2379566 rde03374 95 95 g_free( acc->server ); 96 96 if( *value ) 97 {98 97 acc->server = g_strdup( value ); 99 return value;100 }101 98 else 102 {103 99 acc->server = NULL; 104 return g_strdup( set->def ); 105 } 100 return value; 106 101 } 107 102 else if( strcmp( set->key, "auto_connect" ) == 0 ) -
conf.c
r2379566 rde03374 64 64 conf->ping_timeout = 300; 65 65 conf->user = NULL; 66 conf->max_filetransfer_size = G_MAXUINT;67 66 proxytype = 0; 68 67 -
conf.h
r2379566 rde03374 50 50 int ping_timeout; 51 51 char *user; 52 size_t max_filetransfer_size;53 52 } conf_t; 54 53 -
doc/CREDITS
r2379566 rde03374 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.58 57 59 58 - And all other users who help us by sending useful bug reports, positive -
doc/user-guide/commands.xml
r2379566 rde03374 17 17 18 18 <bitlbee-command name="add"> 19 <syntax>account add <protocol> <username> <password> </syntax>19 <syntax>account add <protocol> <username> <password> [<server>]</syntax> 20 20 21 21 <description> … … 26 26 27 27 <bitlbee-command name="jabber"> 28 <syntax>account add jabber <handle@server.tld> <password> </syntax>28 <syntax>account add jabber <handle@server.tld> <password> [<servertag>]</syntax> 29 29 30 30 <description> … … 50 50 51 51 <bitlbee-command name="oscar"> 52 <syntax>account add oscar <handle> <password> </syntax>52 <syntax>account add oscar <handle> <password> [<servername>]</syntax> 53 53 54 54 <description> 55 55 <para> 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.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>. 57 57 </para> 58 58 </description> 59 59 60 60 <ircexample> 61 <ircline nick="wilmer">account add oscar 72696705 hobbelmeeuw </ircline>61 <ircline nick="wilmer">account add oscar 72696705 hobbelmeeuw login.icq.com</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 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.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. 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 906 863 </chapter> -
doc/user-guide/quickstart.xml
r2379566 rde03374 38 38 39 39 <ircexample> 40 <ircline nick="you">account add jabber bitlbee@jabber.org QuickStart</ircline>40 <ircline nick="you">account add oscar 72696705 QuickStart login.icq.com</ircline> 41 41 <ircline nick="root">Account successfully added</ircline> 42 42 </ircexample> 43 43 44 44 <para> 45 Other available IM protocols are msn, oscar, and yahoo. Oscar is the protocol used by ICQ and AOL.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>. 46 46 </para> 47 47 -
irc.c
r2379566 rde03374 28 28 #include "crypting.h" 29 29 #include "ipc.h" 30 #include "dcc.h"31 32 #include <regex.h>33 #include <netinet/in.h>34 30 35 31 static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond ); … … 996 992 return( 1 ); 997 993 } 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 }1008 994 else 1009 995 { 1010 irc_usermsg( irc, " Supported CTCPs are ACTION, VERSION, PING, TYPING, DCC" );996 irc_usermsg( irc, "Non-ACTION CTCP's aren't supported" ); 1011 997 return( 0 ); 1012 998 } -
irc.h
r2379566 rde03374 84 84 struct query *queries; 85 85 struct account *accounts; 86 GSList *file_transfers;87 86 88 87 struct __USER *users; -
irc_commands.c
r2379566 rde03374 207 207 if( c->ic && c->ic->acc->prpl->chat_invite ) 208 208 { 209 c->ic->acc->prpl->chat_invite( c, u->handle, NULL);209 c->ic->acc->prpl->chat_invite( c, "", u->handle ); 210 210 irc_reply( irc, 341, "%s %s", nick, channel ); 211 211 return; -
lib/misc.c
r2379566 rde03374 44 44 #include <resolv.h> 45 45 #endif 46 47 #include "ssl_client.h"48 46 49 47 void strip_linefeed(gchar *text) … … 593 591 return g_string_free( ret, FALSE ); 594 592 } 595 596 gboolean ssl_sockerr_again( void *ssl )597 {598 if( ssl )599 return ssl_errno == SSL_AGAIN;600 else601 return sockerr_again();602 } -
lib/misc.h
r2379566 rde03374 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 70 68 #endif -
lib/ssl_gnutls.c
r2379566 rde03374 223 223 closesocket( conn->fd ); 224 224 225 if( conn->session ) 226 gnutls_deinit( conn->session ); 227 if( conn->xcred ) 228 gnutls_certificate_free_credentials( conn->xcred ); 225 gnutls_deinit( conn->session ); 226 gnutls_certificate_free_credentials( conn->xcred ); 229 227 g_free( conn ); 230 228 } -
nick.c
r2379566 rde03374 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 * nick )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 }181 172 while( j <= MAX_NICK_LENGTH ) 182 173 nick[j++] = '\0'; … … 187 178 const char *s; 188 179 189 /* Empty/long nicks are not allowed , nor numbers at [0]*/190 if( !*nick || isdigit( nick[0] ) ||strlen( nick ) > MAX_NICK_LENGTH )180 /* Empty/long nicks are not allowed */ 181 if( !*nick || strlen( nick ) > MAX_NICK_LENGTH ) 191 182 return( 0 ); 192 183 -
protocols/jabber/Makefile
r2379566 rde03374 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 si.o s5bytestream.o12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o xmltree.o 13 13 14 14 CFLAGS += -Wall -
protocols/jabber/conference.c
r2379566 rde03374 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 );197 176 } 198 177 -
protocols/jabber/io.c
r2379566 rde03374 120 120 return TRUE; 121 121 } 122 else if( st == 0 || ( st < 0 && !s sl_sockerr_again( jd->ssl) ) )122 else if( st == 0 || ( st < 0 && !sockerr_again() ) ) 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 sl_sockerr_again( jd->ssl) ) )233 else if( st == 0 || ( st < 0 && !sockerr_again() ) ) 234 234 { 235 235 closesocket( jd->fd ); -
protocols/jabber/iq.c
r2379566 rde03374 50 50 else if( strcmp( type, "get" ) == 0 ) 51 51 { 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/> ????? */ 52 if( !( c = xt_find_node( node->children, "query" ) ) || 54 53 !( s = xt_find_attr( c, "xmlns" ) ) ) 55 54 { … … 82 81 xt_add_child( reply, xt_new_node( "tz", buf, NULL ) ); 83 82 } 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 ) 83 else if( strcmp( s, XMLNS_DISCOVER ) == 0 ) 93 84 { 94 85 const char *features[] = { XMLNS_VERSION, … … 96 87 XMLNS_CHATSTATES, 97 88 XMLNS_MUC, 98 XMLNS_PING,99 XMLNS_SI,100 XMLNS_BYTESTREAMS,101 XMLNS_FILETRANSFER,102 89 NULL }; 103 90 const char **f; … … 119 106 { 120 107 xt_free_node( reply ); 121 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" , NULL);108 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" ); 122 109 pack = 0; 123 110 } … … 125 112 else if( strcmp( type, "set" ) == 0 ) 126 113 { 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" ) ) || 114 if( !( c = xt_find_node( node->children, "query" ) ) || 132 115 !( s = xt_find_attr( c, "xmlns" ) ) ) 133 116 { 134 117 imcb_log( ic, "WARNING: Received incomplete IQ-%s packet", type ); 135 118 return XT_HANDLED; 136 } else if( strcmp( s, XMLNS_ROSTER ) == 0 )137 {119 } 120 138 121 /* This is a roster push. XMPP servers send this when someone 139 122 was added to (or removed from) the buddy list. AFAIK they're 140 123 sent even if we added this buddy in our own session. */ 124 if( strcmp( s, XMLNS_ROSTER ) == 0 ) 125 { 141 126 int bare_len = strlen( ic->acc->user ); 142 127 … … 155 140 156 141 xt_free_node( reply ); 157 reply = jabber_make_error_packet( node, "not-allowed", "cancel" , NULL);142 reply = jabber_make_error_packet( node, "not-allowed", "cancel" ); 158 143 pack = 0; 159 144 } 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 145 } 146 else 165 147 { 166 148 xt_free_node( reply ); 167 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" , NULL);149 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" ); 168 150 pack = 0; 169 151 } … … 575 557 return st; 576 558 } 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 info662 */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
r2379566 rde03374 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 443 429 static void jabber_keepalive( struct im_connection *ic ) 444 430 { … … 512 498 ret->chat_msg = jabber_chat_msg_; 513 499 ret->chat_topic = jabber_chat_topic_; 514 ret->chat_invite = jabber_chat_invite_;500 // ret->chat_invite = jabber_chat_invite; 515 501 ret->chat_leave = jabber_chat_leave_; 516 502 ret->chat_join = jabber_chat_join_; … … 518 504 ret->send_typing = jabber_send_typing; 519 505 ret->handle_cmp = g_strcasecmp; 520 ret->transfer_request = jabber_si_transfer_request;521 506 522 507 register_protocol( ret ); -
protocols/jabber/jabber.h
r2379566 rde03374 57 57 } jabber_buddy_flags_t; 58 58 59 /* Stores a streamhost's(a.k.a. proxy) data */60 typedef struct61 {62 char *jid;63 char *host;64 char port[6];65 } jabber_streamhost_t;66 67 59 struct jabber_data 68 60 { … … 89 81 GHashTable *node_cache; 90 82 GHashTable *buddies; 91 92 GSList *filetransfers;93 GSList *streamhosts;94 int have_streamhosts;95 83 }; 96 84 … … 121 109 struct jabber_away_state *away_state; 122 110 char *away_message; 123 GSList *features;124 111 125 112 time_t last_act; … … 135 122 char *my_full_jid; /* Separate copy because of case sensitivity. */ 136 123 struct jabber_buddy *me; 137 };138 139 struct jabber_transfer140 {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;161 124 }; 162 125 … … 186 149 187 150 /* Some supported extensions/legacy stuff */ 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 */ 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 */ 205 160 206 161 /* iq.c */ … … 212 167 int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name ); 213 168 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 );226 169 227 170 /* message.c */ … … 237 180 char *set_eval_tls( set_t *set, char *value ); 238 181 struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children ); 239 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type , char *err_code);182 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type ); 240 183 void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func ); 241 184 struct xt_node *jabber_cache_get( struct im_connection *ic, char *id ); … … 294 237 void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node ); 295 238 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 );297 239 298 240 #endif -
protocols/jabber/jabber_util.c
r2379566 rde03374 97 97 } 98 98 99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type , char *err_code)99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type ) 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 );115 111 116 112 /* To make the actual error packet, we copy the original packet and … … 295 291 new = g_new( char, len + 1 ); 296 292 for( i = 0; i < len; i ++ ) 297 {298 /* don't normalize the resource */299 if( orig[i] == '/' )300 break;301 293 new[i] = tolower( orig[i] ); 302 }303 for( ; i < len; i ++ )304 new[i] = orig[i];305 294 306 295 new[i] = 0; -
protocols/msn/msn.c
r2379566 rde03374 241 241 } 242 242 243 static void msn_chat_invite( struct groupchat *c, char * who, char *message)243 static void msn_chat_invite( struct groupchat *c, char *msg, char *who ) 244 244 { 245 245 struct msn_switchboard *sb = msn_sb_by_chat( c ); -
protocols/nogaim.h
r2379566 rde03374 43 43 #include "proxy.h" 44 44 #include "md5.h" 45 #include "ft.h"46 45 47 46 #define BUF_LEN MSG_LEN … … 229 228 * - Most protocols will just want to set this to g_strcasecmp().*/ 230 229 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 );234 230 }; 235 231 -
protocols/oscar/aim.h
r2379566 rde03374 94 94 * 95 95 */ 96 #define AIM_DEFAULT_LOGIN_SERVER "login. messaging.aol.com"96 #define AIM_DEFAULT_LOGIN_SERVER "login.oscar.aol.com" 97 97 #define AIM_LOGIN_PORT 5190 98 98 -
protocols/oscar/oscar.c
r2379566 rde03374 341 341 set_t *s; 342 342 343 s = set_add( &acc->set, "server", AIM_DEFAULT_LOGIN_SERVER, set_eval_account, acc );343 s = set_add( &acc->set, "server", NULL, 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])) { 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 { 359 367 ic->flags |= OPT_DOES_HTML; 360 368 } … … 377 385 } 378 386 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 379 398 imcb_log(ic, _("Signon: %s"), ic->acc->user); 380 399 … … 383 402 384 403 conn->status |= AIM_CONN_STATUS_INPROGRESS; 385 conn->fd = proxy_connect(set_getstr(&acc->set, "server"), 386 AIM_LOGIN_PORT, oscar_login_connect, ic); 404 conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic); 387 405 if (conn->fd < 0) { 388 406 imcb_error(ic, _("Couldn't connect to host")); … … 2491 2509 } 2492 2510 2493 void oscar_chat_invite(struct groupchat *c, char * who, char *message)2511 void oscar_chat_invite(struct groupchat *c, char *message, char *who) 2494 2512 { 2495 2513 struct im_connection *ic = c->ic; -
protocols/yahoo/yahoo.c
r2379566 rde03374 306 306 } 307 307 308 static void byahoo_chat_invite( struct groupchat *c, char * who, char *msg)308 static void byahoo_chat_invite( struct groupchat *c, char *msg, char *who ) 309 309 { 310 310 struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data; -
root_commands.c
r2379566 rde03374 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." );239 236 set_setstr( &a->set, "server", cmd[5] ); 240 }241 237 242 238 irc_usermsg( irc, "Account successfully added" ); … … 321 317 else 322 318 { 323 irc_usermsg( irc, "No accounts known. Use `account add' to add one." );319 irc_usermsg( irc, "No accounts known. Use 'account add' to add one." ); 324 320 } 325 321 } … … 407 403 } 408 404 409 if( g_strncasecmp( cmd[2], "-del", 4 ) == 0 ) 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 ) 410 408 set_reset( &a->set, set_name ); 411 409 else … … 747 745 static void cmd_set( irc_t *irc, char **cmd ) 748 746 { 749 char *set_name = cmd[1];747 char *set_name = NULL; 750 748 751 749 if( cmd[1] && cmd[2] ) 752 750 { 753 if( g_strncasecmp( cmd[1], "-del", 4 ) == 0 ) 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 ) 754 757 { 755 758 set_reset( &irc->set, cmd[2] ); … … 759 762 { 760 763 set_setstr( &irc->set, cmd[1], cmd[2] ); 764 set_name = cmd[1]; 761 765 } 762 766 } … … 968 972 irc_usermsg( irc, "Tried to join chat, not sure if this was successful" ); 969 973 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 else1009 {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 }1035 974 } 1036 975 } … … 1056 995 { "qlist", 0, cmd_qlist, 0 }, 1057 996 { "join_chat", 2, cmd_join_chat, 0 }, 1058 { "transfers", 0, cmd_transfers, 0 },1059 997 { NULL } 1060 998 }; -
tests/check_nick.c
r2379566 rde03374 15 15 "thisisave:ryveryveryverylongnick", 16 16 "t::::est", 17 "test123",18 "123test",19 "123",20 17 NULL }; 21 18 const char *expected[] = { "test", "test", "test", … … 23 20 "thisisaveryveryveryveryl", 24 21 "test", 25 "test123",26 "_123test",27 "_123",28 22 NULL }; 29 23 … … 41 35 START_TEST(test_nick_ok_ok) 42 36 { 43 const char *nicks[] = { "foo", "bar 123", "bla[", "blie]", "BreEZaH",44 "\\od^~", "_123", "_123test", NULL };37 const char *nicks[] = { "foo", "bar", "bla[", "blie]", 38 "BreEZaH", "\\od^~", NULL }; 45 39 int i; 46 40 … … 55 49 { 56 50 const char *nicks[] = { "thisisaveryveryveryveryveryveryverylongnick", 57 "\nillegalchar", "", "nick%", "123test",NULL };51 "\nillegalchar", "", "nick%", NULL }; 58 52 int i; 59 53
Note: See TracChangeset
for help on using the changeset viewer.