PageRenderTime 27ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/MSNPSHARP_DEV/MSNPSharp/Services/ABServiceBindingWrapper.cs

http://msnp-sharp.googlecode.com/
C# | 72 lines | 36 code | 7 blank | 29 comment | 2 complexity | 7a8ead32280382cd0876cd0d2961286a MD5 | raw file
  1. #region
  2. /*
  3. Copyright (c) 2002-2012, Bas Geertsema, Xih Solutions
  4. (http://www.xihsolutions.net), Thiago.Sayao, Pang Wu, Ethem Evlice, Andy Phan, Chang Liu.
  5. All rights reserved. http://code.google.com/p/msnp-sharp/
  6. Redistribution and use in source and binary forms, with or without
  7. modification, are permitted provided that the following conditions are met:
  8. * Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. * Redistributions in binary form must reproduce the above copyright notice,
  11. this list of conditions and the following disclaimer in the documentation
  12. and/or other materials provided with the distribution.
  13. * Neither the names of Bas Geertsema or Xih Solutions nor the names of its
  14. contributors may be used to endorse or promote products derived from this
  15. software without specific prior written permission.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
  17. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  20. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  21. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  22. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  23. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  24. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  25. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  26. THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #endregion
  29. using System;
  30. using System.Collections.Generic;
  31. using System.Text;
  32. using System.Net;
  33. using System.Net.Sockets;
  34. namespace MSNPSharp.Services
  35. {
  36. using MSNPSharp.MSNWS.MSNABSharingService;
  37. [System.Web.Services.WebServiceBindingAttribute(Name = "ABServiceBinding", Namespace = "http://www.msn.com/webservices/AddressBook")]
  38. internal sealed class ABServiceBindingWrapper : ABServiceBinding
  39. {
  40. private IPEndPoint localEndPoint = null;
  41. public ABServiceBindingWrapper()
  42. : base()
  43. {
  44. }
  45. public ABServiceBindingWrapper(IPEndPoint localEndPoint, NSMessageHandler nsHandler)
  46. : this()
  47. {
  48. this.localEndPoint = localEndPoint;
  49. SingleSignOnManager.RenewIfExpired(nsHandler, SSOTicketType.Contact);
  50. }
  51. protected override WebRequest GetWebRequest(Uri uri)
  52. {
  53. WebRequest request = base.GetWebRequest(uri);
  54. HttpWebRequest httpRequest = request as HttpWebRequest;
  55. if (httpRequest != null)
  56. {
  57. httpRequest.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint((new IPEndPointCallback(localEndPoint)).BindIPEndPointCallback);
  58. }
  59. return request;
  60. }
  61. }
  62. };