~ubuntu-branches/ubuntu/breezy/evolution-data-server/breezy

« back to all changes in this revision

Viewing changes to camel/camel-url.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-10-10 11:30:56 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051010113056-rb4vj4kbs8yxft85
Tags: 1.4.1-0ubuntu3
* debian/patches/camel-imap-store.c.patch:
  - Ubuntu 17465: apply patch from
  http://bugzilla.gnome.org/attachment.cgi?id=53234&action=view
  (additional NULL pointer check)

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 * Copyright 1999-2001 Ximian, Inc. (www.ximian.com)
10
10
 *
11
11
 * This program is free software; you can redistribute it and/or 
12
 
 * modify it under the terms of version 2 of the GNU General Public 
 
12
 * modify it under the terms of version 2 of the GNU Lesser General Public 
13
13
 * License as published by the Free Software Foundation.
14
14
 *
15
15
 * This program is distributed in the hope that it will be useful,
16
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
 * GNU General Public License for more details.
 
18
 * GNU Lesser General Public License for more details.
19
19
 *
20
 
 * You should have received a copy of the GNU General Public License
 
20
 * You should have received a copy of the GNU Lesser General Public License
21
21
 * along with this program; if not, write to the Free Software
22
22
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23
23
 * USA
51
51
 *
52
52
 * Parses @url_string relative to @base.
53
53
 *
54
 
 * Return value: a parsed CamelURL.
 
54
 * Returns a parsed #CamelURL
55
55
 **/
56
56
CamelURL *
57
57
camel_url_new_with_base (CamelURL *base, const char *url_string)
275
275
 
276
276
/**
277
277
 * camel_url_new:
278
 
 * @url_string: a URL
279
 
 * @ex: a CamelException
 
278
 * @url_string: a URL string
 
279
 * @ex: a #CamelException
280
280
 *
281
281
 * Parses an absolute URL.
282
282
 *
283
 
 * Return value: a CamelURL, or %NULL.
 
283
 * Returns a #CamelURL if it can be parsed, or %NULL otherwise
284
284
 **/
285
285
CamelURL *
286
286
camel_url_new (const char *url_string, CamelException *ex)
299
299
 
300
300
/**
301
301
 * camel_url_to_string:
302
 
 * @url: a CamelURL
303
 
 * @flags: additional translation options.
304
 
 *
305
 
 * Return value: a string representing @url, which the caller must free.
 
302
 * @url: a #CamelURL
 
303
 * @flags: additional translation options
 
304
 *
 
305
 * Flatten a #CamelURL into a string.
 
306
 *
 
307
 * Returns a string representing @url, which the caller must free
306
308
 **/
307
309
char *
308
310
camel_url_to_string (CamelURL *url, guint32 flags)
374
376
 
375
377
/**
376
378
 * camel_url_free:
377
 
 * @url: a CamelURL
 
379
 * @url: a #CamelURL
378
380
 *
379
 
 * Frees @url
 
381
 * Frees @url.
380
382
 **/
381
383
void
382
384
camel_url_free (CamelURL *url)
411
413
        url->part = g_strdup (part);                    \
412
414
}
413
415
 
 
416
 
 
417
/**
 
418
 * camel_url_set_protocol:
 
419
 * @url: a #CamelURL
 
420
 * @protocol: protocol schema
 
421
 *
 
422
 * Set the protocol of a #CamelURL.
 
423
 **/
414
424
DEFINE_CAMEL_URL_SET (protocol)
 
425
 
 
426
 
 
427
/**
 
428
 * camel_url_set_user:
 
429
 * @url: a #CamelURL
 
430
 * @user: username
 
431
 *
 
432
 * Set the user of a #CamelURL.
 
433
 **/
415
434
DEFINE_CAMEL_URL_SET (user)
 
435
 
 
436
 
 
437
/**
 
438
 * camel_url_set_authmech:
 
439
 * @url: a #CamelURL
 
440
 * @authmech: authentication mechanism
 
441
 *
 
442
 * Set the authmech of a #CamelURL.
 
443
 **/
416
444
DEFINE_CAMEL_URL_SET (authmech)
 
445
 
 
446
 
 
447
/**
 
448
 * camel_url_set_passwd:
 
449
 * @url: a #CamelURL
 
450
 * @passwd: password
 
451
 *
 
452
 * Set the password of a #CamelURL.
 
453
 **/
417
454
DEFINE_CAMEL_URL_SET (passwd)
 
455
 
 
456
 
 
457
/**
 
458
 * camel_url_set_host:
 
459
 * @url: a #CamelURL
 
460
 * @host: hostname
 
461
 *
 
462
 * Set the hostname of a #CamelURL.
 
463
 **/
418
464
DEFINE_CAMEL_URL_SET (host)
 
465
 
 
466
 
 
467
/**
 
468
 * camel_url_set_path:
 
469
 * @url: a #CamelURL
 
470
 * @path: path
 
471
 *
 
472
 * Set the path component of a #CamelURL.
 
473
 **/
419
474
DEFINE_CAMEL_URL_SET (path)
 
475
 
 
476
 
 
477
/**
 
478
 * camel_url_set_query:
 
479
 * @url: a #CamelURL
 
480
 * @query: url query
 
481
 *
 
482
 * Set the query of a #CamelURL.
 
483
 **/
420
484
DEFINE_CAMEL_URL_SET (query)
 
485
 
 
486
 
 
487
/**
 
488
 * camel_url_set_fragment:
 
489
 * @url: a #CamelURL
 
490
 * @fragment: url fragment
 
491
 *
 
492
 * Set the fragment of a #CamelURL.
 
493
 **/
421
494
DEFINE_CAMEL_URL_SET (fragment)
422
495
 
 
496
 
 
497
/**
 
498
 * camel_url_set_port:
 
499
 * @url: a #CamelURL
 
500
 * @port: port
 
501
 *
 
502
 * Set the port on a #CamelURL.
 
503
 **/
423
504
void
424
505
camel_url_set_port (CamelURL *url, int port)
425
506
{
426
507
        url->port = port;
427
508
}
428
509
 
 
510
 
 
511
/**
 
512
 * camel_url_set_param:
 
513
 * @url: a #CamelURL
 
514
 * @name: name of the param to set
 
515
 * @value: value of the param to set
 
516
 *
 
517
 * Set a param on the #CamelURL.
 
518
 **/
429
519
void
430
520
camel_url_set_param (CamelURL *url, const char *name, const char *value)
431
521
{
435
525
                g_datalist_remove_data(&url->params, name);
436
526
}
437
527
 
 
528
 
 
529
/**
 
530
 * camel_url_get_param:
 
531
 * @a #CamelURL
 
532
 * @name: name of the param
 
533
 *
 
534
 * Get the value of the specified param on the URL.
 
535
 *
 
536
 * Returns the value of a param if found or %NULL otherwise
 
537
 **/
438
538
const char *
439
539
camel_url_get_param (CamelURL *url, const char *name)
440
540
{
483
583
 *
484
584
 * This %-encodes the given URL part and returns the escaped version
485
585
 * in allocated memory, which the caller must free when it is done.
 
586
 *
 
587
 * Returns the encoded string
486
588
 **/
487
589
char *
488
590
camel_url_encode (const char *part, const char *escape_extra)
573
675
                && u1->port == u2->port;
574
676
}
575
677
 
 
678
 
 
679
/**
 
680
 * camel_url_copy:
 
681
 * @in: a #CamelURL to copy
 
682
 *
 
683
 * Copy a #CamelURL.
 
684
 *
 
685
 * Returns a duplicate copy of @in
 
686
 **/
576
687
CamelURL *
577
688
camel_url_copy(const CamelURL *in)
578
689
{