Spacing between environments

I am trying to define a dialog environment while using the lettrine package. My problem are the spaces between the dialogs. There is no problem when a dialog consists of more than two lines. But paragraphs with one line are problematic since the number of lines given in lettrine is two.

Is it possible to count the lines in a paragraph and determine the space between the paragraphs with respect to the number of lines?

\documentclass{minimal}
\usepackage{graphicx}
\usepackage{lettrine}
\usepackage{needspace}
\usepackage{lipsum}

\newenvironment{dialog}
{\lettrine[lines=2,nindent=3pt,findent=3pt,image=true,loversize=0.7,lraise=-0.2]{myimage.eps}{}}
{\par}

\begin{document}

\begin{dialog}
\lipsum[1]
\end{dialog}

\begin{dialog}
Just one line.
\end{dialog}

\begin{dialog}
\lipsum[2]
\end{dialog}

\end{document}

-

Try to insert e.g. this

{\par\ifnum\prevgraf<2 \leavevmode\null\par\fi}


instead of just {\par} in the definition of the "ending" of the dialog environment.

Edit: I corrected your ME to make it a MWE;).

Edit 2: note that this simple solution will break if the dialog environment contains more than one paragraph and the last one has less than two lines. To work in such a case, one would probably need to redefine \par, which is definitely not something for the faint-of-heart.

-
Probably \ifnum\prevgraf<2 would be better. –  egreg Feb 26 '12 at 20:04
Change to \usepackage[demo]{graphicx}, then you can compile without the image. –  Peter Grill Feb 26 '12 at 20:04
@PeterGrill: the fake image might be too big then. –  mbork Feb 26 '12 at 20:04
@egreg: theoretically yes, practically it won't matter too much;). But I corrected this anyway. –  mbork Feb 26 '12 at 20:05
It worked! mbork, thank you very much for quick response. –  Emrah Akyar Feb 26 '12 at 20:06
show 1 more comment