~ubuntu-branches/ubuntu/natty/centerim/natty

« back to all changes in this revision

Viewing changes to libjabber/jabber.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2009-03-26 19:51:53 UTC
  • mfrom: (1.1.5 upstream) (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090326195153-dxo63t1lwbp2m592
Tags: 4.22.7-1ubuntu1
* Merge from debian unstable, Ubuntu remaining changes:
  - Packages that Depend/Recommend/Suggest firefox (metapackage) must
    must alternatively Depend/Recommend/Suggest abrowser.
* Bugfix-only release, fixed bugs: LP: #146308 and LP: #186381.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#include <ctype.h>
38
38
#include <time.h>
39
39
 
 
40
#ifdef HAVE_UNAME
 
41
#include <sys/utsname.h> //uname function
 
42
#endif
 
43
 
 
44
#ifdef HAVE_THREAD
 
45
#include <pthread.h>
 
46
#endif
 
47
 
40
48
#include "libxode.h"
41
49
#include "connwrap.h"
42
50
 
47
55
extern "C" {
48
56
#endif
49
57
 
 
58
//buffer for file-transfer
 
59
#define SEND_BUF 2048
50
60
/* --------------------------------------------------------- */
51
61
/*                                                           */
52
62
/* JID structures & constants                                */
65
75
    char*              full;
66
76
    struct jid_struct *next; /* for lists of jids */
67
77
} *jid;
 
78
 
 
79
struct send_file
 
80
{               
 
81
        char *full_jid_name;
 
82
        char *id;
 
83
#ifdef HAVE_THREAD
 
84
        pthread_t thread;
 
85
#endif
 
86
        int transfer_type;
 
87
        char *host;
 
88
        char *url;
 
89
        char *sid_from_to;
 
90
        int port;
 
91
};
68
92
  
 
93
struct pargs_r {
 
94
        int sock;
 
95
        int fd_file;
 
96
        char *hash;
 
97
        long int size;
 
98
        void *rfile;
 
99
        char *url;
 
100
        void (*callback)(void *, long int, long int, int, int);
 
101
};
 
102
 
69
103
jid     jid_new(pool p, char *idstr);          /* Creates a jabber id from the idstr */
70
104
 
71
105
void    jid_set(jid id, char *str, int item);  /* Individually sets jid components */
210
244
#define NS_AGENT     "jabber:iq:agent"
211
245
#define NS_AGENTS    "jabber:iq:agents"
212
246
#define NS_DELAY     "jabber:x:delay"
 
247
#define NS_DATA      "jabber:x:data"
213
248
#define NS_VERSION   "jabber:iq:version"
214
249
#define NS_TIME      "jabber:iq:time"
215
250
#define NS_VCARD     "vcard-temp"
 
251
#define NS_VCARDUP   "vcard-temp:x:update"
216
252
#define NS_PRIVATE   "jabber:iq:private"
217
253
#define NS_SEARCH    "jabber:iq:search"
218
254
#define NS_OOB       "jabber:iq:oob"
220
256
#define NS_ADMIN     "jabber:iq:admin"
221
257
#define NS_FILTER    "jabber:iq:filter"
222
258
#define NS_AUTH_0K   "jabber:iq:auth:0k"
 
259
#define NS_RECEIPTS  "urn:xmpp:receipts"
223
260
#define NS_DISCOINFO "http://jabber.org/protocol/disco#info"
224
261
#define NS_DISCOITEMS "http://jabber.org/protocol/disco#items"
 
262
#define NS_BYTESTREAMS "http://jabber.org/protocol/bytestreams"
 
263
#define NS_SI "http://jabber.org/protocol/si"
 
264
#define NS_SIFILE "http://jabber.org/protocol/si/profile/file-transfer"
 
265
#define NS_NEG "http://jabber.org/protocol/feature-neg" 
225
266
 
226
267
/* --------------------------------------------------------- */
227
268
/*                                                           */
242
283
/* --------------------------------------------------------- */
243
284
xmlnode jutil_presnew(int type, char *to, char *status); /* Create a skeleton presence packet */
244
285
xmlnode jutil_iqnew(int type, char *ns);                 /* Create a skeleton iq packet */
 
286
xmlnode jutil_iqnew2(int type);                 /* Create a skeleton iq packet w/o query tag*/
245
287
xmlnode jutil_msgnew(char *type, char *to, char *subj, char *body);
246
288
                                                         /* Create a skeleton message packet */
 
289
xmlnode jutil_receiptnew(const char *to, const char *id);/* Create a skeleton message receipt packet */
247
290
xmlnode jutil_header(char* xmlns, char* server);         /* Create a skeleton stream packet */
248
291
int     jutil_priority(xmlnode x);                       /* Determine priority of this packet */
249
292
void    jutil_tofrom(xmlnode x);                         /* Swaps to/from fields on a packet */
316
359
 
317
360
char *jab_auth(jconn j);
318
361
char *jab_reg(jconn j);
 
362
void jabber_send_file(jconn j, const char *filename, long int size, struct send_file *file, void *rfile, void (*function)(void *file, long int bytes, long int size, int status, int conn_type), int start_port, int end_port); //returning ip address and port after binding
 
363
void *jabber_send_file_fd(void *arg);
 
364
void *jabber_recieve_file_fd(void *arg);
 
365
void *jabber_recieve_file_fd_http(void *arg);
 
366
void jabber_get_file(jconn j, const char *filename, long int size, struct send_file *file, void *rfile, void (*function)(void *file, long int bytes, long int size, int status, int conn_type) ); //returning ip address and port after binding
 
367
int next_random( int start_port, int end_port ); //generate random number between two digits
319
368
 
320
369
#ifdef __cplusplus
321
370
}