<p>Kevin Harwell <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13861">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_queue: Refactor odd placement of if's around say_position<br><br>Change-Id: Icba97905e331812f129e5966e91a59b104c7a748<br>---<br>M apps/app_queue.c<br>1 file changed, 19 insertions(+), 37 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_queue.c b/apps/app_queue.c</span><br><span>index 5f95660..a6e2243 100644</span><br><span>--- a/apps/app_queue.c</span><br><span>+++ b/apps/app_queue.c</span><br><span>@@ -1617,7 +1617,7 @@</span><br><span>  time_t starttime;                    /*!< The time at which the member answered the current caller. */</span><br><span>    time_t lastcall;                     /*!< When last successful call was hungup */</span><br><span>         time_t lastpause;                    /*!< When started the last pause */</span><br><span style="color: hsl(0, 100%, 40%);">-     struct call_queue *lastqueue;        /*!< Last queue we received a call */</span><br><span style="color: hsl(120, 100%, 40%);">+ struct call_queue *lastqueue;        /*!< Last queue we received a call */</span><br><span>        unsigned int dead:1;                 /*!< Used to detect members deleted in realtime */</span><br><span>   unsigned int delme:1;                /*!< Flag to delete entry on reload */</span><br><span>       char rt_uniqueid[80];                /*!< Unique id of realtime member entry */</span><br><span>@@ -4020,44 +4020,26 @@</span><br><span>                 /* Say we're next, if we are */</span><br><span>          if (qe->pos == 1) {</span><br><span>                       res = play_file(qe->chan, qe->parent->sound_next);</span><br><span style="color: hsl(0, 100%, 40%);">-                     if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                              goto playout;</span><br><span style="color: hsl(120, 100%, 40%);">+                 if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+                           goto posout;</span><br><span>                         }</span><br><span style="color: hsl(0, 100%, 40%);">-                       goto posout;</span><br><span style="color: hsl(120, 100%, 40%);">+          /* Say there are more than N callers */</span><br><span style="color: hsl(120, 100%, 40%);">+               } else if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit) {</span><br><span style="color: hsl(120, 100%, 40%);">+                     res = (</span><br><span style="color: hsl(120, 100%, 40%);">+                               play_file(qe->chan, qe->parent->queue_quantity1) ||</span><br><span style="color: hsl(120, 100%, 40%);">+                          ast_say_number(qe->chan, qe->parent->announcepositionlimit, AST_DIGIT_ANY,</span><br><span style="color: hsl(120, 100%, 40%);">+                                           ast_channel_language(qe->chan), NULL) || /* Needs gender */</span><br><span style="color: hsl(120, 100%, 40%);">+                                play_file(qe->chan, qe->parent->queue_quantity2));</span><br><span style="color: hsl(120, 100%, 40%);">+           /* Say there are currently N callers waiting */</span><br><span>              } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                        if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){</span><br><span style="color: hsl(0, 100%, 40%);">-                               /* More than Case*/</span><br><span style="color: hsl(0, 100%, 40%);">-                             res = play_file(qe->chan, qe->parent->queue_quantity1);</span><br><span style="color: hsl(0, 100%, 40%);">-                                if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                               res = ast_say_number(qe->chan, qe->parent->announcepositionlimit, AST_DIGIT_ANY, ast_channel_language(qe->chan), NULL); /* Needs gender */</span><br><span style="color: hsl(0, 100%, 40%);">-                          if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                       } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                                /* Normal Case */</span><br><span style="color: hsl(0, 100%, 40%);">-                               res = play_file(qe->chan, qe->parent->sound_thereare);</span><br><span style="color: hsl(0, 100%, 40%);">-                         if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                               res = ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY, ast_channel_language(qe->chan), NULL); /* Needs gender */</span><br><span style="color: hsl(0, 100%, 40%);">-                               if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                       }</span><br><span style="color: hsl(0, 100%, 40%);">-                       if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){</span><br><span style="color: hsl(0, 100%, 40%);">-                               /* More than Case*/</span><br><span style="color: hsl(0, 100%, 40%);">-                             res = play_file(qe->chan, qe->parent->queue_quantity2);</span><br><span style="color: hsl(0, 100%, 40%);">-                                if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                       } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                                res = play_file(qe->chan, qe->parent->sound_calls);</span><br><span style="color: hsl(0, 100%, 40%);">-                            if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                       }</span><br><span style="color: hsl(120, 100%, 40%);">+                     res = (</span><br><span style="color: hsl(120, 100%, 40%);">+                               play_file(qe->chan, qe->parent->sound_thereare) ||</span><br><span style="color: hsl(120, 100%, 40%);">+                           ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                ast_channel_language(qe->chan), NULL) || /* Needs gender */</span><br><span style="color: hsl(120, 100%, 40%);">+                                play_file(qe->chan, qe->parent->sound_calls));</span><br><span style="color: hsl(120, 100%, 40%);">+               }</span><br><span style="color: hsl(120, 100%, 40%);">+             if (res) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    goto playout;</span><br><span>                }</span><br><span>    }</span><br><span>    /* Round hold time to nearest minute */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13861">change 13861</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/13861"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: Icba97905e331812f129e5966e91a59b104c7a748 </div>
<div style="display:none"> Gerrit-Change-Number: 13861 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Walter Doekes <walter+asterisk@wjd.nu> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>