reSIProcate/DialogUsageManager  9694
SubscriptionCreator.cxx
Go to the documentation of this file.
00001 #include "SubscriptionCreator.hxx"
00002 #include "DialogUsageManager.hxx"
00003 
00004 using namespace resip;
00005 
00006 SubscriptionCreator::SubscriptionCreator(DialogUsageManager& dum, 
00007                                          const NameAddr& target, 
00008                                          SharedPtr<UserProfile> userProfile, 
00009                                          const Data& event, 
00010                                          UInt32 subscriptionTime)
00011    : BaseCreator(dum, userProfile),
00012      mRefreshInterval(-1)
00013 {
00014    makeInitialRequest(target, SUBSCRIBE);
00015 
00016    mLastRequest->header(h_Event).value() = event; 
00017    mLastRequest->header(h_Expires).value() = subscriptionTime;
00018 }
00019 
00020 SubscriptionCreator::SubscriptionCreator(DialogUsageManager& dum, 
00021                                          const NameAddr& target, 
00022                                          SharedPtr<UserProfile> userProfile, 
00023                                          const Data& event, 
00024                                          UInt32 subscriptionTime, 
00025                                          int refreshInterval)
00026    : BaseCreator(dum, userProfile),
00027      mRefreshInterval(refreshInterval)
00028 {
00029    makeInitialRequest(target, SUBSCRIBE);
00030 
00031    mLastRequest->header(h_Event).value() = event; 
00032    mLastRequest->header(h_Expires).value() = subscriptionTime;
00033 }
00034 
00035 SubscriptionCreator::SubscriptionCreator(DialogUsageManager& dum,
00036                                          const NameAddr& target,
00037                                          SharedPtr<UserProfile> userProfile,
00038                                          const H_ReferTo::Type& referTo)
00039    : BaseCreator(dum, userProfile),
00040      mRefreshInterval(-1)
00041 {
00042    makeInitialRequest(target, REFER);
00043    mLastRequest->header(h_ReferTo) = referTo;
00044    mLastRequest->header(h_Event).value() = "refer";
00045 }
00046 
00047 bool 
00048 SubscriptionCreator::hasRefreshInterval() const
00049 {
00050    return mRefreshInterval > 0;   
00051 }
00052 
00053 int 
00054 SubscriptionCreator::getRefreshInterval() const
00055 {
00056    return mRefreshInterval;
00057 }
00058 
00059 
00060 /* ====================================================================
00061  * The Vovida Software License, Version 1.0 
00062  * 
00063  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00064  * 
00065  * Redistribution and use in source and binary forms, with or without
00066  * modification, are permitted provided that the following conditions
00067  * are met:
00068  * 
00069  * 1. Redistributions of source code must retain the above copyright
00070  *    notice, this list of conditions and the following disclaimer.
00071  * 
00072  * 2. Redistributions in binary form must reproduce the above copyright
00073  *    notice, this list of conditions and the following disclaimer in
00074  *    the documentation and/or other materials provided with the
00075  *    distribution.
00076  * 
00077  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00078  *    and "Vovida Open Communication Application Library (VOCAL)" must
00079  *    not be used to endorse or promote products derived from this
00080  *    software without prior written permission. For written
00081  *    permission, please contact vocal@vovida.org.
00082  *
00083  * 4. Products derived from this software may not be called "VOCAL", nor
00084  *    may "VOCAL" appear in their name, without prior written
00085  *    permission of Vovida Networks, Inc.
00086  * 
00087  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00088  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00089  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00090  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00091  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00092  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00093  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00094  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00095  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00096  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00097  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00098  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00099  * DAMAGE.
00100  * 
00101  * ====================================================================
00102  * 
00103  * This software consists of voluntary contributions made by Vovida
00104  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00105  * Inc.  For more information on Vovida Networks, Inc., please see
00106  * <http://www.vovida.org/>.
00107  *
00108  */