From e1cb541170fa86e09c7c0d89e0de2a14120efa4c Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Fri, 4 Apr 2008 00:30:42 +0000 Subject: [PATCH] get_header_keyvalue function with short name alternative git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@838 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmUtils.cpp | 9 +++++++++ core/AmUtils.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/core/AmUtils.cpp b/core/AmUtils.cpp index b4523e95..809b05cb 100644 --- a/core/AmUtils.cpp +++ b/core/AmUtils.cpp @@ -768,6 +768,15 @@ string get_header_param(const string& hdr_string, return ""; } +/** get the value of key @param short_name or @param name or from the list param_hdr*/ +string get_header_keyvalue(const string& param_hdr, const string& short_name, const string& name) { + string res = get_header_keyvalue(param_hdr, short_name); + if (res.length()) + return res; + + return get_header_keyvalue(param_hdr, name); +} + /** * get value from parameter header with the name @param name * while skipping escaped values diff --git a/core/AmUtils.h b/core/AmUtils.h index e6cd0931..46e5c5e7 100644 --- a/core/AmUtils.h +++ b/core/AmUtils.h @@ -269,6 +269,9 @@ string get_header_param(const string& hdr_string, const string& param_name); /** get the value of key @param name from the list param_hdr*/ string get_header_keyvalue(const string& param_hdr, const string& name); +/** get the value of key @param short_name or @param name or from the list param_hdr*/ +string get_header_keyvalue(const string& param_hdr, const string& short_name, const string& name); + /** get the value of key @param name from P-Iptel-Param header in hdrs */ string get_session_param(const string& hdrs, const string& name);