Changes in / [08135df:aaf92a9]
- Files:
-
- 5 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r08135df raaf92a9 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 -
conf.c
r08135df raaf92a9 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
r08135df raaf92a9 50 50 int ping_timeout; 51 51 char *user; 52 size_t max_filetransfer_size;53 52 } conf_t; 54 53 -
doc/user-guide/commands.xml
r08135df raaf92a9 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> -
irc.c
r08135df raaf92a9 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
r08135df raaf92a9 84 84 struct query *queries; 85 85 struct account *accounts; 86 GSList *file_transfers;87 86 88 87 struct __USER *users; -
protocols/jabber/Makefile
r08135df raaf92a9 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/iq.c
r08135df raaf92a9 87 87 XMLNS_CHATSTATES, 88 88 XMLNS_MUC, 89 XMLNS_SI,90 XMLNS_BYTESTREAMS,91 XMLNS_FILETRANSFER,92 89 NULL }; 93 90 const char **f; … … 109 106 { 110 107 xt_free_node( reply ); 111 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" , NULL);108 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" ); 112 109 pack = 0; 113 110 } … … 115 112 else if( strcmp( type, "set" ) == 0 ) 116 113 { 117 if( ( c = xt_find_node( node->children, "si" ) ) && 118 ( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_SI ) == 0 ) ) 119 { 120 return jabber_si_handle_request( ic, node, c ); 121 } else if( !( c = xt_find_node( node->children, "query" ) ) || 114 if( !( c = xt_find_node( node->children, "query" ) ) || 122 115 !( s = xt_find_attr( c, "xmlns" ) ) ) 123 116 { 124 117 imcb_log( ic, "WARNING: Received incomplete IQ-%s packet", type ); 125 118 return XT_HANDLED; 126 } else if( strcmp( s, XMLNS_ROSTER ) == 0 )127 {119 } 120 128 121 /* This is a roster push. XMPP servers send this when someone 129 122 was added to (or removed from) the buddy list. AFAIK they're 130 123 sent even if we added this buddy in our own session. */ 124 if( strcmp( s, XMLNS_ROSTER ) == 0 ) 125 { 131 126 int bare_len = strlen( ic->acc->user ); 132 127 … … 145 140 146 141 xt_free_node( reply ); 147 reply = jabber_make_error_packet( node, "not-allowed", "cancel" , NULL);142 reply = jabber_make_error_packet( node, "not-allowed", "cancel" ); 148 143 pack = 0; 149 144 } 150 } else if( strcmp( s, XMLNS_BYTESTREAMS ) == 0 ) 151 { 152 /* Bytestream Request (stage 2 of file transfer) */ 153 return jabber_bs_recv_request( ic, node, c ); 154 } else 145 } 146 else 155 147 { 156 148 xt_free_node( reply ); 157 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" , NULL);149 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" ); 158 150 pack = 0; 159 151 } -
protocols/jabber/jabber.c
r08135df raaf92a9 500 500 ret->send_typing = jabber_send_typing; 501 501 ret->handle_cmp = g_strcasecmp; 502 ret->transfer_request = jabber_si_transfer_request;503 502 504 503 register_protocol( ret ); -
protocols/jabber/jabber.h
r08135df raaf92a9 81 81 GHashTable *node_cache; 82 82 GHashTable *buddies; 83 84 GSList *filetransfers;85 83 }; 86 84 … … 124 122 char *my_full_jid; /* Separate copy because of case sensitivity. */ 125 123 struct jabber_buddy *me; 126 };127 128 struct jabber_transfer129 {130 /* bitlbee's handle for this transfer */131 file_transfer_t *ft;132 133 /* the stream's private handle */134 gpointer streamhandle;135 136 struct im_connection *ic;137 138 int watch_in;139 int watch_out;140 141 char *ini_jid;142 char *tgt_jid;143 char *iq_id;144 char *sid;145 int accepted;146 147 size_t bytesread, byteswritten;148 int fd;149 struct sockaddr_storage saddr;150 124 }; 151 125 … … 175 149 176 150 /* Some supported extensions/legacy stuff */ 177 #define XMLNS_AUTH "jabber:iq:auth" /* XEP-0078 */ 178 #define XMLNS_VERSION "jabber:iq:version" /* XEP-0092 */ 179 #define XMLNS_TIME "jabber:iq:time" /* XEP-0090 */ 180 #define XMLNS_VCARD "vcard-temp" /* XEP-0054 */ 181 #define XMLNS_DELAY "jabber:x:delay" /* XEP-0091 */ 182 #define XMLNS_XDATA "jabber:x:data" /* XEP-0004 */ 183 #define XMLNS_CHATSTATES "http://jabber.org/protocol/chatstates" /* XEP-0085 */ 184 #define XMLNS_DISCOVER "http://jabber.org/protocol/disco#info" /* XEP-0030 */ 185 #define XMLNS_MUC "http://jabber.org/protocol/muc" /* XEP-0045 */ 186 #define XMLNS_MUC_USER "http://jabber.org/protocol/muc#user" /* XEP-0045 */ 187 #define XMLNS_FEATURE "http://jabber.org/protocol/feature-neg" /* XEP-0020 */ 188 #define XMLNS_SI "http://jabber.org/protocol/si" /* XEP-0095 */ 189 #define XMLNS_FILETRANSFER "http://jabber.org/protocol/si/profile/file-transfer" /* XEP-0096 */ 190 #define XMLNS_BYTESTREAMS "http://jabber.org/protocol/bytestreams" /* XEP-0065 */ 191 #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 */ 192 160 193 161 /* iq.c */ … … 200 168 int jabber_remove_from_roster( struct im_connection *ic, char *handle ); 201 169 202 /* si.c */203 int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, struct xt_node *sinode );204 void jabber_si_transfer_request( struct im_connection *ic, file_transfer_t *ft, char *who );205 void jabber_si_free_transfer( file_transfer_t *ft);206 207 /* s5bytestream.c */208 int jabber_bs_recv_request( struct im_connection *ic, struct xt_node *node, struct xt_node *qnode);209 gboolean jabber_bs_send_start( struct jabber_transfer *tf );210 gboolean jabber_bs_send_write( file_transfer_t *ft, char *buffer, unsigned int len );211 212 170 /* message.c */ 213 171 xt_status jabber_pkt_message( struct xt_node *node, gpointer data ); … … 222 180 char *set_eval_tls( set_t *set, char *value ); 223 181 struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children ); 224 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 ); 225 183 void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func ); 226 184 struct xt_node *jabber_cache_get( struct im_connection *ic, char *id ); -
protocols/jabber/jabber_util.c
r08135df raaf92a9 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/nogaim.h
r08135df raaf92a9 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 -
root_commands.c
r08135df raaf92a9 972 972 irc_usermsg( irc, "Tried to join chat, not sure if this was successful" ); 973 973 g_free( channel ); 974 }975 }976 977 static void cmd_transfers( irc_t *irc, char **cmd )978 {979 GSList *files = irc->file_transfers;980 enum { LIST, REJECT, CANCEL };981 int subcmd = LIST;982 int fid;983 984 if( !files )985 {986 irc_usermsg( irc, "No pending transfers" );987 return;988 }989 990 if( cmd[1] &&991 ( strcmp( cmd[1], "reject" ) == 0 ) )992 {993 subcmd = REJECT;994 }995 else if( cmd[1] &&996 ( strcmp( cmd[1], "cancel" ) == 0 ) &&997 cmd[2] &&998 ( fid = atoi( cmd[2] ) ) )999 {1000 subcmd = CANCEL;1001 }1002 1003 for( ; files; files = g_slist_next( files ) )1004 {1005 file_transfer_t *file = files->data;1006 1007 switch( subcmd ) {1008 case LIST:1009 if ( file->status == FT_STATUS_LISTENING )1010 irc_usermsg( irc,1011 "Pending file(id %d): %s (Listening...)", file->local_id, file->file_name);1012 else1013 {1014 int kb_per_s = 0;1015 time_t diff = time( NULL ) - file->started;1016 if ( ( file->started > 0 ) && ( file->bytes_transferred > 0 ) )1017 kb_per_s = file->bytes_transferred / 1024 / diff;1018 1019 irc_usermsg( irc,1020 "Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name,1021 file->bytes_transferred/1024, file->file_size/1024, kb_per_s);1022 }1023 break;1024 case REJECT:1025 if( file->status == FT_STATUS_LISTENING )1026 {1027 irc_usermsg( irc, "Rejecting file transfer for %s", file->file_name );1028 imcb_file_canceled( file, "Denied by user" );1029 }1030 break;1031 case CANCEL:1032 if( file->local_id == fid )1033 {1034 irc_usermsg( irc, "Canceling file transfer for %s", file->file_name );1035 imcb_file_canceled( file, "Canceled by user" );1036 }1037 break;1038 }1039 974 } 1040 975 } … … 1060 995 { "qlist", 0, cmd_qlist, 0 }, 1061 996 { "join_chat", 2, cmd_join_chat, 0 }, 1062 { "transfers", 0, cmd_transfers, 0 },1063 997 { NULL } 1064 998 };
Note: See TracChangeset
for help on using the changeset viewer.