summaryrefslogtreecommitdiffstats
path: root/kioslave/http/kcookiejar/kcookieserver.h
blob: 0c36f10b19bd2217c0295e2c1e3733076420e65b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
    This file is part of the KDE File Manager

    Copyright (C) 1998 Waldo Bastian (bastian@kde.org)

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    version 2 as published by the Free Software Foundation.

    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this library; see the file COPYING. If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/
//----------------------------------------------------------------------------
//
// KDE Cookie Server
// $Id$

#ifndef KCOOKIESERVER_H
#define KCOOKIESERVER_H

#include <tqstringlist.h>
#include <kded/kdedmodule.h>

class KHttpCookieList;
class KCookieJar;
class KHttpCookie;
class TQTimer;
class RequestList;
class DCOPClient;
class KConfig;

class KCookieServer : public KDEDModule
{
  Q_OBJECT
  K_DCOP
public:
  KCookieServer(const TQCString &);
  ~KCookieServer();

k_dcop:
  TQString findCookies(TQString);
  TQString findCookies(TQString, long);
  TQStringList findDomains();
  TQStringList findCookies(TQValueList<int>,TQString,TQString,TQString,TQString);
  TQString findDOMCookies(TQString);
  TQString findDOMCookies(TQString, long);
  void addCookies(TQString, TQCString, long);
  void deleteCookie(TQString, TQString, TQString, TQString);
  void deleteCookiesFromDomain(TQString);
  void deleteSessionCookies(long);
  void deleteSessionCookiesFor(TQString, long);
  void deleteAllCookies();
  void addDOMCookies(TQString, TQCString, long);
  /**
   * Sets the cookie policy for the domain associated with the specified URL.
   */
  void setDomainAdvice(TQString url, TQString advice);
  /** 
   * Returns the cookie policy in effect for the specified URL.
   */
  TQString getDomainAdvice(TQString url);
  void reloadPolicy();
  void shutdown();

public:
  bool cookiesPending(const TQString &url, KHttpCookieList *cookieList=0);
  void addCookies(const TQString &url, const TQCString &cookieHeader,
                  long windowId, bool useDOMFormat);
  void checkCookies(KHttpCookieList *cookieList);

public slots:
  void slotSave();
  void slotDeleteSessionCookies(long);

protected:
  KCookieJar *mCookieJar;
  KHttpCookieList *mPendingCookies;
  RequestList *mRequestList;
  TQTimer *mTimer;
  bool mAdvicePending;
  DCOPClient *mOldCookieServer;
  KConfig *mConfig;

private:
  virtual int newInstance(TQValueList<TQCString>) { return 0; }
  bool cookieMatches(KHttpCookie*, TQString, TQString, TQString, TQString);
  void putCookie(TQStringList&, KHttpCookie*, const TQValueList<int>&);
  void saveCookieJar();
};

#endif