ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Smersh/Smersh.cpp
(Generate patch)

Comparing Smersh/Smersh.cpp (file contents):
Revision 166 by Douglas Thrift, 2004-06-18T22:24:07-07:00 vs.
Revision 167 by Douglas Thrift, 2004-06-19T03:02:57-07:00

# Line 93 | Line 93 | void Smersh::smersh(ostream& sout)
93   {
94          sout << "Content-Type: text/html\n\n";
95  
96 <        vector<Person> people;
96 >        vector<Person> people(1);
97  
98          for (multimap<string, string>::iterator itor(cgi.lower_bound("sn")); itor
99                  != cgi.upper_bound("sn"); ++itor)
# Line 102 | Line 102 | void Smersh::smersh(ostream& sout)
102  
103                  for (string::size_type index(0); index < sn.length(); ++index)
104                  {
105 +                        if (sn[index] == '%' && index + 2 < sn.length())
106 +                        {
107 +                                istringstream code(sn.substr(index + 1, 2));
108 +                                unsigned short character;
109 +
110 +                                code.setf(ios_base::hex, ios_base::basefield);
111 +
112 +                                code >> character;
113 +
114 +                                sn.replace(index, 3, 1, character);
115 +                        }
116 +
117                          while (!isalnum(sn[index]) && index < sn.length())
118                          {
119                                  sn.erase(index, 1);
120                          }
109
110                        if (index < sn.length()) sn[index] = tolower(sn[index]);
121                  }
122  
123                  Person person(sn);
# Line 122 | Line 132 | void Smersh::smersh(ostream& sout)
132                  }
133          }
134  
135 +        if (people.size() > 1)
136 +        {
137 +                people.erase(people.begin());
138 +
139 +                sort(people.begin(), people.end());
140 +
141 +                people.erase(unique(people.begin(), people.end()), people.end());
142 +        }
143 +
144          sout << "<html><head><title>Hello, " << flush;
145  
146          output(sout, people);
# Line 143 | Line 162 | void Smersh::output(ostream& sout, const
162  
163                  if (person + 2 == people.end())
164                  {
165 <                        sout << (people.size() > 2 ? "," : "") << " and ";
165 >                        sout << (people.size() > 2 ? "," : "") << " and/or ";
166                  }
167                  else if (person + 1 != people.end())
168                  {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines