[rygel] core: Cleaner XBoxHacks construction API
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Cleaner XBoxHacks construction API
- Date: Thu, 1 Apr 2010 22:55:30 +0000 (UTC)
commit 444264063b578b473fbb624d11baffd9fe0b74a5
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Mar 24 18:31:05 2010 +0200
core: Cleaner XBoxHacks construction API
Now XBoxHacks is created specifically for an action and errors out if
action's user-agent isn't XBox.
src/rygel/rygel-browse.vala | 2 +-
src/rygel/rygel-search.vala | 2 +-
src/rygel/rygel-xbox-hacks.vala | 6 ++++--
3 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/rygel/rygel-browse.vala b/src/rygel/rygel-browse.vala
index 4e942a1..b47e135 100644
--- a/src/rygel/rygel-browse.vala
+++ b/src/rygel/rygel-browse.vala
@@ -66,7 +66,7 @@ internal class Rygel.Browse: GLib.Object, Rygel.StateMachine {
this.didl_writer = new Rygel.DIDLLiteWriter (content_dir.http_server);
try {
- this.xbox_hacks = new XBoxHacks (action.get_message ());
+ this.xbox_hacks = new XBoxHacks.for_action (this.action);
} catch { /* This just means we are not dealing with Xbox, yay! */ }
}
diff --git a/src/rygel/rygel-search.vala b/src/rygel/rygel-search.vala
index 333f6ab..272688a 100644
--- a/src/rygel/rygel-search.vala
+++ b/src/rygel/rygel-search.vala
@@ -60,7 +60,7 @@ internal class Rygel.Search: GLib.Object, Rygel.StateMachine {
this.didl_writer = new Rygel.DIDLLiteWriter (content_dir.http_server);
try {
- this.xbox_hacks = new XBoxHacks (action.get_message ());
+ this.xbox_hacks = new XBoxHacks.for_action (this.action);
} catch { /* This just means we are not dealing with Xbox, yay! */ }
}
diff --git a/src/rygel/rygel-xbox-hacks.vala b/src/rygel/rygel-xbox-hacks.vala
index 0662ed1..6fe1750 100644
--- a/src/rygel/rygel-xbox-hacks.vala
+++ b/src/rygel/rygel-xbox-hacks.vala
@@ -22,14 +22,16 @@
*/
using Soup;
+using GUPnP;
internal errordomain Rygel.XBoxHacksError {
NA
}
internal class Rygel.XBoxHacks : GLib.Object {
- public XBoxHacks (Message msg) throws XBoxHacksError {
- if (!msg.request_headers.get ("User-Agent").contains ("XBox")) {
+ public XBoxHacks.for_action (ServiceAction action) throws XBoxHacksError {
+ var agent = action.get_message ().request_headers.get ("User-Agent");
+ if (!agent.contains ("XBox")) {
throw new XBoxHacksError.NA ("Not Applicable");
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]