[Opalvoip-svn] SF.net SVN: opalvoip:[23721] opal/trunk/samples/testpresent/main.cxx
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2009-10-28 11:47:33
|
Revision: 23721 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=23721&view=rev Author: rjongbloed Date: 2009-10-28 11:47:24 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Added deny/deny-politely to authorisation command. Modified Paths: -------------- opal/trunk/samples/testpresent/main.cxx Modified: opal/trunk/samples/testpresent/main.cxx =================================================================== --- opal/trunk/samples/testpresent/main.cxx 2009-10-28 11:42:15 UTC (rev 23720) +++ opal/trunk/samples/testpresent/main.cxx 2009-10-28 11:47:24 UTC (rev 23721) @@ -217,7 +217,7 @@ "<url-watcher> <url-watched>"); cli.SetCommand("authorise", PCREATE_NOTIFIER(CmdPresenceAuthorisation), "Authorise a presentity to see local presence.", - "<url-watched> <url-watcher>"); + "<url-watched> <url-watcher> [ deny | deny-politely ]"); cli.SetCommand("publish", PCREATE_NOTIFIER(CmdSetLocalPresence), "Publish local presence state for presentity.", "<url> { available | unavailable | busy } [ <note> ]"); @@ -254,19 +254,31 @@ void TestPresEnt::CmdPresenceAuthorisation(PCLI::Arguments & args, INT) { + OpalPresentity::Authorisation auth = OpalPresentity::AuthorisationPermitted; + if (args.GetCount() > 2) { + if (args[2] *= "deny") + auth = OpalPresentity::AuthorisationDenied; + else if (args[2] *= "deny-politely") + auth = OpalPresentity::AuthorisationDeniedPolitely; + else { + args.WriteUsage(); + return; + } + } + if (args.GetCount() < 2) args.WriteUsage(); else if (!m_presentities.Contains(args[0])) args.WriteError() << "Presentity \"" << args[0] << "\" does not exist." << endl; else - m_presentities[args[0]].SetPresenceAuthorisation(args[1], OpalPresentity::AuthorisationPermitted); + m_presentities[args[0]].SetPresenceAuthorisation(args[1], auth); } void TestPresEnt::CmdSetLocalPresence(PCLI::Arguments & args, INT) { PString note; - if (args.GetCount > 2) + if (args.GetCount() > 2) note = args[2]; if (args.GetCount() < 2) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |