bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / update / check / updateprotocoltest.cxx
blob803c3efe75d76a74396a9bca35b8cd0ba5e24ea5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <cppuhelper/bootstrap.hxx>
23 #include "updateprotocol.hxx"
24 #include <com/sun/star/ucb/UniversalContentBroker.hpp>
26 #include <sal/main.h>
27 #include <osl/process.h>
28 #include <stdio.h>
29 #include "sal/log.hxx"
31 namespace task = ::com::sun::star::task;
32 namespace uno = ::com::sun::star::uno;
36 SAL_IMPLEMENT_MAIN()
38 (void) argv;
39 (void) argc;
41 if( osl_getCommandArgCount() != 0 )
43 fprintf(stderr, "Usage: updateprotocoltest\n");
44 return -1;
47 // create the initial component context
48 uno::Reference< uno::XComponentContext > rComponentContext = cppu::defaultBootstrap_InitialComponentContext();
50 // initialize UCB (for backwards compatibility, in case some code still uses
51 // plain createInstance w/o args directly to obtain an instance):
52 com::sun::star::ucb::UniversalContentBroker::create(rComponentContext);
55 OUString aURL;
56 OUString aVersion;
58 try
60 if( checkForUpdates(rComponentContext, uno::Reference< task::XInteractionHandler > (), aURL, aVersion) )
62 SAL_INFO("extensions.update", "Update found: " << aVersion << " on " << aURL);
64 else
66 SAL_INFO("extensions.update", "no updates found" );
69 catch( ... )
71 SAL_INFO("extensions.update", "unhandled exception caught" );
74 return 0;
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */