package main

import (
	"fmt"
	"net/http"

	"github.com/gorilla/mux"
)

func handleRequest(w http.ResponseWriter, req *http.Request) {
	page := initPageData(w, req)

	//vars := mux.Vars(req)
	//var fOk, uidOk bool
	//var f, uid string
	//f, fOk = vars["function"]
	//uid, uidOk = vars[""]
	if !page.LoggedIn {
		handleUserLoginForm(page)
	}
}

func handleRssFeed(w http.ResponseWriter, req *http.Request) {
	vars := mux.Vars(req)
	var uid string
	var uidOk bool
	if uid, uidOk = vars["uid"]; !uidOk {
		userError(w)
		return
	}
	w.Header().Set("Content-Type", "application/xml")
	v, err := buildRssFeed(uid)
	if err != nil {
		userError(w)
		return
	}
	fmt.Fprint(w, v)
}

func buildRssFeed(uid string) (string, error) {
	return "", nil
}
