title: One status change firing getstatus multiple times in lync
body: <p>I'm using an ActiveXObject to handle lync status changes and show presence via the javascript below</p>
  
  <pre><code>var Instant = {
  
  sipUri: "name@address.com", // Change this to the user's SIP URI you want to chat with
  nameCtl: new ActiveXObject('Name.NameCtrl.1'),
  
  onStatusChange: function (name, status, id) {
      alert(name + " " + status + " " +id);
  },
  
  showOOUI: function () {
  
  var oouiX = 0, oouiY = 0;
  
  oouiX += pawn_icon.offsetLeft + pawn_icon.clientLeft - pawn_icon.scrollLeft;
  oouiY += pawn_icon.offsetTop + pawn_icon.clientTop - pawn_icon.scrollTop;
  
  Instant.nameCtl.ShowOOUI(Instant.sipUri, 0, oouiX, oouiY);
  },
  
  hideOOUI: function () {
      Instant.nameCtl.HideOOUI();
  }
  }
  </code></pre>
  
  <p>And this html/javascript to actually register the event handler to the event:</p>
  
  <pre><code>&lt;head&gt;
      &lt;title&gt;Lync Presence Test&lt;/title&gt;
  
      &lt;!-- le JS --&gt;
      &lt;script type="text/javascript"&gt;
          if (Instant.nameCtl.PresenceEnabled) {
              Instant.nameCtl.OnStatusChange = Instant.onStatusChange;
              Instant.nameCtl.GetStatus(Instant.sipUri, "1");
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="presence" onmouseover="Instant.showOOUI()" onmouseout="Instant.hideOOUI()"&gt;Name&lt;img id="pawn" name="pawn_icon"  src="Styles/images/LyncStatus/imnon.png" alt="Available"&gt; &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>As the title states, if I load the page, I get the event fires and I get the status code like one would expect.  However, if I change my status, two events fire.  The first contains the right status code and the second contains the old status code.  The issue here is that I want to change to the new status, but the stale one is the last event to fire, so it overwrites the new change.  The event also fires 6 times when I mouse over the person's name.  </p>
  
  <p>Microsoft's documentation of the Name.NameCtrl object is pretty sparse, but as I understand the getstatus method and onstatuschange property, they're exactly what I'm looking for.  </p>
  
  <p>So, is there a reason that the statuschange event fires twice, and is there a way to either preempt this or switch the order of the events returned?  Also, why does the event fire if you mouse over the name, as no status change has occurred?  I'd like to find out more about the specific status change event, but I can't find anything.  I also don't have access to the lync server, so I have to do client-side set up.</p>
  
  <p>Name.NameCtrl documentation: <a href="http://msdn.microsoft.com/en-us/library/bb802706(v=office.14).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb802706(v=office.14).aspx</a></p>
  
  <p>Where I got the code for the presence functionality: <a href="http://blog.instant-tech.com/2012/05/web-client-for-microsoft-lync-2010.html" rel="nofollow">http://blog.instant-tech.com/2012/05/web-client-for-microsoft-lync-2010.html</a></p>