24 #include <dcopclient.h>
25 #include <tdecmdlineargs.h>
26 #include <tdelocale.h>
27 #include <tdeapplication.h>
29 static const char description[] =
30 I18N_NOOP(
"HTTP Cookie Daemon");
32 static const char version[] =
"1.0";
34 static const TDECmdLineOptions options[] =
36 {
"shutdown", I18N_NOOP(
"Shut down cookie jar"), 0 },
37 {
"remove <domain>", I18N_NOOP(
"Remove cookies for domain"), 0 },
38 {
"remove-all", I18N_NOOP(
"Remove all cookies"), 0 },
39 {
"reload-config", I18N_NOOP(
"Reload configuration file"), 0 },
43 extern "C" TDE_EXPORT
int kdemain(
int argc,
char *argv[])
45 TDELocale::setMainCatalogue(
"tdelibs");
46 TDECmdLineArgs::init(argc, argv,
"kcookiejar", I18N_NOOP(
"HTTP cookie daemon"),
47 description, version);
49 TDECmdLineArgs::addCmdLineOptions( options );
51 TDEInstance a(
"kcookiejar");
53 kapp->dcopClient()->attach();
55 TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
57 TQByteArray replyData;
58 if (args->isSet(
"remove-all"))
60 kapp->dcopClient()->call(
"kded",
"kcookiejar",
"deleteAllCookies()", TQByteArray(), replyType, replyData);
62 if (args->isSet(
"remove"))
64 TQString domain = args->getOption(
"remove");
66 TQDataStream stream(params, IO_WriteOnly);
68 kapp->dcopClient()->call(
"kded",
"kcookiejar",
"deleteCookiesFromDomain(TQString)", params, replyType, replyData);
70 if (args->isSet(
"shutdown"))
72 TQCString module =
"kcookiejar";
74 TQDataStream stream(params, IO_WriteOnly);
76 kapp->dcopClient()->call(
"kded",
"kded",
"unloadModule(TQCString)", params, replyType, replyData);
78 else if(args->isSet(
"reload-config"))
80 kapp->dcopClient()->call(
"kded",
"kcookiejar",
"reloadPolicy()", TQByteArray(), replyType, replyData);
84 TQCString module =
"kcookiejar";
86 TQDataStream stream(params, IO_WriteOnly);
88 kapp->dcopClient()->call(
"kded",
"kded",
"loadModule(TQCString)", params, replyType, replyData);