FrameworkModel fm = framework.getModel();
ConversationModel cm = fm.getConversationModel();
int c = cm.getConversationCount();
for (int i=0; i < c; i++) {
ConversationID cid = cm.getConversationAt(i);
Request req = cm.getRequest(cid);
HttpUrl url = req.getURL();
List<NamedValue> tokens = getRequestTokens(req);
if (url.toString().endsWith("logout.php")) {
String sessid = tokens.get(0).getValue();
addTransition(cid, "PHPSESSID", sessid, null);
} else if (req.getMethod().equals("POST") && url.toString().endsWith("login.php")) {
String sessid = null;
if (tokens.size() > 0)
sessid = tokens.get(0).getValue();
Response response = cm.getResponse(cid);
if (response.getStatus().equals("302")) {
String who = null;
tokens = getResponseTokens(response);
if (tokens.size() > 0)
sessid = tokens.get(0).getValue();
String content = new String(req.getContent());
NamedValue[] params = NamedValue.splitNamedValues(content, "&", "=");
for (int j = 0; j<params.length; j++)
if (params[j].getName().equals("user"))
who = params[j].getValue();
addTransition(cid, "PHPSESSID", sessid, who);