Clarify check for when to send message
authorMark Spencer <markster@digium.com>
Wed, 14 May 2003 21:13:53 +0000 (21:13 +0000)
committerMark Spencer <markster@digium.com>
Wed, 14 May 2003 21:13:53 +0000 (21:13 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1022 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index ead99ec..9a83882 100755 (executable)
@@ -4563,7 +4563,7 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer)
        strncpy(name, peer->name, sizeof(name) - 1);
        peer->lastmsgssent = ((newmsgs << 8) | (oldmsgs));
        ast_pthread_mutex_unlock(&peerl.lock);
-       if (create_addr(p, peer->name)) {
+       if (create_addr(p, name)) {
                /* Maybe they're not registered, etc. */
                sip_destroy(p);
                return 0;
@@ -4632,7 +4632,7 @@ restartsearch:
                peer = peerl.peers;
                time(&t);
                while(peer) {
-                       if (strlen(peer->mailbox) && (t - peer->lastmsgcheck > 10)) {
+                       if (strlen(peer->mailbox) && ((t - peer->lastmsgcheck) > 10)) {
                                sip_send_mwi_to_peer(peer);
                                break;
                        }
@@ -4951,8 +4951,8 @@ static struct sip_peer *build_peer(char *name, struct ast_variable *v)
                memset(peer, 0, sizeof(struct sip_peer));
                peer->expire = -1;
                peer->pokeexpire = -1;
-               peer->lastmsgssent = -1;
        }
+       peer->lastmsgssent = -1;
        if (peer) {
                if (!found) {
                        strncpy(peer->name, name, sizeof(peer->name)-1);