Changeset 8461


Ignore:
Timestamp:
12/01/07 01:30:00 (5 years ago)
Author:
milkfish
Message:

new phonebook function added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/httpd/modules/milkfish.c

    r8075 r8461  
    373373} 
    374374 
     375void 
     376show_registrations_table (webs_t wp, char *type, int which) 
     377{ 
     378 
     379  static char word[256]; 
     380  char *next, *wordlist; 
     381  char *user, *contact, *agent; 
     382  static char new_user[200], new_contact[200], new_agent[200]; 
     383  int temp; 
     384  wordlist = nvram_safe_get ("milkfish_ddactive"); 
     385  temp = which; 
     386 
     387  foreach (word, wordlist, next) 
     388  { 
     389    if (which-- == 0) 
     390      { 
     391        contact = word; 
     392        user = strsep (&contact, ":"); 
     393        if (!user || !contact) 
     394          continue; 
     395 
     396        agent = contact; 
     397        contact = strsep (&agent, ":"); 
     398        if (!contact || !agent) 
     399          continue; 
     400        
     401 
     402        if (!strcmp (type, "user")) 
     403          { 
     404            httpd_filter_name (user, new_user, sizeof (new_user), GET); 
     405            websWrite (wp, "%s", new_user); 
     406          } 
     407        else if (!strcmp (type, "contact")) 
     408          { 
     409            httpd_filter_name (contact, new_contact, sizeof (new_contact), GET); 
     410            websWrite (wp, "%s", new_contact); 
     411          } 
     412        else if (!strcmp (type, "agent")) 
     413          { 
     414            httpd_filter_name (agent, new_agent, sizeof (new_agent), GET); 
     415            websWrite (wp, "%s", new_agent); 
     416          } 
     417 
     418        return; 
     419      } 
     420   } 
     421} 
     422 
     423 
     424void 
     425ej_show_registrations (webs_t wp, int argc, char_t ** argv) 
     426{ 
     427  int i; 
     428  char *count; 
     429  int c; 
     430  count = nvram_safe_get ("milkfish_ddactivenum"); 
     431  if (count == NULL || strlen (count) == 0 || (c=atoi(count))<=0) 
     432  { 
     433      websWrite (wp, "<tr>\n"); 
     434      websWrite (wp, 
     435                 "<td colspan=\"4\" align=\"center\" valign=\"middle\">- <script type=\"text/javascript\">Capture(share.none)</script> -</td>\n"); 
     436      websWrite (wp, "</tr>\n"); 
     437  } 
     438  for (i = 0; i < c; i++) 
     439    { 
     440      websWrite (wp, "<tr><td>\n"); 
     441      websWrite (wp, "<input maxlength=\"20\" size=\"20\" name=\"user%d\" onblur=\"valid_name(this,'Name')\" value=\"",i); 
     442      show_registrations_table (wp, "user", i); 
     443      websWrite (wp, "\" readonly=\"readonly\" /></td>\n"); 
     444      websWrite (wp, "<td>\n"); 
     445      websWrite (wp, "<input maxlength=\"50\" size=\"50\" name=\"contact%d\" onblur=\"valid_name(this,'Name')\" value=\"",i); 
     446      show_registrations_table (wp, "contact", i); 
     447      websWrite (wp, "\" readonly=\"readonly\" /></td>\n"); 
     448      websWrite (wp, "<td>\n"); 
     449      websWrite (wp, "<input maxlength=\"50\" size=\"50\" name=\"agent%d\" onblur=\"valid_name(this,'Name')\" value=\"",i); 
     450      show_registrations_table (wp, "agent", i); 
     451      websWrite (wp, "\" readonly=\"readonly\" /></td>\n"); 
     452      websWrite (wp, "</tr>\n"); 
     453    } 
     454  return; 
     455} 
     456 
     457 
Note: See TracChangeset for help on using the changeset viewer.